API reference
Errors
Status codes and error format.
Errors use the OpenAI error shape:
error body
{
"error": {
"message": "Invalid or revoked API key",
"type": "authentication_error",
"code": 401
}
}Status codes#
| Code | type | When |
|---|---|---|
| 400 | invalid_request_error | Body is not valid JSON, model is missing, or the model id is unknown. |
| 401 | authentication_error | Missing, malformed, invalid or revoked API key. |
| 402 | insufficient_energy | Paid model: not enough Energy in your vault. Free model: you hold less than 5,000 ENERGY. |
| 404 | not_found_error | The resource does not exist. |
| 429 | rate_limit_error | More than 60 requests per minute on this key. |
| 503 | unavailable_error | The model is temporarily unavailable. Retry shortly. |
| 500 | api_error | Unexpected server error. |
Retry 429 and 503 with exponential backoff. Don't retry 400, 401 or 402 without changing the request.