Error format
Errors use the OpenAI shape:
{
"error": {
"message": "Your organisation is out of credits.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_credits"
}
}
Status codes
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request |
The request body is invalid. |
| 401 | missing_api_key, invalid_api_key |
No key, or the key is wrong, revoked or expired. |
| 402 | insufficient_credits |
Out of credits, or the monthly spend cap is reached. |
| 403 | permission_denied |
The key lacks the inference scope, or the organisation is suspended. |
| 404 | model_not_found, not_found |
Unknown model or path. |
| 405 | method_not_allowed |
Wrong HTTP method. The Allow header lists the right one. |
| 429 | rate_limit_exceeded |
Too many requests or tokens this minute. |
| 500 | internal_error |
Something went wrong on our side. |
| 502 | upstream_error |
The model backend returned an error. |
| 503 | model_unavailable |
The model is temporarily unavailable. |
Rate limits
Each API key has a limit on requests per minute (RPM) and tokens per minute (TPM), measured over a sliding 60-second window. Unless you set your own limits on a key, the defaults are 600 RPM and 2,000,000 TPM. Set per-key limits in API keys.
When you exceed a limit the API returns 429 with a Retry-After header giving the seconds to wait. Requests that are refused are not billed.
Retrying
- Retry
429after theRetry-Afterdelay. - Retry
500,502and503with exponential backoff, for example 1, 2, 4 and 8 seconds. - Do not retry
400,401,402,403or404without changing the request. - The official OpenAI SDKs retry some of these automatically.
Include the x-request-id header from the response when you contact support.
