API referenceDraft
Errors
Error format, codes and when to retry.
Draft
The hosted API is a planned service with a draft specification. The local API described alongside it already exists and runs on your own machine.
Errors use standard HTTP status codes and a JSON body with a stable code you can branch on.
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is missing, malformed or revoked."
}
}Codes
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The body is malformed or a field has an invalid value. |
| 401 | invalid_api_key | The key is missing, malformed or revoked. |
| 402 | insufficient_credits | The account has no credits left for this request. |
| 403 | access_not_granted | The account has not been approved for API access. |
| 404 | model_not_found | The model ID does not exist or is not available to you. |
| 429 | rate_limited | Too many requests or tokens in the current window. |
| 500 | server_error | Something failed on the KOLDOS side. |
| 503 | model_unavailable | The model is temporarily unable to take requests. |
Retrying
- Retry
429after the number of seconds in theretry-afterheader. - Retry
500and503with exponential backoff. - Don't retry
400,401,402,403or404without changing the request.