Skip to content

An OpenAI-compatible endpoint still needs compatibility testing

Updated 5 min readFor engineers integrating applications with self-hosted inference servers

OpenAI compatibility describes a request shape and promises little about behavior for a given model and server version. On vLLM, some parameters are ignored or unsupported, the model repository’s generation config can change sampling defaults, automatic tool calls aren’t guaranteed to match their schema, and the API key option covers only some paths. The dangerous differences are the ones where the request succeeds and the behavior has changed. Write down the features your application uses and test those against the pinned model and server.

Loud failures are the easy ones

Swapping a base URL often works on the first try, and that first success misleads. A request that returns a clean 400 is a good outcome, because someone notices and fixes it. The trouble is requests that succeed and behave differently from what the code assumes: a field nobody honors, a sampling default that moved, a tool call with an argument the schema doesn’t allow.

I’d organize the testing by how a difference shows up, and spend most of the effort on silent failures, the right-hand column of the grid, since those reach production unnoticed.

Fails loudlyFails silentlyIn therequestIn theresponseRejectedClear error; the consumer must notretry foreverIgnored or redefaulteduser ignored; repository samplingappliedUnparseableMalformed JSON, caught by the parserPlausible but wrongBad arguments, cut-off streamIn the request · Fails loudlyRejectedClear error; the consumer must not retryforeverIn the request · Fails silentlyIgnored or redefaulteduser ignored; repository sampling appliedIn the response · Fails loudlyUnparseableMalformed JSON, caught by the parserIn the response · Fails silentlyPlausible but wrongBad arguments, cut-off stream
Silent differences do the damage. Build the test suite around the right-hand column, then cover the left for error handling.

Differences vLLM documents

These come from vLLM’s own documentation. Check them against the version you run, because the project moves quickly and flags and defaults change. I don’t mean any of this as criticism. The project documents these behaviors clearly, and most integration trouble comes from nobody having read them.

AreaDocumented behaviorWhat can go wrong
user parameterIgnored on Chat CompletionsPer-user abuse tracking or attribution silently does nothing
suffix parameterNot supported on CompletionsInsert-style prompts lose their ending
parallel_tool_callsFalse limits to zero or one call; true allows many, depending on the modelAn agent written for parallel calls runs serially, or stalls
Sampling defaultsgeneration_config.json from the model repository applies by defaultSame request, different sampling after a model change
Chat templateRequired; you must supply one if the tokenizer has noneTool or system messages are formatted wrongly or dropped
Extra parametersSome, such as top_k, go through extra_bodyCode that works here fails against a hosted API
--api-keyCovers only /v1, /v2 and /inference prefixesOther routes on the server remain open

The sampling default deserves its own test

No other difference is as likely to cost someone a week. By default, the server applies generation_config.json from the Hugging Face model repository if one exists, so the model creator’s recommended values can override the defaults you assumed. Two things follow. Comparisons between models may be comparing different sampling without anyone having chosen that. And a model revision that edits only that file can change behavior with no change to your application or the weights.

Decide on one policy. Either pass --generation-config vllm at launch to disable this, or keep it and version the file with the rest of the release. In both cases, set the sampling values you care about explicitly in the request, and log them.

Tool calls have three levels of guarantee

Agents depend on this section more than any other. vLLM’s tool calling documentation describes different promises depending on how the call is requested, and it’s easy to assume the strongest one applies when it doesn’t.

With a named function selected through tool_choice, the call is enforced through the structured outputs backend. The documentation’s wording is worth quoting: "validly-parsable function call - not a high-quality one." The JSON will parse. The arguments can still be nonsense. With tool_choice set to required, the model is guaranteed to generate one or more tool calls from the list.

With auto, the model decides, the server needs --enable-auto-tool-choice and a --tool-call-parser matching the model, and the documentation warns that arguments may occasionally be malformed or violate the function’s schema unless strict constraints are active. Your application must validate arguments in every auto-mode call and handle the failure, even when the same code never needed to before. Parsers are specific to model families, so a model swap can mean a parser change too. The optional --chat-template flag points to a template that handles tool-role messages and earlier tool calls, and a wrong template often shows up only on the second turn, after a tool result comes back. Test full round trips.

A contract suite you can write this week

Keep the suite small, make it run in CI against a real server, and rerun it whenever the model, server version, parser or template changes. Each test states one expectation your application relies on. Leave out features your application doesn’t use. A shorter suite that always runs beats a comprehensive one nobody maintains.

contract: analytics-agent-endpoint@v3
pinned: { model_revision: <hash>, server: <version>, parser: <name> }

tests:
  - identity:      GET /v1/models returns the expected served name
  - sampling:      fixed prompt, logged values, repeat 5 times
  - schema:        response_format on 20 hard prompts; validate every one
  - truncation:    low max_tokens; finish_reason is length; consumer rejects
  - auto_tools:    arguments validated; violations counted, never executed
  - named_tool:    parses, and arguments are still checked for meaning
  - round_trip:    tool result returned; second turn is well formed
  - stream_cut:    close mid-stream; UI marks the answer incomplete
  - over_limit:    prompt above max length; clear error, no retry loop
  - auth:          every route without a token is refused at the gateway

Streaming and truncation reach the reader

For analytics these two cases carry extra weight. A partial narrative reads perfectly well, so an interrupted stream can present half an explanation with the caveat missing. The consumer has to detect an explicit completion signal, and the interface should show an interrupted answer as interrupted. Test by cutting the connection and by forcing a low token limit, then look at what a person would see.

Well-formed and correct are separate results, so keep schema compliance and business correctness apart. A response can match its schema and hold the wrong number, and a good explanation can break the schema and be unusable. Lumped under compatibility, they hide which team has the work to do. The post on LLM evaluation metrics covers the correctness side.

Secure and observe it like any other dependency

vLLM’s documentation says plainly not to rely on --api-key alone, and notes that endpoints outside the listed prefixes, including /invocations, are not authenticated. Terminate authentication at a gateway, keep the server off general networks, and have your contract suite probe every route. Treat a request’s user parameter as a no-op on this server, so attribution belongs in the gateway’s logs.

For operations, the server exposes Prometheus metrics, including vllm:num_requests_running, vllm:request_queue_time_seconds and vllm:kv_cache_usage_perc. Decide what the application does when the server is loading, full or down, and test that as well. A request with a generous timeout during a model load can tie up a worker for minutes.

When to rerun, and what to record

Any change to the model revision, server version, parser, chat template, generation config or launch flags is a new contract, even when the URL stays the same. Record all of those with the results, alongside the versions of the client library. The next failure then has a known-good state to compare with, and the post on model rollback explains what to keep so you can get back to it.

Ask the same of a product that calls a model for you. What does it do when a model’s output breaks its expected format, and does that show up in the answer? In Nexatron the model proposes and deterministic checks decide whether a query runs, one way to keep a malformed or wrong tool call from reaching data. Test any design by forcing the failure.

Bring three business questions

Explore your sources, definitions, and review criteria with our team. Please keep credentials and sensitive records out of the inquiry.