OperationsError handling

Error handling

Error response format

A failed request returns a 4xx or 5xx status code and a JSON error body:

{"code": "INSUFFICIENT_CREDITS", "detail": "Insufficient credits"}
  • code: a stable, machine-readable error code. Base your error handling on it.
  • detail: a description of the error for troubleshooting. Its wording may change, so do not rely on the text.

Some errors include additional fields, such as quota when the upload allowance is exceeded; see the response descriptions of each endpoint. Text model endpoints use the OpenAI error format; see the text model guide.

Common errors

HTTPCommon codeMeaning and action
401—Credentials are missing, invalid or revoked. Check the API Key, and whether the endpoint requires an API Key or console login credentials
402INSUFFICIENT_CREDITSNot enough credits. Top up and try again
403ACCOUNT_DISABLEDThe account is disabled. Contact platform support
404RESOURCE_NOT_FOUNDThe job, voice, asset or webhook endpoint does not exist or does not belong to your account
409IDEMPOTENCY_CONFLICTThe same Idempotency-Key was used for a different request. Keep the parameters unchanged when retrying the original request, and use a new key for a new business operation; see Asynchronous jobs
409IMAGE_RATE_CHANGED, VIDEO_RATE_CONFLICT, VOICE_DESIGN_RATE_CONFLICTThe rate or quote has changed. Read the configuration or quote again before submitting
409CONFLICTThe resource's current state does not allow the operation, for example a voice is in use or a job can no longer be stopped
410RESOURCE_EXPIRED, JOB_RESULT_EXPIRED, INPUT_ASSET_EXPIREDThe result or asset has expired or is unavailable. Upload the asset again or submit a new generation
413FILE_TOO_LARGEThe request body or file is too large
422VALIDATION_ERRORInvalid parameters, a referenced asset that does not exist, or an asset whose upload has not been confirmed
429MAX_CONCURRENT_JOBSThe account has reached its limit of concurrent generation jobs. Wait for running jobs to finish before submitting
429UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDEDThe upload count or byte allowance is exceeded. Wait for Retry-After before retrying; see Uploads
429RATE_LIMITEDToo many requests. Slow down and retry with backoff
500, 502, 504INTERNAL_ERROR, SERVICE_UNAVAILABLE, REQUEST_TIMEOUTA server error or processing timeout. First check whether a job was created, then retry with the original idempotency key
503SERVICE_UNAVAILABLE, feature_disabledThe service or feature is temporarily unavailable. Try again later

Retry guidance

  • Except for 429, 4xx errors require fixing the request or the account state first; retrying unchanged will not succeed.
  • Retry 429 and 5xx with exponential backoff. If the response includes Retry-After, wait for the time it specifies.
  • Keep the original Idempotency-Key when retrying a generation request so that no duplicate job is created or charged.

On this page