DocsAPI referenceErrors

Errors

The three error envelopes, category-to-HTTP mapping, and common errors.

The gateway presents three API shapes, and error bodies match the shape of the API you called — decided by path: /v1/messages* uses the Anthropic shape, /v1beta/* the Google shape, everything else the OpenAI shape. This keeps every SDK's error parsing working as expected.

The three error envelopes

OpenAI
{
  "error": {
    "message": "Invalid API key",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
Anthropic
{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key"
  }
}
Google
{
  "error": {
    "code": 401,
    "message": "Invalid API key",
    "status": "UNAUTHENTICATED"
  }
}

Categories & status codes

CategoryHTTPOpenAI typeAnthropic typeGoogle status
Authentication401invalid_request_errorauthentication_errorUNAUTHENTICATED
Permission403invalid_request_errorpermission_errorPERMISSION_DENIED
Not found404invalid_request_errornot_found_errorNOT_FOUND
Unsupported endpoint404invalid_request_errornot_found_errorINVALID_ARGUMENT
Invalid request400invalid_request_errorinvalid_request_errorINVALID_ARGUMENT
Rate limit429rate_limit_errorrate_limit_errorRESOURCE_EXHAUSTED
Quota / balance402insufficient_quotabilling_errorRESOURCE_EXHAUSTED
Payload too large413invalid_request_errorinvalid_request_errorINVALID_ARGUMENT
Upstream failure502api_errorapi_errorUNAVAILABLE
Overloaded503server_erroroverloaded_errorUNAVAILABLE
Internal error500api_errorapi_errorINTERNAL

Common errors

Message idHTTPMeaning & what to do
key_missing / key_invalid401Missing or invalid API key — check your auth header.
key_disabled / key_expired / key_ip_denied403The key is disabled, expired, or your IP is not allowlisted.
key_quota_exhausted402The key's spending limit is exhausted — wait for the reset or raise the limit.
balance_exhausted402Insufficient account balance — top up and retry.
rpm_exceeded / concurrent_exceeded429RPM or concurrency limit exceeded — back off and retry.
model_missing400The request is missing the model field.
model_not_found / model_disabled404The model does not exist or has been retired — check the id against Models.
no_upstream_for_model404No upstream currently serves this model — retry later or contact the administrator.
moderation_blocked403Blocked by content moderation — revise the request and try again.
body_too_large413The body exceeds this endpoint's size limit — compress inlined media or use another endpoint.
upstream_timeout / upstream_unreachable / all_upstreams_down502Upstream timed out, is unreachable, or all upstreams are tripped — back off and retry.
server_busy503The gateway's in-flight capacity is full — retry shortly.
balance_insufficient402Balance minus the estimated cost of in-flight requests cannot cover this request (see Account balance) — top up or wait for in-flight requests to finish.
entry_unsupported404The path/method is not an endpoint the gateway supports.
model_rejects_format / no_endpoint_for_format404The model does not accept this endpoint's protocol, or no upstream can serve that protocol — use the model's native endpoint (Responses for GPT, Messages for Claude, and so on).
model_not_schedulable / no_group_available404 / 403The model is outside what you can schedule, or no scheduling group is visible to you — contact the administrator.
client_not_allowed403This client is not allowed to use any group; ask the administrator to register a custom or unregistered client.
account_disabled / account_deleted403The account owning the key is disabled or closed.
privacy_filter_failed500Privacy filtering failed and the request was rejected — ask the administrator to review the filter rules.
video_job_missing / video_job_not_found / video_job_route_gone400 / 404 / 502Video polling without a job id, an unknown job, or a job whose upstream has been removed (see Images & video).

Error messages are localized to the account's preferred language (before auth, Accept-Language; default English). Branch on the HTTP status and the type/status field, never on the message text.

For concrete retry and backoff patterns, see Error handling & retries.