Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseAPI / Product · ActionableHabr AI→ original

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
An "OpenAI-compatible" gateway doesn't mean compatible: five places where agents break
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Anthropic's compatibility layer ignores response_format, seed, and logit_bias
Key metric #2vLLM without --enable-auto-tool-choice replies with text instead of tool_calls
Key metric #3With include_usage, the final chunk with an empty choices array crashes the loop with an IndexError

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.

Story

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.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

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.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — An "OpenAI-compatible" gateway doesn't mean compatible: five places where agents break https://news.hamidun.com/en/news/18737/an-openai-compatible-gateway-doesn-t-mean-compatible-five-pl

What do you think?
Loading comments…