Docs · Operate & reference

Handle failed requests

Branch on the HTTP status first. For direct API calls, read the structured error body for a human-readable message and optional machine-readable code.

Start with the status

StatusMeaningWhen
400Bad requestMalformed JSON, missing messages, or an unknown model id.
401UnauthorizedMissing, malformed, or revoked API key. Rotate or re-check the key.
429Rate limitedPer-org RPM exceeded, or the org budget cap is reached. Honor Retry-After.
502Bad gatewayThe upstream node returned an error or was unreachable during routing.
503Service unavailableThe gateway is not currently configured or reachable.

Inspect the response body

Direct calls return an OpenAI-compatible error object. Displayerror.message to an operator; branch primarily on the HTTP status.

{
  "error": {
    "message": "human-readable description",
    "type": "invalid_request_error",
    "code": null
  }
}
Requests made through the in-app console proxy are flattened to a { "error": "message" } string for display. Direct calls to the branded API return the full object shown above.

Retry transient failures

Do not retry 400 or 401 without correcting the request or credentials. For 429, respect Retry-After and back off. Treat 502 and 503 as transient and use bounded backoff rather than an immediate retry loop.