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: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-levelsystem 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:
<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
Themodel 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: