Error Codes
Error formats and codes returned by the API.
Error Format
Errors follow the format of the API you're using. OpenAI endpoints return OpenAI-format errors, and Anthropic endpoints return Anthropic-format errors.
OpenAI Format
OpenAI Error
{
"error": {
"message": "Invalid API key provided.",
"type": "authentication_error",
"code": "authentication_error"
}
}Anthropic Format
Anthropic Error
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "Invalid API key provided. Please check your x-api-key header."
}
}OpenAI Error Codes
| Status | Type | Description |
|---|---|---|
| 400 | invalid_request_error | The request was malformed or contained invalid parameters. |
| 401 | authentication_error | Invalid or missing API key. |
| 403 | authentication_error | Account suspended, expired, or model access denied. |
| 404 | not_found | The requested endpoint or model does not exist. |
| 429 | rate_limit_error | Rate limit exceeded. Check your plan limits and slow down. |
| 500 | service_error | An internal error occurred. Try again later. |
| 503 | service_error | The service is temporarily unavailable. |
Anthropic Error Codes
| Status | Type | Description |
|---|---|---|
| 400 | invalid_request_error | The request was malformed or contained invalid parameters. |
| 401 | authentication_error | Invalid or missing API key. |
| 403 | permission_error | Account suspended, expired, or model access denied. |
| 404 | not_found_error | The requested endpoint or model does not exist. |
| 429 | rate_limit_error | Rate limit exceeded. Slow down and retry. |
| 500 | api_error | An internal error occurred. Try again later. |
| 529 | overloaded_error | The API is temporarily overloaded. Try again later. |
Tip
When you receive a
429 error, check the Retry-After header for the recommended wait time. Rate limits reset on a sliding window basis.