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 the response request_id and traceId.
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.
Some errors also return param to identify the related request field. Retryable errors, such as rate limits, can also return retry_after_sec to indicate how long to wait before retrying.
Error responses include a request_id for troubleshooting. It may appear in error.message, error.request_id, and the request-id or x-request-id response headers. When contacting support, provide the request_id and retain the traceId, request time, model ID, and API path.
Error reference
Readmessage 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— useretry_after_secorRetry-Afterwhen available - Retry with backoff:
service_unavailableand in-stream streaming errors; contact support withrequest_idandtraceIdif the issue persists - Usually do not retry:
client_aborted; if the request reached a model, billing may still apply - If
codeis missing: rely onerror.typeand the HTTP status - Still stuck? Contact support with
request_idandtraceId
Streaming requests
When a streaming request fails (e.g.stream: true), how the error is returned depends on when the failure happens:
- Before any stream data is sent — You get the same JSON
errorobject and a non-2xx HTTP status as in the table above. - 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
request_idandtraceId.

