DocsGetting startedAuthentication

Authentication

The three auth headers, key format and lifecycle, and auth-related errors.

Every data-plane request (/v1/* and /v1beta/*) must carry an API key. To stay compatible with all three SDK families, the gateway checks three auth headers in order — any one of them works:

HeaderFormatTypical clients
AuthorizationAuthorization: Bearer sk-sole-… (a bare key without the Bearer prefix is also accepted)OpenAI SDK · Codex
x-api-keyx-api-key: sk-sole-…Anthropic SDK · Claude Code
x-goog-api-keyx-goog-api-key: sk-sole-…Google GenAI SDK

Passing the key via URL query parameters (such as Google's ?key=) is not supported: query strings end up in access logs and browser history, which makes leaks likely. Always use a header.

Key format & lifecycle

Keys start with sk-sole-. The full key is shown only once at creation and the server stores only a hash — a lost key cannot be recovered, only replaced. Each key can be configured independently with:

  • Enable/disable: switch a key off at any time without losing its usage history.
  • Expiry date: useful for temporary integrations or handing keys to third parties.
  • Spending limit: a USD cap, optionally resetting daily/weekly/monthly; once exhausted the key is rejected (HTTP 402).
  • IP allowlist: restrict which source IPs may use the key; requests from other IPs are rejected (HTTP 403).
SituationHTTPMessage id
No key provided401key_missing
Key unknown or deleted401key_invalid
Key disabled403key_disabled
Key expired403key_expired
Source IP not in allowlist403key_ip_denied
Key spending limit reached402key_quota_exhausted
Account suspended403account_disabled

Error bodies take the shape of whichever SDK format matches the request path, and messages are localized to the account's preferred language (or Accept-Language before authentication succeeds, defaulting to English). See Errors.

Security best practices

  • Keep keys in environment variables or a secret manager — never in source code or config repos.
  • Do not expose keys in client-side code such as browsers; if the frontend must call directly, use a dedicated key with a small quota and an IP allowlist.
  • Split keys by workload so usage stays isolated and incidents are contained — disable only the affected key.
  • Rotate keys periodically, and give temporary keys an expiry date and spending limit.