Skip to main content
When a request fails, check the HTTP status code and the error object in the response body. Use error.type together with error.code (when present) and the status code to decide what to do next. If you need help, contact support and include traceId from the response.

Error response format

Most failed non-streaming requests return JSON like this:
On 429 responses you may also see Retry-After and X-RateLimit-* headers.

Error reference

Read message for specifics — limits, model names, parameters, or which API to use.

Quick guide

  • Fix first, then retry: authentication_error, billing_denied, model_not_found, invalid_request, unsupported_protocol
  • Wait, then retry: rate_limit_error — use retry_after_sec or Retry-After when available
  • Retry with backoff: service_unavailable and in-stream streaming errors; contact support with traceId if it keeps failing
  • Usually ignore: client_aborted
  • If code is missing: rely on error.type and the HTTP status
  • Still stuck? Contact support with traceId

Streaming requests

When a streaming request fails (e.g. stream: true), how the error is returned depends on when the failure happens:
  1. Before any stream data is sent — You get the same JSON error object and a non-2xx HTTP status as in the table above.
  2. After the stream has started — HTTP may already be 200. The failure is reported as an error event inside the stream (format depends on the API). The text is usually generic, for example upstream stream error, please retry later. Retry with backoff; if it keeps happening, contact support with traceId.