What is an OpenAI-compatible API?
An OpenAI-compatible API is an HTTP endpoint that accepts the same request bodies and returns the same response shapes as OpenAI’s own API, so an official OpenAI SDK works against it after you change one setting — the base URL. It is a convention, not a standard: there is no certification, and providers implement different subsets of it.
What it means in practice
The OpenAI SDKs take the API host as a constructor argument. Point that at another server that speaks the same dialect and every call in your code — messages, streaming, tool definitions, the response object you already parse — keeps working. That is the whole mechanism. There is no adapter layer and no translation step.
from openai import OpenAI
client = OpenAI(
base_url="https://router.mingles.ai/v1", # the only line that changes
api_key="sk-your-key",
)
resp = client.chat.completions.create(
model="MiniMaxAI/MiniMax-M2.7",
messages=[{"role": "user", "content": "Hello"}],
)What is almost always implemented
- POST /v1/chat/completions — the endpoint that matters. Messages array, roles, temperature, max_tokens.
- Server-sent-event streaming, with the same delta chunks and the same [DONE] sentinel.
- Tool / function calling, in the tools + tool_choice form.
- GET /v1/models — a catalogue listing. Treat it as a hint, not a contract: it commonly lists ids the server will refuse to actually run.
- Bearer-token auth in the Authorization header.
What differs, and will bite you
- Model ids. There is no shared naming — "gpt-4o" does not exist elsewhere. Every provider has its own ids, and they are usually case-sensitive.
- Endpoints beyond chat. Embeddings, image generation, audio, the Assistants and Responses APIs, the Batch API — most compatible servers implement none of these. We implement /v1/chat/completions and /v1/models, and nothing else.
- Parameters that are silently ignored rather than rejected: logprobs, seed, n>1, presence/frequency penalties.
- Error bodies. The status codes usually match; the JSON inside them rarely does. Do not parse error strings.
- Rate-limit and usage headers. Names and presence vary.
Anthropic-compatible is a different thing. Claude’s API uses /v1/messages with its own request shape, and tools built for it (Claude Code among them) will not talk to an OpenAI-compatible endpoint. We serve the OpenAI dialect only.
How to check a provider actually is one
Send one real request rather than reading the marketing page. If it returns a choices array with a message in it, the SDK will work. A catalogue listing proves nothing.
curl https://router.mingles.ai/v1/chat/completions \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"model":"MiniMaxAI/MiniMax-M2.7","messages":[{"role":"user","content":"ping"}]}' FAQ
▸Do I need to install a different SDK?
No. Use the official OpenAI SDK for your language and set base_url (Python), baseURL (Node) or OPENAI_BASE_URL (env). That is the entire integration.
▸Will streaming and tool calling work?
Yes, both — they are part of the chat completions format. Check the provider’s docs for tool-calling support specifically, since it is the piece most often missing on smaller servers.
▸What about embeddings?
Usually not. Most OpenAI-compatible gateways serve chat completions only, and we are one of them — we do not implement /v1/embeddings. Keep embeddings with a provider that offers them; the two can be different services.