Skip to main content
Relay reads a small set of X-WR-* request headers to control routing and recording, plus the standard auth and request-id headers. It never forwards an X-WR-* header to the upstream. Any other header is passed through.

Request headers

How Relay finds your relay key

In normal mode Relay looks for the relay key or inference token in this order:
  1. X-WR-API-Key
  2. Authorization: Bearer <credential>
  3. x-api-key
If you point an existing OpenAI or Anthropic SDK at Relay, set its API key to your relay key: it lands in Authorization or x-api-key and Relay reads it from there. In proxy mode Authorization belongs to the upstream, so the relay key goes in X-WR-API-Key. Without it the request is anonymous proxy traffic.

Response headers

On a successful response Relay forwards the upstream’s headers, minus hop-by-hop headers. On a cross-shape translated response it drops Content-Length and Content-Encoding, since the translated body differs from the upstream’s. When Relay returns an upstream failure in place of a response, it forwards only Retry-After, X-Should-Retry, X-Request-Id, Content-Type and the upstream’s rate-limit headers (Anthropic-Ratelimit-*, X-Ratelimit-*).

What Relay strips before calling upstream

Relay never sends its own auth or control headers to the provider. Before forwarding a request upstream it removes:
  • Authorization and x-api-key (replaced with the host key in normal mode, or re-attached as your own upstream key in proxy mode)
  • Cookie
  • every X-WR-* header
  • hop-by-hop headers, and any header named in Connection
This is why your relay key is safe to send as a bearer token: it authenticates you to Relay and is then removed, so it never reaches the provider.

Client IP and trusted proxies

Anonymous proxy rate limits are counted per client IP. If Relay sits behind a load balancer, set RELAY_TRUSTED_PROXIES to a comma-separated list of CIDRs; Relay then trusts X-Forwarded-For from those peers and uses the rightmost untrusted address. Unset, it uses the address of the direct connection.