An "OpenAI-compatible" gateway doesn't mean compatible: five places where agents break
The label "OpenAI-compatible API" only guarantees the request format, not the behavior: there is no specification or test suite behind the term. So after you change base_url, a stream may end without data: [DONE], a JSON schema may be ignored, and the agent may write "I would call the function" instead of actually calling it. None of these failures shows up in a smoke test with a single request. Before going to production, run the gateway through a checklist: parameters, schemas, streaming, tools, and errors.
AI-processed from Habr AI; edited by Hamidun News
Switching LLM providers looks harmless: you change base_url and api_key, and the rest of the code stays the same. A week later in production, the stream hangs, the parser fails on a "strict" JSON schema, and instead of calling search, the agent replies in text, "I would call the search function." A smoke test with a single request misses all of this, because the phrase "OpenAI-compatible API" describes only the format of requests and responses. Behavior, parameters, and limits are determined by the provider itself.
The analysis was published on Habr by the team behind the aggregator BotHub, which means the authors sell such a gateway themselves. But the checklist is universal and suits any gateway: OpenRouter, LiteLLM, or a self-hosted server.
What "compatible" actually means
The term has no specification, no version, and no test suite. Any service that accepts POST /v1/chat/completions and returns JSON with a choices field can call itself compatible. Compatibility breaks down into three levels: routes and request structure (almost everyone handles this), response format (usage, finish_reason, reasoning fields), and behavior (parameters, temperature caps, errors, retries). The third level is usually where things break.
Risks depend on the type of provider. Aggregators such as OpenRouter and LiteLLM translate your request into the native APIs of dozens of models, and whatever they fail to translate they either drop or pass through incorrectly. In a self-hosted stack (vLLM, Ollama, llama.cpp), problems come from the model and the server settings. Cloud offerings like Azure, Bedrock, and Vertex are closer to the original, but they add their own authentication, limits, and delays in updating available models.
Where things break most often
Parameters. The trickiest case is silent ignoring: the server accepts temperature, seed, and logprobs, replies with 200, and applies none of them. Anthropic's compatibility layer ignores response_format, seed, and logit_bias, and caps temperature at one. Another trap is max_tokens versus max_completion_tokens: OpenAI's reasoning models accept only the second. Some gateways rename the parameter themselves, while others pass it through as is and get a 400. The check is simple: send an unusual set of parameters and compare responses across different seeds. Identical responses mean the parameters were discarded. Prefer providers that honestly return a 400 for unsupported parameters.
Structured output. JSON mode guarantees valid JSON, but not its structure. Not every provider supports a real json_schema with strict: true. In a test across 244 models from 23 providers, some returned only JSON mode, and others emulated the schema through the prompt. Recursive schemas with $ref and deep nesting break even on providers that claim support. Validate the response against your own schema (for example, with Pydantic) and check finish_reason: if it isn't stop, the response may have been cut off by the token limit, and the schema matched by accident.
Streaming. If you enable stream_options include_usage, the last chunk arrives with an empty choices array, and a naive chunk.choices[0] raises an IndexError. Some gateways never send data: [DONE], and the loop hangs until a timeout. Reasoning models deliver their thoughts in different fields: reasoning_content for DeepSeek-compatible providers, reasoning for others. Chunk sizes also vary: some send a token, others a word. If your UI assumes that one chunk equals one line or parses Markdown along chunk boundaries, it will break on another provider.
Tool calling. The request looks identical everywhere, but the responses differ. In vLLM, tools work only when the server is started with --enable-auto-tool-choice and --tool-call-parser. Without these flags, the model writes the call as plain text, tool_calls is missing from the response, and the orchestrator concludes that no tools are needed. In streams, arguments arrive in pieces, and some gateways assemble them by index incorrectly. Parallel calls get merged into one or the second call disappears. For testing, use a scenario with two tools at once and output truncated by length.
Errors and limits. The OpenAI SDK chooses the exception type based on the status code and the type field. If a gateway returns errors in its own format, you get a generic APIError, and retries by type won't fire. It can be worse: HTTP 200 with an {"error": ...} body. A third-party gateway may not send a Retry-After header at all. In that case, you need exponential backoff with jitter. The SDK retries 408, 409, 429, and 5xx on its own, but it refuses to wait longer than about 120 seconds.
Multimodality, embeddings, and practice
Images in the image_url format are formally standard, but the gateway converts them into the native Claude and Gemini schemas, and size limits get lost along the way. Some providers accept PDFs as a file-type content part, others through the Files API, and some don't support them at all. The /v1/audio/* endpoints are proxied even less often. Embeddings are riskier: vectors from different providers can't be stored in the same collection, even when the dimensions match. Normalization differs on self-hosted setups, and not all providers support base64 for compactness.
For the Responses API, the author advises keeping portable code on Chat Completions and using /v1/responses only where the provider is certain to proxy it to OpenAI. Otherwise, reasoning.effort and server-side state will silently disappear.
The practical takeaway: build a small set of tests (unusual parameters, a schema, a stream with usage, two parallel tools, a 429 error) and run them in CI whenever you change the model or update the gateway. Pin SDK versions and don't upgrade on the day new dependencies are released. That way, your effort goes to what actually distinguishes providers: the quality of the model for your task, the price, and the response speed.
- Nov 30, 2026Anthropic delays training its model by six weeks and bars it from improving AI for 14 days
- Nov 30, 2026Kodacode 2.0: AI coding agent gets plugins, built-in Git, and a skills catalog
- Nov 30, 2026Claude blocked? How to run Claude Code on a ChatGPT subscription in 15 minutes
- Nov 30, 2026Apple Signs Deals with 20+ Publishers, Including BBC and CNN, So Siri AI Can Stay Current on the News
Key Questions Answered
What "compatible" actually means?
The term has no specification, no version, and no test suite. Any service that accepts POST /v1/chat/completions and returns JSON with a choices field can call itself compatible. Compatibility breaks down into three levels: routes and request structure (almost everyone handles this), response format (usage, finish_reason, reasoning fields), and behavior (parameters, temperature caps, errors, retries). The third level is usually where things break. Risks depend on the type of provider.
Where things break most often?
Parameters. The trickiest case is silent ignoring: the server accepts temperature, seed, and logprobs, replies with 200, and applies none of them. Anthropic's compatibility layer ignores response_format, seed, and logit_bias, and caps temperature at one. Another trap is max_tokens versus max_completion_tokens: OpenAI's reasoning models accept only the second. Some gateways rename the parameter themselves, while others pass it through as is and get a 400.
What are the key details on Multimodality, embeddings, and practice?
Images in the image_url format are formally standard, but the gateway converts them into the native Claude and Gemini schemas, and size limits get lost along the way. Some providers accept PDFs as a file-type content part, others through the Files API, and some don't support them at all. The /v1/audio/ endpoints are proxied even less often. Embeddings are riskier: vectors from different providers can't be stored in the same collection, even when the dimensions match.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
