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
}
}| Field | What it is |
|---|---|
code | a stable code; build your logic on it |
message | text for a person in the Accept-Language language (ru or en); may change |
retryable | whether repeating the same request can help |
retry_after_seconds | how long to wait; the same value is in the Retry-After header |
details.param | which field or header was rejected |
details.model, details.max_mb, details.unknown_fields, details.price, details.max_credits | context 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 afterretry_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.
| Code | HTTP | Retry helps | Message |
|---|---|---|---|
unauthenticated | 401 | no | The API key is missing or invalid. |
account_blocked | 403 | no | This account is blocked. |
account_pending_deletion | 403 | no | This account is scheduled for deletion. |
api_access_required | 403 | no | Your plan does not include API access. Choose a plan that does. |
api_not_enabled | 403 | no | API access is not enabled for this account yet. |
rest_not_included | 403 | no | REST is closed for this account right now. The same key works over MCP. |
api_key_suspended | 403 | no | API keys of this account are suspended after the content filter rejected several requests. Support can lift the suspension. |
team_not_supported | 403 | no | The API is not available in team mode. Switch to your personal account. |
plan_required | 403 | no | This model is not available on your plan. |
invalid_parameters | 422 | no | Some parameters are invalid or not supported by this model. See details. |
unsupported_input | 422 | no | This model does not accept this input through the API. See details. |
invalid_webhook_url | 422 | no | The webhook URL was not accepted. It must be an https link on port 443, reachable from the internet, up to 2048 characters. |
webhook_secret_required | 422 | no | To receive webhooks, create a signing secret in your profile, API section. |
webhooks_disabled | 503 | no | Webhooks are switched off right now. Start without webhook_url and fetch the result with a request. |
unknown_model | 404 | no | No model with this id. Take the id from list_models. |
not_found | 404 | no | Not found. |
reference_not_allowed | 422 | no | This reference cannot be used: it shows a real or recognisable person. Use another file. |
reference_not_analyzed | 422 | yes | This reference is still being checked. Retry in a minute. |
moderation_blocked | 422 | no | The request was rejected by the content filter. Rephrase the prompt. |
pricing_not_configured | 422 | no | No price is set for these settings. Pick other settings or another model. |
max_credits_exceeded | 422 | no | The price :price is above your max_credits :max. Nothing was charged. |
api_key_limit_reached | 422 | no | You have reached the limit of :limit API keys. Revoke one first. |
reference_fetch_failed | 422 | no | Could not download a file from this link. Check the link or upload the file. |
upload_too_large | 422 | no | The file is larger than the :mb MB limit. |
reference_library_full | 422 | no | The reference library is full. Delete some references first. |
upload_failed | 503 | yes | The file could not be saved. Retry. |
method_not_allowed | 405 | no | This method is not supported here. |
insufficient_credits | 402 | no | Not enough credits: need :need, have :have. |
insufficient_api_balance | 402 | no | Not enough API balance: need $:need, have $:have. Top it up in your profile, «API and MCP». |
idempotency_conflict | 409 | no | This Idempotency-Key was already used with different parameters. |
idempotency_in_progress | 409 | yes | A request with this Idempotency-Key is still running. Retry in a few seconds. |
rate_limit_exceeded | 429 | yes | Too many requests. Retry after :seconds seconds. |
concurrency_limit | 429 | yes | Too many generations running at once. Wait for one to finish. |
daily_limit_exceeded | 429 | yes | This key has used its daily limit of :limit credits. It resets at 00:00 UTC. |
model_unavailable | 503 | yes | This model is switched off in the API right now: :reason |
model_busy | 503 | yes | The model is at capacity. Retry later or pick another model. |
service_unavailable | 503 | yes | The service is temporarily unavailable. |
internal_error | 500 | no | Something 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.
| Code | Retry helps | Message |
|---|---|---|
content_rejected | no | The request was rejected by the content filter. Remove real artist names and copyrighted lyrics, or rephrase the prompt. |
reference_rejected | no | A reference file was rejected: it shows a real or recognisable person or a child, or it could not be processed. Use another file. |
invalid_input | no | The model did not accept these settings. Change them and retry. |
no_result | yes | The model returned no result for this prompt. |
result_unavailable | yes | The result could not be saved. Retry. |
temporary_error | yes | A temporary error occurred. Retry in a minute. |
timeout | yes | The generation took too long and was cancelled. |
model_busy | yes, wait 60 s | The model is at capacity. Retry later or pick another model. |
service_unavailable | yes, wait 300 s | The service is temporarily unavailable. |
Common cases
| Code | What to do |
|---|---|
insufficient_api_balance | top up the API balance in the console |
max_credits_exceeded | raise max_credits or pick cheaper settings; details.price is the price |
daily_limit_exceeded | wait until 00:00 UTC or raise the daily limit of the key |
concurrency_limit | wait for one of the running generations to finish |
model_unavailable | use a model from alternatives in GET /models |
unsupported_input | remove the field named in details.param: the model does not take it |