Errors
Understand failed requests and recover deliberately.
Error format
{
"error": {
"message": "Invalid API key.",
"type": "authentication_error",
"code": "invalid_api_key"
}
}Common status codes
| Status | Meaning | Next step |
|---|---|---|
| 400 | Invalid request or policy rejection | Read the message and fix the request. |
| 401 | Missing or invalid key | Check the key and expiry. |
| 403 | Insufficient access | Check key scopes and account access. |
| 404 | Model not found | Discover models with GET /v1/models. |
| 429 | Request or concurrency limit | Honor Retry-After when returned. |
| 502 / 503 | Provider unavailable or overloaded | Retry with backoff when appropriate. |
| 504 | Provider timeout | Check status before retrying. |
Request IDs
Keep the x-request-id response header with your own diagnostics. Do not include credentials or private prompt content in support reports.
Availability depends on your connected provider. Check service status and keep x-request-id with your diagnostics.