Reliability
Errors
Errors use the shape of the endpoint you called: OpenAI-style on Chat Completions, Responses and the other routes, Anthropic-style on /v1/messages. Every error carries a stable code; branch on it, not on the message.
On this page
# ShapesJSON Copy
// OpenAI-style
{ "error": { "message": "This key has no credit available. Add credits first.",
"type": "billing_error", "param": null, "code": "insufficient_credits" } }
// Anthropic-style (/v1/messages, /v1/messages/count_tokens)
{ "type": "error",
"error": { "type": "invalid_request_error", "message": "This key has no credit available. Add credits first.",
"code": "insufficient_credits" } }Errors from the gateway carry x-gateway-request-id; quote it when you contact support. Retry-After is set wherever retrying later can succeed. An error from the provider itself is passed through in its own shape; a provider's 401, 402 or non-policy 403 becomes a 502/503 from the gateway, since it is never your billing problem.
# Types by statusStatus OpenAI type Anthropic type 400 invalid_request_errorinvalid_request_error401 auth_errorauthentication_error402 billing_errorinvalid_request_error403 permission_errorpermission_error404 not_found_errornot_found_error409 invalid_request_errorapi_error413 invalid_request_errorrequest_too_large429 rate_limit_errorrate_limit_error451 unavailable_for_legal_reasonsapi_error503 provider_erroroverloaded_errorother provider_errorapi_error
# Request errors (400, 404, 408, 413)Code Meaning invalid_json, invalid_bodyThe body is not a JSON object. unsupported_parameterA field the gateway does not forward (it names it in param), an unsupported tool or tool_choice, content stored upstream, or an anthropic-beta. web_search_not_supportedWeb search is billed per search upstream and is not available. missing_max_tokens, invalid_max_tokens, max_tokens_too_largeMessages needs max_tokens; caps must be positive integers within the model's limit. invalid_nn must be 1 to 8, on chat only.unsupported_endpointThe model is not served on this endpoint; see its endpoints. model_not_foundUnknown model id (404). List models with GET /v1/models. request_timeoutThe body did not arrive in time (408). request_too_largeThe body is over the limit (413); see limits .
# Authentication (401, 403)Code Meaning missing_api_keyNo key was sent. invalid_api_keyUnknown or revoked key. key_expiredThe key's expiry has passed. key_disabledThe key or its account was deleted or disabled. session_not_allowed, session_required, invalid_session, session_expiredConsole session problems; see passkeys . key_suspended403: an automatic safety suspension. See Safety . forbidden403: this credential may not do that (a child managing children, a session deleting its account). reauth_required403: log in with a passkey again before changing passkeys.
# Billing (402)Code Meaning payment_requiredNo key: pay with x402 or send a key. insufficient_creditsThe key's available balance is below this request's hold. Add credit or lower the output cap. insufficient_fundsA transfer between root and child is larger than what is available. paid_daily_cap_exceededThe account received $2,000 of paid credit in 24 hours. settlement_pending, duplicate_settlement, invalid_exact_svm_…x402 payment problems; see x402 error codes .
# Limits and capacity (429, 503)Code Meaning too_many_requestsToo many requests in flight for the key, the account, or (without credit) the client address. rate_limitedAn hourly limit was reached; see the message and Retry-After. too_many_open_checkoutsFive unpaid checkouts are open on this key. service_busyThe gateway is at capacity. Retry shortly. service_pausedThe gateway is temporarily not taking requests. upstream_unavailableNo provider can take the request right now.
# Upstream and otherCode Meaning upstream_unreachable502: the provider could not be reached. Nothing is charged. upstream_failed502: the provider failed while answering, or sent more than the request allows. upstream_timeout504: the provider did not finish in time. request_cancelled499: the client went away. location_blocked451: the service is not offered where the request comes from. internal_error500: a gateway fault. Quote the request id.
Last updated 2026-11-07