Skip to main content
The inference plane is the customer-facing data plane. It listens on RELAY_PORT (default 8080) and speaks OpenAI- and Anthropic-shape wire protocols, plus Relay’s own provider-neutral canonical shape.

Authentication

Every inference request authenticates with a relay key as a bearer token:
Relay keys are minted in the admin UI or via the control plane (POST /api/relay-keys). The plaintext is shown exactly once on creation — Relay stores only sha256(plaintext).

Namespacing

Each vendor wire shape is served under its own path prefix. The bare /v1 namespace belongs to Relay’s canonical shape.

Endpoints

Examples

Responses stream byte-for-byte from the upstream when the inbound shape matches the upstream shape. Cross-shape requests (e.g. OpenAI in, Anthropic upstream) are translated per chunk through Relay’s canonical protocol.

System messages

Start-of-conversation system instructions map to the upstream’s native form: the top-level system field (Anthropic), systemInstruction (Gemini), or a leading system message (OpenAI-compatible). System messages that appear mid-conversation keep their position — they are never merged into the start-of-conversation system prompt, so the upstream’s prompt-cache prefix is not invalidated by a late instruction. Relay’s canonical semantics follow the OpenAI shape here: on OpenAI-compatible upstreams the message is sent as a real system turn in place. Anthropic and Gemini upstreams cannot express that on every model, so there the message is delivered in place as a user turn wholly wrapped in <system> markers:
The marker round-trips: a user turn that is exactly this form is restored to a system message when Relay parses the conversation back. A <system> tag embedded inside longer user text is never promoted. Inbound Anthropic requests may also carry role: "system" messages (supported by recent Claude models); Relay accepts them and keeps them positional. A canonical system message can instead opt into full system authority with "hoist": true: at serialization it merges into the upstream’s start-of-conversation system form on every shape. Hoisting changes the very beginning of the prompt, so it invalidates the upstream’s cached prefix for that conversation — use it for instructions that must override user content, not for routine mid-session notes.

Models

The model field is resolved against your catalog. A model is reachable only if a policy grants it to your relay key and the model has an enabled host binding with a healthy host key. List what your key can reach:

Errors

Relay does not fail over mid-stream. Failover across keys and hosts happens before the first byte reaches you. Once bytes flow, an upstream error is returned as-is.