Errors

Errors use the OpenAI envelope so existing SDKs surface them correctly.

View as Markdown
{
  "error": {
    "message": "Insufficient credits. Your balance is empty; add credits to continue.",
    "type": "insufficient_credits_error",
    "code": "insufficient_credits",
    "param": null,
    "metadata": { "request_id": "req_..." }
  }
}

Status codes and types

400 invalid_request_errorclient
Malformed body, unsupported parameter, context length exceeded (code context_length_exceeded) or an upstream validation error passed through.
401 authentication_errorclient
Missing, invalid, disabled or expired API key.
402 insufficient_credits_errorclient
Organization balance is empty, or the key reached its spend limit (code key_limit_exceeded).
403 permission_errorclient
Model not allowed for this key, or the account is suspended.
404 not_found_errorclient
Unknown model (code model_not_found), unknown generation id, or your own provider preferences left no endpoint: no_endpoints_within_max_price, no_endpoints_supporting_parameters, no_endpoints_matching_provider_preferences. Each message says which preference to relax.
429 rate_limit_errorclient
Per-key rate limit exceeded. Honour the retry-after header.
502 provider_errorupstream
All eligible endpoints failed with an upstream error. metadata.provider_name names the model vendor of the last endpoint tried.
503 model_unavailable_error / overloaded_errorupstream
No endpoint can serve the model right now, or providers are rate limited or overloaded. Retry with backoff.
504 timeout_errorupstream
The upstream provider did not respond within the request timeout.
500 server_errorserver
Unexpected error. Include the request_id when contacting support.

Request ids

Every response carries x-request-id; completions also carry x-er-generation-id. Both appear in the dashboard and let support trace a request end to end.