Errors
Errors follow OpenAI's shape: an error object with message, type and code.
| Status | Code | What to do |
|---|---|---|
| 400 | Fix the request. | |
| 401 | invalid_api_key, key_expired | Check the key. |
| 402 | insufficient_credit | Add credit, or turn on auto-reload. Lowering max_tokens reserves less. |
| 402 | spend_limit_reached | Raise or clear the monthly spend limit on the account, project or key. |
| 403 | admin_key_required, inference_key_required | Use the other kind of key. |
| 403 | policy_blocked | One of your enforcing policies matched. policy_id says which. |
| 403 | platform_policy_violation | The platform rule matched. It can't be turned off. |
| 404 | model_not_found | See GET /v1/models. |
| 413 | request_too_large | Send a smaller request. The limit is 8 MB. |
| 429 | rate_limit_exceeded | Wait for Retry-After seconds. |
| 503 | model_not_deployed | This model isn't running on the platform at the moment. |
| 503 | no_capacity | No GPU was free. You weren't charged. Retry after Retry-After seconds. |
| 503 | gateway_unavailable | The API is starting up or briefly down. Retry after Retry-After seconds. |
| 503 | policy_evaluation_failed | An enforcing check couldn't finish, so the request stopped. Retry. |
| 504 | The request hit the time limit, and is billed up to it. |
If a stream fails partway, its last event before [DONE] is an error object, which the OpenAI SDKs raise as an exception.