# Protocol bridging

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

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

| Protocol | Endpoint | Typical client |
| --- | --- | --- |
| OpenAI Chat Completions | `POST /v1/chat/completions` | OpenAI SDK, most third-party clients |
| OpenAI Responses | `POST /v1/responses` | OpenAI Responses API |
| Anthropic Messages | `POST /v1/messages` | `@anthropic-ai/sdk`, Claude Code |
| Gemini | `POST /v1beta/models/{model}:generateContent` | `google-genai` |
| DashScope | `POST /v1/services/aigc/text-generation/generation` | Alibaba 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

| Case | Behaviour |
| --- | --- |
| Streaming | All four protocols stream over SSE; `/v1/systemone` does not |
| Tool calling | Depends on the target model |
| Vision | Depends on the target model; image shapes differ per protocol and the gateway converts |
| Audio / realtime duplex | Not covered by these docs |

<Callout type="warn" title="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.
</Callout>

## 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.
