OpenAI-compatible
A drop-in compatible chat/completions endpoint — change the base URL, swap the API key, set the model to a persona ID. Streaming, tool calling, and function calling pass through unchanged.
Drop-in compatibility
If you already use the OpenAI SDK (or a wrapper that speaks the OpenAI shape), Moonborn is a base-URL swap away. The endpoint at https://api.moonborn.co/v1/openai accepts OpenAI-shaped requests and returns OpenAI-shaped responses — with the model field carrying a persona ID instead of gpt-4.
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.MOONBORN_API_KEY,
baseURL: 'https://api.moonborn.co/v1/openai',
});
const response = await client.chat.completions.create({
model: 'persona://persona_mert_abc123',
messages: [{ role: 'user', content: 'What drives you?' }],
});Same call shape in Python with the OpenAI Python SDK, same call shape with curl. No new client library required.
Supported
POST /v1/openai/chat/completions— streaming and non-streaming.GET /v1/openai/models— lists your workspace personas as models.- Tool calling and function calling — pass through to the persona-scoped chat runtime.
Differences worth knowing
The shape is OpenAI-compatible; the behavior is Moonborn:
modelis a persona reference (persona://<id>), not a generic model.- Response metadata — drift score, layer attribution, audit ID — rides on
x-moonborn-*response headers. Safely ignored by OpenAI clients; available if you parse them. - Rate-limit and token-count headers match OpenAI conventions, but the underlying limits come from your Moonborn workspace tier (see tiers).
- The persona's drift-detection rules still apply. If a reply exceeds the workspace threshold, the response carries
x-moonborn-drift-alert: trueand (if configured) gets routed through fallback recovery before shipping.
Migration checklist
- Swap
OPENAI_API_KEYforMOONBORN_API_KEY. - Set the base URL to
https://api.moonborn.co/v1/openai. - Replace model IDs with persona IDs (
persona://<id>). - Test in a sandboxed workspace with
sk_test_*keys. - Cut over production.
What is not compatible
- Image generation.
- Embeddings.
- Audio (TTS / STT).
Those aren't Moonborn's domain. Keep your OpenAI client side-by-side for those endpoints; use Moonborn for the persona-bound chat layer.
Tier
Free and up. The endpoint inherits whatever rate limit your workspace plan provides — see tiers.
Next
- Quickstart — native Moonborn flow if you'd rather skip the shim.
- Drop in — OpenAI and MCP — companion path with MCP.
- OpenAI-compatible reference.