Errors
Status codes, error types and what to do.
Errors are JSON:
{"error": {"type": "invalid_request", "message": "The request body failed validation", "details": ["questions.route.criteria: choice needs at least 2 options"]}}| Status | type | What to do |
|---|---|---|
| 401 | invalid_api_key | Check the key; revoked keys stop working within seconds. |
| 402 | insufficient_credits | Add credits or turn on auto top-up under Billing. |
| 402 | budget_exceeded | A monthly budget (the organization's or this key's) is used up. The message says which, and when it resets. |
| 403 | organization_suspended | Contact support. |
| 404 | model_not_found | Use an id from GET /v1/models. |
| 422 | invalid_request | The details list names each problem. A state longer than the model's context comes back here too, as "maximum context length exceeded". |
| 429 | rate_limited | Back off and retry after the Retry-After header. |
| 500 | internal_error | Retry. If it keeps happening, write to support with the x-request-id. |
| 502 | model_error | The model returned an error. Retry with backoff. |
| 502 / 503 / 504 | model_unavailable | The model could not be reached in time. Retry; the first call after a quiet spell can take up to a minute. |
| 529 | overloaded | Retry after the Retry-After header. |
Failed requests are never billed.