OpenAI-compatible API: what it means and what actually works
Updated 2026-11-26
Model page: GPT-6.2 Sol API — pricing, specs and the playground
OpenAI's chat completions format became the common language for LLM APIs because the first wave of tools was written against it. Editors, agent frameworks and chat clients all know how to talk to a URL that ends in /v1/chat/completions, so other providers and gateways answer in that format too. For a developer it means one integration can reach many models: you do not rewrite the code that builds messages, parses tool calls or reads the stream.
What follows is specific to APIMODELS and was checked against the running service on 26 November 2026: which endpoints exist, how each parameter is handled for each model family, and where the behavior differs from OpenAI's own API. Where something does not work, the table says so.
The three values you change
| Setting | With OpenAI | With APIMODELS |
|---|---|---|
| Base URL | https://api.openai.com/v1 | https://api.apimodels.app/v1 |
| API key | An OpenAI key | An APIMODELS key, sent as Authorization: Bearer (x-api-key also works) |
| Model name | gpt-6.2-sol | gpt-6.2-sol, or claude-sonnet-5-5, gemini-4-argon, grok-4.6, deepseek-v4-pro, glm-5.3, qwen4-max and others from /v1/models |
Which OpenAI endpoints exist on APIMODELS
| Endpoint | Status | Notes |
|---|---|---|
| POST /v1/chat/completions | Yes | 58 chat models: Claude and Gemini requests are translated to each vendor's native API and back |
| POST /v1/responses | Yes | GPT and other OpenAI-format models; Claude and Gemini are not served here, use chat completions |
| POST /v1/embeddings | Yes | text-embedding-3-small and text-embedding-3-large |
| POST /v1/completions (legacy) | Yes | OpenAI-format language models only |
| GET /v1/models | Yes, no key needed | 191 models; each has two extra fields, modality and endpoint |
| POST /v1/images/edits | Yes | OpenAI multipart format, returns the OpenAI shape |
| POST /v1/images/generations | Yes, different by default | Asynchronous: returns a task ID that you poll, not the OpenAI image response |
| POST /v1/audio/speech | Partly | mp3 and pcm output only; instructions is ignored; speed 0.7 to 1.2 |
| /v1/realtime | One model | grok-voice-3.0 only |
| /v1/files | Not the OpenAI Files API | An upload endpoint for media inputs with its own response shape |
| Assistants, threads, batches, fine-tuning, moderations, audio/transcriptions | No | These paths return 404 unknown_endpoint |
How chat completions parameters are handled, by model family
GPT, Grok, DeepSeek, GLM and Qwen speak this format natively, so supported fields are forwarded as they are. Claude and Gemini requests are translated, and a field with no equivalent on the other side is dropped without an error. Forwarded means the upstream receives it; whether a given model honors it is up to that model.
| Parameter | GPT, Grok, DeepSeek, GLM, Qwen | Claude | Gemini |
|---|---|---|---|
| stream | Yes | Yes, as chat.completion.chunk events ending in [DONE] | Yes |
| tools (function calling) | Forwarded | Function tools only | Function tools only; schema reduced to what Gemini accepts |
| tool_choice | Forwarded | auto, none, required and a named function | auto, none, required |
| parallel_tool_calls | Forwarded | false is honored | Dropped |
| response_format: json_schema | Forwarded | Mapped to structured outputs | Returns JSON, but the schema itself is not enforced |
| Image input (image_url) | Forwarded; GLM-5.2 and GLM-5.3 reject images with a 400 | Yes, data URLs and links | Yes; video_url is accepted too |
| max_tokens / max_completion_tokens | Both forwarded | Either one | Either one |
| temperature, top_p, stop | Forwarded | Mapped; limited when thinking is on | Mapped |
| n, logprobs, seed | Forwarded | Dropped | Dropped |
| reasoning_effort | Forwarded | Mapped per model | low, medium, high; none and minimal become low |
| Web search | Use /v1/responses; not reliable on chat completions | Not available through this endpoint | web_search tool or web_search_options, billed per search |
| service_tier | Dropped | Not applicable | Not applicable |
Where the behavior differs from OpenAI's API
1. Unknown fields are dropped silently. The chat endpoint forwards a fixed list of fields. A field outside that list does not cause an error and does not reach the model, so test that a setting has an effect before you rely on it.
2. The usage object has an extra cost field. Every response reports what was charged: usage.cost with currency, amount and the amount actually charged. In a stream, usage arrives in the final chunk whether or not you ask for it. Claude responses also carry Anthropic's own token fields next to the OpenAI ones.
3. Request IDs are in our own headers. Responses carry x-apimodels-request-id, and non-streaming responses also carry x-apimodels-cost. There is no x-request-id and there are no x-ratelimit headers.
4. Errors come in two shapes. A missing key, a missing model field or an unknown model family returns OpenAI's shape, an error object with message, type and code. A balance that is too low (402), a model name that is not found inside a known family (404) and errors passed on from upstream return a shape without code, with type at the top level as well. Both have error.message and error.type; do not depend on error.code being present.
5. Balance is checked before the request runs. We reserve the estimated input plus max_tokens at the output price. A very large max_tokens can be rejected with a 402 even though the answer would have been short.
6. Some OpenAI model aliases are rewritten. gpt-5.6 resolves to gpt-5.6-sol, for example, and the response reports the resolved name.
Clients with a setup guide
Any client that lets you set an OpenAI base URL and key can use the endpoint. We keep step-by-step guides for Cursor, Codex, OpenCode, Cherry Studio, n8n, OpenClaw and WorkBuddy, and one client setup page that covers the rest, including Aider, ChatBox, Continue, LobeChat and NextChat. Claude Code and Gemini CLI use the vendors' native formats rather than the OpenAI one, and have their own guides. All of them are linked under Related pages below.
Quick start
cURL
# Same request, three vendors: only the model name changes
for MODEL in gpt-6.2-sol claude-sonnet-5-5 gemini-4-argon; do
curl -s https://api.apimodels.app/v1/chat/completions \
-H "Authorization: Bearer $APIMODELS_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"$MODEL\",
\"max_tokens\": 128,
\"messages\": [{\"role\": \"user\", \"content\": \"Name one use for a paperclip.\"}]
}"
echo
donePython
import openai
# The OpenAI SDK, unchanged. Only base_url and api_key differ from calling OpenAI.
client = openai.OpenAI(
base_url="https://api.apimodels.app/v1",
api_key="sk_...your_apimodels_key...",
)
for model in ["gpt-6.2-sol", "claude-sonnet-5-5", "gemini-4-argon"]:
r = client.chat.completions.create(
model=model,
max_tokens=128,
messages=[{"role": "user", "content": "Name one use for a paperclip."}],
)
# usage.cost is an APIMODELS extension: what this request was charged
cost = (r.usage.model_extra or {}).get("cost", {})
print(model, "->", r.choices[0].message.content, "| charged", cost.get("charged"), cost.get("currency"))FAQ
What does "OpenAI-compatible API" mean?
It means the service accepts requests in the format of OpenAI's /v1/chat/completions and answers in the same structure, so software written for OpenAI works after you change the base URL, the API key and the model name. It describes the wire format only. It does not mean the models are OpenAI's, and it does not promise every OpenAI endpoint or parameter.
Is an OpenAI-compatible API exactly the same as OpenAI's API?
No. The request and response shapes match for the common cases, but each provider supports its own subset. On APIMODELS the differences are: unknown fields are dropped silently, n, logprobs and seed do not reach Claude or Gemini, Gemini returns JSON without enforcing a json_schema, errors come in two shapes, and there is no Assistants, Batch, fine-tuning or moderation endpoint.
Are Claude and Gemini OpenAI-compatible?
Not natively: each has its own API format, and each vendor offers a compatibility layer with limits. Anthropic describes its OpenAI SDK compatibility as not a long-term or production-ready solution for most use cases, and Google's OpenAI library support is still in beta. On APIMODELS you can call 21 Claude models and 12 Gemini models through /v1/chat/completions; the request is translated to the vendor's native API, including streaming, function calling and image input.
Does an OpenAI-compatible API cover every OpenAI endpoint?
Rarely. Most providers implement chat completions and little else. APIMODELS has chat completions, responses, embeddings, legacy completions, models, image edits and a partial audio speech endpoint. Image generation exists but is asynchronous by default. Assistants, threads, batches, fine-tuning, moderations and audio transcriptions are not implemented and return 404.
Can I switch models without changing my code?
For plain chat, yes: change the model string and nothing else. For anything beyond that, test first. Tool calling works across GPT, Claude and Gemini, but parallel_tool_calls is dropped on Gemini, structured output with a schema is enforced on GPT and Claude and not on Gemini, and sampling settings such as seed only reach OpenAI-format models. The parameter table above lists each case.
Related
- OpenAI API: models, pricing, keys and first call
- LLM API reference
- Client setup: Cursor, coding tools, chat apps
- Use APIMODELS in Cursor
- Use APIMODELS in Codex
- Point Claude Code at APIMODELS
- OpenAI API error codes, and the APIMODELS set
- OpenAI API pricing and cost examples
- Claude API: models, pricing and first call
- One API for image, video, audio and language models
- APIMODELS compared with OpenRouter
