Errors and status codes reference
Reference for the status codes and body shapes the gateway returns, split by request path, with exact message text for 401, 403, 404, 429 and 5xx replies.
Last updated
The gateway returns errors in three body shapes. The failed check and the request path set the shape.
Body shapes#
| Shape | Looks like | Where it appears |
|---|---|---|
| FastAPI | {"detail": "..."} | The key check and the console APIs |
| Anthropic | {"type": "error", "error": {"type": "...", "message": "..."}} | Spend limit, POST /v1/messages and some replies on the OpenAI paths |
| OpenAI-style | {"error": {"message": "..."}} | POST /v1/chat/completions and POST /v1/responses |
Key check errors#
The key check runs before any routing and uses the FastAPI shape.
| Status | Trigger | Body |
|---|---|---|
| 401 | No key in the accepted headers | {"detail": "API key required"} |
| 401 | The key does not exist, was revoked, is disabled or has expired | {"detail": "Invalid API key"} |
| 401 | The owner of the key is disabled | {"detail": "Account is disabled"} |
A revoked key, an expired key and an unknown key share one message. When the value looks like a proxy token, the Invalid API key message adds this hint: This value looks like a proxy token. Put the proxy token in the URL path, not in the key. See authentication headers.
Spend limit#
The key sets a daily limit or a token limit. The key, its team or the instance can set the monthly spend limit. When the key reaches a limit, the gateway serves the own accounts and private provider keys of the owner. A request that none can serve returns 429 in the Anthropic shape. Model lists and token counting do not return it.
| Limit reached | message starts with | retry_after and resets_at | Retry-After header |
|---|---|---|---|
| Daily spend limit | Daily spend limit reached | Yes | Yes |
| Monthly spend limit | Monthly spend limit reached | Yes | Yes |
| Monthly token limit | Monthly token limit reached | Yes | Yes |
retry_after counts seconds until the reset. A daily limit resets at the next UTC midnight. A monthly limit resets at the start of the next UTC month.
See spend limits.
Personal address#
On a personal address, the proxy token sits in the URL path.
- An unknown or disabled token returns 404 with
{"detail": "Proxy token not found"}. - Many requests with an unknown token from one IP address return 429 with
{"detail": "Too many invalid proxy token requests"}and aRetry-Afterheader. A valid token is not blocked. A token created or rotated less than 10 seconds ago can still get 429. - The monthly USD limit can return 429. Read spend limits.
Per-key limits do not apply on this path.
POST /v1/messages#
This path returns the Anthropic shape. Each reply carries error.type and error.message.
| Status | error.type | Trigger | error.message |
|---|---|---|---|
| 401 | authentication_error | No account or provider key is available, and the instance has none | Authentication failed. |
| 403 | permission_error | The key has no usable account or provider key, but the instance has some | Provider not enabled for your account. Enabled: ['claude'] |
| 400 | invalid_request_error | The provider rejects the request, for example a prompt that is too long | The provider message, with a hint in some cases |
| 404 | not_found_error | The provider reports that the model does not exist | The provider text, or Not found |
| 429 | rate_limit_error | Every candidate account is rate limited or in cooldown | Starts with This request would exceed your organization's rate limit. |
| 529 | overloaded_error | The provider reports overload, the gateway waits too long for an account, or a gateway concurrency or capacity limit applies | Overloaded |
| 529 | overloaded_error | An Antigravity model is at capacity | Model <model> is at capacity upstream. Retry shortly. |
| 529 | overloaded_error | The client app is bound to credentials that are all unusable, and no other credentials are allowed | Overloaded |
| 500 | api_error | No other case in this table applies | Internal server error |
The 403 list shows the providers that your key allows. An instance setting can replace the 529 message Overloaded. Other 429 messages can appear on this path.
The full 429 message then points to the provider rate-limit documentation.
Retry-After on this path#
A 429 or 529 caused by exhausted Claude or Antigravity accounts carries a Retry-After header in seconds.
A non-streaming request that waits about 110 seconds for a Claude account gets a 529 with a Retry-After header. The same wait for an Antigravity model gets a 529 without it, as does the 529 for a bound client app.
If the last provider reply was another 4xx or 5xx status, the gateway returns that status with a generic Anthropic body and no Retry-After header.
Streaming requests#
A streaming request can already have status 200 when the gateway needs more than about 10 seconds to find an account. The error then arrives as an error event in the stream. The reply has no Retry-After header.
POST /v1/chat/completions#
This path returns the OpenAI-style shape in most cases.
| Status | Trigger | Body |
|---|---|---|
| 403 | No ChatGPT account or provider key is available to your key. This includes an instance with none. | {"error": {"message": "Provider not enabled for your account. Enabled: ['openai']", "type": "permission_error"}} |
| 401 | See the two forms below | Authentication failed. in the OpenAI-style or the Anthropic shape |
| 429 | All provider keys that can serve the request are rate limited | {"error": {"message": "Rate limit reached. Please try again later.", "type": "rate_limit_error"}} |
| 503 | No other case in this table applies | {"error": {"message": "The server had an error while processing your request. Please try again later.", "type": "service_unavailable"}} |
| 500 or the provider status | A free-model route fails | {"error": {"message": "<message>", "type": "api_error"}} |
The 403 message can end with a hint about custom providers or the model. The 429 and 503 replies carry no Retry-After header on this path. The private key and spend limit 429 replies are the exceptions.
The 401 reply has two forms. The instance setting for the credential order picks the path.
- When provider keys come first, no provider key or account served the request. The body is
{"error": {"message": "Authentication failed.", "type": "authentication_error"}}. - On the other path, no account and no provider key is available, which is rare. The body is the Anthropic shape.
POST /v1/responses and the compact route#
These paths return the OpenAI-style shape without a type field. The 401 reply is the exception. It uses the Anthropic shape.
| Status | Trigger | Body |
|---|---|---|
| 401 | Rare. No account or provider key is available, and the request has no key owner or the owner's private key gives no reply | {"type": "error", "error": {"type": "authentication_error", "message": "Authentication failed."}} |
| 403 | No account or provider key is available to your key. This includes an instance with none. | {"error": {"message": "Provider not enabled for your account. Enabled: [...]"}} |
| 429 | All provider keys that can serve the request are rate limited | {"error": {"message": "Rate limit reached. Please try again later.", "retry_after": 60}} |
| 503 | No other case in this table applies | {"error": {"message": "The server had an error while processing your request. Please try again later."}} |
| 529 | Local capacity or an Antigravity model capacity limit | The same message as the 503 reply, with a Retry-After header |
| 400 | The provider rejects the request as a caller error | {"error": {"message": "<the provider message>"}} |
| 502 | The provider returns an invalid reply to a compact request | {"error": {"message": "Invalid compact response from upstream."}} |
On this path the 429 reply puts the wait in retry_after in the body and sends no Retry-After header. The private key and spend limit 429 replies are the exceptions.
A provider error can pass through with the provider's own status and body.
Private provider keys#
A request that uses a private provider key does not move to another account. When the key cannot serve the request, the reply names the key. The three POST paths above can return these replies.
| Status | Trigger | Message |
|---|---|---|
| 409 | The key is disabled | Your private <provider> key is disabled. |
| 502 | The gateway cannot reach the provider, or the provider answers 401 or 403 | Could not reach the <provider> provider with your private key. or Your private <provider> key was rejected by the provider. |
| 429 | The provider rate limits the key | The provider text, or Your private <provider> key is rate limited. |
| Provider status | Another provider error | The provider text with secrets removed, or a generic message |
A 429 reply carries a Retry-After header when the wait is known. POST /v1/messages and POST /v1/chat/completions set the error type to invalid_request_error, rate_limit_error or api_error. POST /v1/responses sends none.
Unhandled errors#
An unhandled error returns 500 with {"error": {"message": "Internal server error"}}. The reply carries an x-request-id header when the request has an id.
Console actions#
A read-only auditor that sends a write request to a console management route gets 403 with {"detail": "Auditor role is read-only"}.
See roles and access.