Skip to Content
Entrar

Errors

What to do after an error: the next step for each HTTP status, the error object, the 8 request error codes and the 5 task failure codes.

Error response shape

A failed Kerox API request returns a real HTTP status code and the error object below. param appears when one field is at fault. Branch on error.code; error.message says exactly what went wrong and may be reworded over time.

{
  "error": {
    "code": "invalid_request",
    "message": "duration must be -1 or between 4 and 30.",
    "param": "input.duration"
  }
}

Every response also carries the x-request-id header. Include it when you email us at hi@kerox.ai.

What to do next

Branch on the HTTP status and error.code, not on message.

You gotWhat it meansDo this
HTTP 400 invalid_requestA field is missing or wrong; error.param names itFix that field and send again. A new request, not a retry
HTTP 401 unauthorizedNo key, a mistyped key, or a key that was revoked or is past its expiry dateCheck the Authorization: Bearer <key> header; create a new key in Console → API → API Keys if needed
HTTP 402 insufficient_balanceThe available balance does not cover the estimate, or this key's spend limit would be passed; message says whichTop up (Top-ups) or raise the key's limit (Key limits)
HTTP 400 model_unavailableThe model cannot take tasks nowChoose a live model or try later
HTTP 403 forbiddenAccount or key restrictionsVerify your email, check the account status, outgoing IP and allowed models for this key
HTTP 404 not_foundUnknown path, model, file or taskCheck the endpoint and model ID. For a task or file, use its returned ID and a key from the account that created it
HTTP 413 invalid_requestThe request body or inline files are too largeUpload files first and submit their URLs
HTTP 409 invalid_requestAn Idempotency-Key used before with a different bodyUse a new key for a new request (Idempotency)
HTTP 429 rate_limited with retry-afterToo many submits or uploads this minuteWait that many seconds, then send the same request again
HTTP 429 rate_limited without retry-afterToo many tasks in progressWait for one of your tasks to finish, then send again (Limits)
HTTP 500 or 503 internal_errorA problem on our sideRetry with the same Idempotency-Key; if it keeps failing, email hi@kerox.ai with the x-request-id header
status: "failed" on a taskThe task was accepted, then failed, and was refunded; error.code says why (below)A retry is a new task: submit it again with a new Idempotency-Key

Presigned PUT, HTTP 412. The storage service returns this directly. Check the HTTP status before parsing JSON. Read GET /v1/files/{id}: use the URL when ready, or request a fresh upload if deleted or still pending after polling.

Request error codes

CódigoHTTPQuando acontece
invalid_request400 / 409 / 413The request is wrong: not JSON, a missing, unknown or invalid field (named in `param`), a body over 4 MB or base64 files over 3 MB (413), or an Idempotency-Key reused with a different body (409). Fix it and send again.
unauthorized401No API key, an unknown or revoked key, or a key past its expiry date.
forbidden403The account is disabled or its email is not verified, the request IP is not on the key’s allowlist, or the key may not use this model.
insufficient_balance402The available balance is less than the estimate, the balance is negative, or the task would pass the key’s spend limit. The message says which.
not_found404The endpoint, model, task or file does not exist (or belongs to another account).
model_unavailable400The model is not open yet or is temporarily unavailable. Try another model or retry later.
rate_limited429Too many submissions or uploads per minute (`retry-after` says how long to wait), or too many tasks in progress.
internal_error500 / 503Our side failed (500) or is briefly unavailable (503). Retry with the same Idempotency-Key; if it persists, email hi@kerox.ai with the x-request-id of the response.

Task failure codes

When a task is accepted (201) and later fails, GET /v1/tasks/{id} and the webhook return status: "failed" with error: { code, message }. Failed and timed-out tasks are refunded in full (cost.status: "refunded").

CódigoQuando aconteceO que fazer
content_violation
The prompt, an input file or the result was blocked by content moderation.
The prompt, an input file or the result did not pass content moderation. Change the content and try again.
Change the content and retry.
moderation_unavailable
Content moderation was temporarily unavailable.
Content moderation is temporarily unavailable. Try again shortly.
Retry shortly. The hold is refunded.
input_fetch_failed
An input file could not be downloaded (the link does not open or has expired).
An input file could not be downloaded. Check that the URL is public and has not expired, or upload the file again.
Use another URL, or upload with /v1/files.
invalid_input
The model rejected the parameters or an input file (for example a reference video over the resolution limit).
The model rejected the parameters or an input file. Change them and try again.
Change the input and retry.
timeout
The task did not finish within the model’s time limit.
The task did not finish within its time limit. You can retry it as is.
Retry as is.
generation_failed
Generation failed for any other reason.
Generation failed. You can retry it as is.
Retry as is.

Nesta página

Para agentes de IA

Esta página em Markdown: /pt-br/docs/errors.md

Tudo de uma vez: /llms-full.txt