Errors
Status codes, error formats and what to do about each.
Status codes
| Status | Meaning | What to do |
|---|---|---|
| 400 | Invalid request | Fix the request body; the message says which field. |
| 401 | Missing, invalid, paused or revoked key | Check the key, or resume it on the API Keys page. |
| 402 | Insufficient balance, or the key's spend limit is reached | Top up, or raise the key's limit. |
| 403 | Model not allowed, or account suspended | Contact support if you don't expect this. |
| 404 | Unknown model or route | Check the model ID against /v1/models. |
| 409 | Idempotency conflict, or a job that can't be cancelled | Use a new Idempotency-Key for a different body. |
| 413 | Request too large | Send a smaller body or file. |
| 502 · 503 · 504 | Upstream failure or timeout | Retry with backoff. |
Error format
Errors match the format of the route you called, so your SDK parses them as usual: the OpenAI shape on /v1/chat/completions, /v1/responses and the media routes, the Anthropic shape on /v1/messages.
{
"error": {
"message": "Insufficient balance. Top up to continue.",
"type": "insufficient_quota",
"code": "insufficient_balance",
"param": null
}
}The messages above are examples; read the actual message and code from each error.
Still stuck? Note the x-request-id from the response and contact support.