Skip to content

Mapping one chat API onto another

Field by field: messages, system prompts, stop sequences, tool schemas, streaming events, usage objects and finish reasons.

Every chat API expresses the same handful of ideas: a transcript, an instruction that sits above the transcript, a ceiling on how much comes back, a description of the tools the model may call, and a stream of fragments on the way out. Because the ideas are the same, moving between two of them looks like a renaming exercise, and for about eighty per cent of the surface it is. The interesting part is the other twenty.

These pages walk one concept at a time across the shapes each provider uses, and they spend most of their length on the part that does not survive the translation — the field with no counterpart, the value that means something subtly different on the other side, the default that differs, the signal one API gives you and the other does not. If you are writing the adapter by hand, that residue is the entire job; the renames write themselves.

Mapping the Messages Array Between Chat APIs

How a conversation transcript is expressed in each major chat API, and which parts of a message object have no counterpart on the other side.

9 min read

Mapping System Prompt Handling Between APIs

The three shapes a system prompt takes across chat APIs, and what changes about its precedence, its position and its cacheability when you move it.

9 min read

Mapping Stop Sequences Between Provider APIs

Parameter name, array limit and matching behaviour for stop sequences across chat APIs, and why only one of them tells you which sequence fired.

9 min read

Mapping Max Tokens Parameters Between APIs

The parameter name for the output ceiling on each chat API, whether it is required, what happens if you omit it, and why the same number buys less than it used to.

9 min read

Mapping Tool and Function Schemas Between APIs

One tool definition put through the JSON Schema shape each chat API expects, marking exactly which nesting level and which field name changes.

10 min read

Mapping Streaming Events Between Chat APIs

One streamed reply walked through the SSE event types each chat API emits, and the specific ways a parser written for one misreads another.

10 min read

Mapping Usage and Token-Count Objects Between APIs

The four shapes a token-count object takes across chat APIs, what each one leaves out, and why a cost script keyed to one reads undefined on another.

9 min read

Mapping Finish Reason Values Between APIs

What each chat API calls the field that says why generation stopped, which values map onto each other, and which have no counterpart at all.

9 min read

Mapping Error Response Shapes Between Chat APIs

How the nesting and field names of an error body differ across chat APIs, including the errors that arrive mid-stream after a 200 OK.

9 min read

What “OpenAI-Compatible” Actually Means for an Endpoint

Compatibility stated as a checkable surface — paths, auth, required request fields, response envelope and streaming framing — rather than as a claim on a landing page.

10 min read

Where OpenAI-Compatible Endpoints Actually Break

The parameters a self-declared OpenAI-compatible server most often accepts and then ignores, how to tell which ones, and what to do about each.

10 min read

Testing Whether an Endpoint Is Really OpenAI-Compatible

A probe script you point at any base URL that reports which OpenAI features the endpoint implements, which it silently ignores, and which it rejects.

10 min read

Other topics