/router surface lets you keep writing requests in one provider’s dialect while the gateway egresses to a different provider. You send an Anthropic Messages-shaped request to /router/anthropic, select OpenAI as the egress target, and the gateway translates the request into OpenAI’s format on the way out and translates the response back into Anthropic’s format on the way in. Your code speaks Anthropic conventions end to end; the served model is OpenAI’s.
This is useful when your application is already built against the Anthropic Messages API — SDKs, prompt templates, response parsing — and you want to serve an OpenAI model without rewriting the integration to OpenAI’s request/response shape.
Today the only covered cross-dialect pair is Anthropic → OpenAI: an Anthropic-shaped request routed to OpenAI. Other combinations are not substituted — the router fails closed rather than guessing at a translation it does not support.
How it differs from the provider doors
The provider doors (/anthropic, /openai, /gemini) are passthrough: you speak each provider’s native dialect at its own path, and the gateway forwards to that same provider. The /router surface adds dialect translation — you speak Anthropic, the gateway speaks OpenAI upstream — and it carries its own egress-key contract: you supply the OpenAI key for the upstream leg on the request.
Endpoint
Headers
Request body
Send a standard Anthropic Messages body. Use Anthropic conventions throughout —model, max_tokens, messages, system, and so on. The gateway maps them to OpenAI’s equivalents automatically (for example, max_tokens becomes OpenAI’s max_completion_tokens).
The model field must name a supported OpenAI model (see Supported models):
Supported models
Themodel in a cross-dialect request must be one of the supported OpenAI model IDs:
gpt-5gpt-5-codexo3o3-minigpt-5.6-solgpt-5.6-terragpt-5.6-luna
Example
Response
The gateway returns a standard Anthropic Messages response, regardless of the fact that an OpenAI model served it. You parse the samecontent blocks, stop_reason, and usage fields you already parse for the /anthropic door. The model field echoes the OpenAI model that served the request.
Streaming
Add"stream": true to the body and the gateway streams the response back as Anthropic Server-Sent Events — not raw OpenAI chunks. You receive the same event sequence the /anthropic door emits:
message_startcontent_block_startcontent_block_deltacontent_block_stopmessage_deltamessage_stop
Errors
Errors surface in the Anthropic error envelope — the same shape the/anthropic door returns — so your existing error handling applies:
Related
- Gateway Quickstart — the passthrough provider doors (
/anthropic,/openai,/gemini) - Provider Support — per-provider feature coverage across Anthropic, OpenAI, and Gemini
- Headers reference — the full set of gateway response headers