Format Conversion
Openference supports three wire formats:- OpenAI (chat/completions, responses, embeddings)
- Anthropic (messages)
- Gemini (via OpenAI compatibility layer on many routes)
Passthrough vs conversion
When the model route is configured with the exact format you send, we pass the body through unchanged (best performance and fidelity). When formats differ, we convert:- OpenAI ↔ Anthropic (full messages, tool calls, system prompts, streaming events)
- Gemini is usually reached via its OpenAI-compatible surface
What is preserved
- Roles and content
- Tool / function calling roundtrips (definitions, calls, and results — in both streaming and non-streaming responses)
- System instructions (all of them, joined, mapped to
systemfor Claude) - Sampling parameters
- Streaming event shapes (converted to the client-expected format, with a stable response id, correct
finish_reason, and a guaranteed terminal event even if the upstream stream ends abruptly)
OpenAI → Anthropic conversion matrix
When you send OpenAI chat-completions requests to a route served by an Anthropic Messages upstream:
Dropped (no Anthropic equivalent):
frequency_penalty, presence_penalty, seed,
logprobs, n, parallel_tool_calls, and inbound assistant reasoning_content
(thinking blocks must carry a provider signature to be replayed, which the OpenAI
shape does not preserve).
Stop reason mapping
Usage semantics
Anthropic’sinput_tokens excludes cached tokens; OpenAI’s prompt_tokens includes
them. Converted responses report prompt_tokens = input_tokens + cache_read_input_tokens + cache_creation_input_tokens,
with prompt_tokens_details.cached_tokens carrying the cache-read subset — the same
arithmetic OpenAI clients expect.
Anthropic → OpenAI conversion
The reverse direction (Anthropic clients on OpenAI-served routes) preserves the same fields, plusthinking blocks round-trip as reasoning_content. Mid-stream Anthropic
errors are surfaced as sanitized terminal error frames so SDKs fail cleanly instead of
hanging.