Skip to content

Core concepts

Errors and retries ​

Error shape ​

Every refusal of REST has one shape:

json
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Too many requests. Retry after 12 seconds.",
    "retryable": true,
    "retry_after_seconds": 12
  }
}
FieldWhat it is
codea stable code; build your logic on it
messagetext for a person in the Accept-Language language (ru or en); may change
retryablewhether repeating the same request can help
retry_after_secondshow long to wait; the same value is in the Retry-After header
details.paramwhich field or header was rejected
details.model, details.max_mb, details.unknown_fields, details.price, details.max_creditscontext of specific codes

Values of your input are never echoed in an error.

When to retry ​

  • retryable: false · a repeat will not help. Fix the request, the key or the balance.
  • retryable: true · retry after retry_after_seconds, or without it with a growing pause (1, 2, 4, 8 s).
  • Retry a launch · always with the same Idempotency-Key, so there is no second charge. See Idempotency.
  • 500 internal_error · a failure on our side that we already know about. Retry later.

Request error codes ​

This table is built from the service code on every docs build.

CodeHTTPRetry helpsMessage
unauthenticated401noThe API key is missing or invalid.
account_blocked403noThis account is blocked.
account_pending_deletion403noThis account is scheduled for deletion.
api_access_required403noYour plan does not include API access. Choose a plan that does.
api_not_enabled403noAPI access is not enabled for this account yet.
rest_not_included403noREST is closed for this account right now. The same key works over MCP.
api_key_suspended403noAPI keys of this account are suspended after the content filter rejected several requests. Support can lift the suspension.
team_not_supported403noThe API is not available in team mode. Switch to your personal account.
plan_required403noThis model is not available on your plan.
invalid_parameters422noSome parameters are invalid or not supported by this model. See details.
unsupported_input422noThis model does not accept this input through the API. See details.
invalid_webhook_url422noThe webhook URL was not accepted. It must be an https link on port 443, reachable from the internet, up to 2048 characters.
webhook_secret_required422noTo receive webhooks, create a signing secret in your profile, API section.
webhooks_disabled503noWebhooks are switched off right now. Start without webhook_url and fetch the result with a request.
unknown_model404noNo model with this id. Take the id from list_models.
not_found404noNot found.
reference_not_allowed422noThis reference cannot be used: it shows a real or recognisable person. Use another file.
reference_not_analyzed422yesThis reference is still being checked. Retry in a minute.
moderation_blocked422noThe request was rejected by the content filter. Rephrase the prompt.
pricing_not_configured422noNo price is set for these settings. Pick other settings or another model.
max_credits_exceeded422noThe price :price is above your max_credits :max. Nothing was charged.
api_key_limit_reached422noYou have reached the limit of :limit API keys. Revoke one first.
reference_fetch_failed422noCould not download a file from this link. Check the link or upload the file.
upload_too_large422noThe file is larger than the :mb MB limit.
reference_library_full422noThe reference library is full. Delete some references first.
upload_failed503yesThe file could not be saved. Retry.
method_not_allowed405noThis method is not supported here.
insufficient_credits402noNot enough credits: need :need, have :have.
insufficient_api_balance402noNot enough API balance: need $:need, have $:have. Top it up in your profile, «API and MCP».
idempotency_conflict409noThis Idempotency-Key was already used with different parameters.
idempotency_in_progress409yesA request with this Idempotency-Key is still running. Retry in a few seconds.
rate_limit_exceeded429yesToo many requests. Retry after :seconds seconds.
concurrency_limit429yesToo many generations running at once. Wait for one to finish.
daily_limit_exceeded429yesThis key has used its daily limit of :limit credits. It resets at 00:00 UTC.
model_unavailable503yesThis model is switched off in the API right now: :reason
model_busy503yesThe model is at capacity. Retry later or pick another model.
service_unavailable503yesThe service is temporarily unavailable.
internal_error500noSomething went wrong on our side. Retry later.

:price, :limit and other words with a colon are replaced with numbers from the request.

Why a generation failed ​

The launch was accepted but the generation ended failed. Then the generation has an error field with a code from this list, and the price is refunded.

CodeRetry helpsMessage
content_rejectednoThe request was rejected by the content filter. Remove real artist names and copyrighted lyrics, or rephrase the prompt.
reference_rejectednoA reference file was rejected: it shows a real or recognisable person or a child, or it could not be processed. Use another file.
invalid_inputnoThe model did not accept these settings. Change them and retry.
no_resultyesThe model returned no result for this prompt.
result_unavailableyesThe result could not be saved. Retry.
temporary_erroryesA temporary error occurred. Retry in a minute.
timeoutyesThe generation took too long and was cancelled.
model_busyyes, wait 60 sThe model is at capacity. Retry later or pick another model.
service_unavailableyes, wait 300 sThe service is temporarily unavailable.

Common cases ​

CodeWhat to do
insufficient_api_balancetop up the API balance in the console
max_credits_exceededraise max_credits or pick cheaper settings; details.price is the price
daily_limit_exceededwait until 00:00 UTC or raise the daily limit of the key
concurrency_limitwait for one of the running generations to finish
model_unavailableuse a model from alternatives in GET /models
unsupported_inputremove the field named in details.param: the model does not take it