Skip to content

Authentication

Every relay request carries one API key. Keys belong to an organisation; usage and spend are booked to that organisation. Create and revoke keys on the API keys page.

A key is sk- followed by 48 characters from a-z A-Z 0-9. The gateway stores only a hash, so a lost key cannot be shown again; create a new one.

The gateway accepts the convention of the dialect you call, so the official SDKs work unchanged.

Endpoint Accepted places
/v1/chat/completions, /v1/responses, /v1/embeddings, /v1/images/*, /v1/audio/* Authorization: Bearer <key>
/v1/messages (Anthropic) x-api-key: <key>, or Authorization: Bearer <key>
/v1beta/models/... (Gemini) x-goog-api-key: <key>, ?key=<key>, or Authorization: Bearer <key>
/v1/models, /v1/models/{model}, /v1/generation, /v1beta/models any of: Authorization: Bearer, x-api-key, x-goog-api-key, ?key=

Do not put keys in query strings of production traffic: URLs end up in proxy and server logs. The ?key= form exists for Gemini clients that use it.

The key is checked from the headers alone, before the request body is read.

Terminal window
# A request without a valid key is refused with 401 before anything else happens.
curl -i https://api.test.whocare.xyz/v1/models \
-H "Authorization: Bearer sk-not-a-real-key"
# expect: invalid_api_key
HTTP code Meaning
401 missing_api_key No key in any accepted place.
401 invalid_api_key Unknown key, or the key is disabled, revoked or expired.
403 org_frozen The organisation is frozen. Contact support; retrying does not help.
403 ip_not_allowed The key has an IP allowlist and the request came from outside it.
403 model_not_allowed The key has a model allowlist and the model is not on it.
503 auth_unavailable The gateway could not check the key right now. Retry with backoff.

The body of each error is in the dialect of the endpoint you called; see Errors and retries.

Each setting is on the key’s edit dialog in the console.

  • Model allowlist (setting). Slugs, with a trailing * as prefix wildcard (gpt-4*). A model outside the list answers 403 model_not_allowed, and /v1/models leaves it out.
  • IP allowlist (setting). CIDR ranges. The client address is the connection’s peer address; X-Forwarded-For is believed only from proxies the operator listed in TRUSTED_PROXIES.
  • Spend limit (setting). A USD amount per lifetime, calendar month (UTC) or calendar day (UTC). When the next request could pass the limit it is refused with 402 key_spend_limit_exceeded.
  • Rate limits (setting). Requests, tokens per minute and concurrency; see Rate limits.
  • Expiry. After the expiry time the key answers 401 invalid_api_key.

Disabling a key is reversible; revoking is not.

  • One key per application and environment, so that a leak is a one-key revocation and the request log shows who spent what.
  • Keep keys out of browsers and mobile apps. Call the gateway from your server.
  • Set a spend limit on every key that is not production-critical.