Docs · Production
Error codes
Errors use standard HTTP status codes. OpenAI-format endpoints return OpenAI-style error bodies; the Anthropic-format endpoint returns Anthropic-style ones.
{
"error": {
"message": "Invalid API key",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}{
"type": "error",
"error": { "type": "authentication_error", "message": "invalid x-api-key" }
}| Status | Meaning | What to do |
|---|---|---|
400 | Invalid parameters, malformed JSON, a parameter the model does not support, or input beyond the context length | Fix the request; do not retry |
401 | Missing, wrong or deleted API key | Check the auth header |
403 | Insufficient balance, or the key is disabled / not allowed to use this model | Check balance and key settings in the console |
404 | Wrong path or unknown model | Check the base URL (the OpenAI SDK needs /v1) and the model ID |
413 | Request body too large | Shrink images or trim context |
429 | Too many requests, or the upstream is rate-limiting | Back off and retry; lower concurrency |
500 | Internal error | Safe to retry |
502 / 503 | Upstream temporarily unavailable | Retry after a short delay |
504 | Upstream timed out | Use streaming or retry later |
Requests that fail with an error are not billed. For retry strategy see Best practices.