Skip to content
Documentation menu

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 body
{
  "error": {
    "type": "authentication_error",
    "code": "invalid_api_key",
    "message": "The API key is missing, malformed or revoked."
  }
}

Codes

StatusCodeMeaning
400invalid_requestThe body is malformed or a field has an invalid value.
401invalid_api_keyThe key is missing, malformed or revoked.
402insufficient_creditsThe account has no credits left for this request.
403access_not_grantedThe account has not been approved for API access.
404model_not_foundThe model ID does not exist or is not available to you.
429rate_limitedToo many requests or tokens in the current window.
500server_errorSomething failed on the KOLDOS side.
503model_unavailableThe model is temporarily unable to take requests.

Retrying

  • Retry 429 after the number of seconds in the retry-after header.
  • Retry 500 and 503 with exponential backoff.
  • Don't retry 400, 401, 402, 403 or 404 without changing the request.