docs
Help

Errors and limits

Markdown

Response codes, what they mean, and what to do. All errors are JSON and include a Request ID.

Full guide

Error format

The error uses the format of the API you called: an object named error for OpenAI, {"type": "error", "error": {...}} for Anthropic, and an error object with status and details fields for Gemini. SDKs therefore recognize them as standard API errors.

  • error.code and error.reason — the error class from the table below; the values match. error.type — the format’s standard value (for example, invalid_request_error or server_error).
  • error.request_id (at the top level in Anthropic as request_id ), the X-Request-ID header, and the end of the message contain the request ID.
  • In Gemini, the class is in error.details: ErrorInfo.reason — the same code in uppercase (for example, MODEL_OVERLOADED), domain — ailoot.ai; the request ID is in RequestInfo.requestId.
  • In Gemini format, a 5xx error that must not be retried automatically and result_pending_check are returned with status 409 and status ABORTED: this prevents the Gemini SDK and CLI from retrying them automatically. The error class is in ErrorInfo.reason (for example, MODEL_TIMEOUT or RESULT_PENDING_CHECK).
  • OpenAI-format responses also have the top-level fields code and message for older clients.
{
  "code": "API_KEY_REQUIRED",
  "error": {
    "code": "invalid_api_key",
    "message": "No API key was sent with the request. Nothing was charged. Please check that the full key is sent in the Authorization header as \"Bearer <key>\". Request ID: 3b28d3de-5b02-4d07-9f3c-4b9a7d0e68d6.",
    "param": null,
    "reason": "invalid_api_key",
    "request_id": "3b28d3de-5b02-4d07-9f3c-4b9a7d0e68d6",
    "type": "invalid_request_error"
  },
  "message": "No API key was sent with the request. Nothing was charged. …"
}

Error codes

HTTPClass (reason)What happenedWhat to do
400invalid_requestThe request is invalid: an incorrect body or parameter; the model does not support a requested field, attachment, or tool; or the key was sent in the URL Correct the request as described in the error: remove the unsupported field, attachment, or tool, and send the key in a header. Unsupported fields, attachments, or tools are rejected before a reserve is placed, so nothing is charged.
400context_length_exceededThe request exceeds the model’s context windowShorten the history or choose a model with a larger context window
400content_policy_violationThe request was rejected by the model’s rulesRephrase the request
401invalid_api_keyThe key is missing or invalidCheck that the full key was sent
401api_key_disabledThe key is disabledEnable it or create a new key
402insufficient_balance, insufficient_quotaThere is not enough available balance even for the minimum reserve (insufficient_quota is the same case in a format familiar to the OpenAI SDK)Add funds or reduce max_tokens
402api_key_quota_exhaustedThe key’s total spending limit is exhaustedIncrease the key limit in the Dashboard
402payment_disputedThe account has outstanding debt from a disputed paymentNew requests are paused until the debt is repaid; contact support
403api_key_expiredThe key has expiredCreate a new key
403account_inactiveYour account is disabledContact support
403permission_deniedThe key is not permitted to make this request, for example because of an IP restrictionCheck the key restrictions
404model_not_foundThe model does not existCheck the ID against /v1/models
404unsupported_endpointThe model does not support this formatChoose another format or model
404not_foundThe path or object, such as a task, does not existCheck the URL and identifier
409duplicate_requestAn operation with the same idempotency key has already been accepted and may have completedCheck the result of the first operation; do not send a new one
409not_ready, video_not_readyThe video or other task is not ready yetCheck its status later
409, 503result_pending_checkThe request outcome is being determined. For a video task, this is the result_pending_check: true flag in the status response; the task itself remains in_progressDo not resend the request. Its status will appear in your history (GET https://ailoot.ai/api/v1/usage). Do not create a new video task: check it later through GET /v1/videos/{id}.
410model_retiredThe model has been retiredChoose a new version from GET /v1/models
413request_too_largeThe request body is too largeReduce the files or history
429rate_limit_exceeded, gateway_concurrency_limit, gateway_queue_fullToo many requests or concurrent requests from your accountWait for the interval in the Retry-After header, usually 10 seconds, then retry
429usage_limit_reachedThe key’s spending window is exhausted (5 hours, 1 day, or 7 days)Wait for the window to reset or increase the key limit
500internal_errorAn Ailoot errorContact support with the Request ID
502invalid_model_response, empty_response, incomplete_responseThe model returned an invalid, empty, or incomplete responseLook up the Request ID in your dashboard history. If it shows a result or a charge, resending will create a second paid request. A missing entry does not establish that the request was not sent or did not run: do not resend a request whose outcome is unknown; contact support with the Request ID.
502result_not_deliveredThe result was not delivered because of an Ailoot failure, and the reserve or charge was returnedYou can send the request again
503model_overloadedThe model is temporarily overloadedIf X-Should-Retry: true, retry after the number of seconds in Retry-After; if false, check the Request ID in your history first
503model_unavailableThe model is temporarily unavailableChoose another model. If X-Should-Retry: true, retry after the number of seconds in Retry-After; if false, check the Request ID in your history first.
503service_unavailableA temporary Ailoot failureIf X-Should-Retry: true, retry after the number of seconds in Retry-After; if false, check the Request ID in your history first
503charge_not_confirmedNo response was delivered because the charge could not be confirmed. The reserve was released, and no money was charged.If X-Should-Retry: true, retry after the number of seconds in Retry-After; if false, check the Request ID in your history first
504model_timeoutThe model did not respond in time; a result may still appearDo not send the request again until you have checked its Request ID in your history

Codes for model responses and result verification (502, 503, and 504) now refer to the model or request: model_unavailable, model_timeout, invalid_model_response, incomplete_response, charge_not_confirmed and result_pending_check. If your code compares error.code against the previous values, replace them with the codes in the table. For help mapping old codes to new ones, contact support.

When to retry a request

  • Check X-Should-Retry first: if you see false, result_pending_check or model_timeout — do not retry automatically. The first item is a header value; the others are error codes. Find the Request ID in your Dashboard history to see the result and charge.
  • Retrying is safe when X-Should-Retry: true is returned: wait Retry-After seconds. For 5xx errors, the code alone is not enough: a result may already exist. Check your Dashboard history first or contact support with the Request ID. This is especially important for images, video, music, and long agent steps.
  • Retries will not help: for 400, 401, 402, 403, or 404, correct the request, key, or balance first.

Limits

Rate and concurrency limits apply to your account as a whole, not to individual keys. Exceeding them returns 429 rate_limit_exceeded with the header Retry-After: 10. If the model itself is overloaded, you receive 503 model_overloaded with Retry-After: 30. If you need a higher load, contact support.

Spending limits are set per key: the total limit returns 402 api_key_quota_exhausted; the 5-hour, 1-day, and 7-day windows return 429 usage_limit_reached. Learn more: API keys and base URL.

NVIDIA models: queueing

You can request the model list with a zero balance, but generation requires enough balance for the reserve. NVIDIA models, including Nemotron, use a shared queue. Under high load, responses may arrive later, or you may receive a “model temporarily overloaded” error with Retry-After; retry after the specified interval. Prices are in the catalog, and charges work the same way as for other models.

Size limits are set by the model: its context window (the number of tokens you can send) and maximum response length. They are listed in the catalog.

History and spending

History and spending · GET https://ailoot.ai/api/v1/usage · JWT · Authorization: Bearer $TOKEN

JWT ≠ sk-… · Sign-in and sessions

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.Contact support