tokrouterdocs
Guides

Protocol bridging

Four inbound protocols on one base URL, and where field mapping stops being faithful.

.mdOpen in Claude

The gateway accepts four inbound protocols and picks the upstream vendor from the model field. The inbound protocol and the target vendor are independent — which is why "Anthropic SDK to call Claude", "Anthropic SDK to call GPT" and "OpenAI SDK to call Gemini" all work.

Endpoints

ProtocolEndpointTypical client
OpenAI Chat CompletionsPOST /v1/chat/completionsOpenAI SDK, most third-party clients
OpenAI ResponsesPOST /v1/responsesOpenAI Responses API
Anthropic MessagesPOST /v1/messages@anthropic-ai/sdk, Claude Code
GeminiPOST /v1beta/models/{model}:generateContentgoogle-genai
DashScopePOST /v1/services/aigc/text-generation/generationAlibaba DashScope SDK (drop the /api prefix)

Three rules

  1. Messages are parsed per inbound protocol. Anthropic's top-level system, Gemini's contents[].parts and OpenAI's messages[] are each interpreted; you never rewrite the body.
  2. Capabilities follow the target model. If the target has no tool support, sending tools returns an error instead of dropping the definitions silently.
  3. Responses are returned in the inbound protocol. Calling a GPT model over Anthropic returns an Anthropic Messages response; clients do not branch on vendor.

Known boundaries

CaseBehaviour
StreamingAll four protocols stream over SSE; /v1/systemone does not
Tool callingDepends on the target model
VisionDepends on the target model; image shapes differ per protocol and the gateway converts
Audio / realtime duplexNot covered by these docs

Do not rely on undocumented passthrough

Across protocols, vendor-exclusive fields (OpenAI's logprobs, Anthropic's cache_control) are not guaranteed to survive the mapping. Use the vendor's native endpoint when you need them.

System One is not part of bridging

/v1/systemone is a same-protocol passthrough for the Jev decision model: the body is {state, questions} and the response is a typed decision with probabilities (choice / score / noul). It has no messages, no streaming, and does not participate in protocol bridging.