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
| HTTP | Common code | Meaning 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 |
| 402 | INSUFFICIENT_CREDITS | Not enough credits. Top up and try again |
| 403 | ACCOUNT_DISABLED | The account is disabled. Contact platform support |
| 404 | RESOURCE_NOT_FOUND | The job, voice, asset or webhook endpoint does not exist or does not belong to your account |
| 409 | IDEMPOTENCY_CONFLICT | The 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 |
| 409 | IMAGE_RATE_CHANGED, VIDEO_RATE_CONFLICT, VOICE_DESIGN_RATE_CONFLICT | The rate or quote has changed. Read the configuration or quote again before submitting |
| 409 | CONFLICT | The resource's current state does not allow the operation, for example a voice is in use or a job can no longer be stopped |
| 410 | RESOURCE_EXPIRED, JOB_RESULT_EXPIRED, INPUT_ASSET_EXPIRED | The result or asset has expired or is unavailable. Upload the asset again or submit a new generation |
| 413 | FILE_TOO_LARGE | The request body or file is too large |
| 422 | VALIDATION_ERROR | Invalid parameters, a referenced asset that does not exist, or an asset whose upload has not been confirmed |
| 429 | MAX_CONCURRENT_JOBS | The account has reached its limit of concurrent generation jobs. Wait for running jobs to finish before submitting |
| 429 | UPLOAD_RATE_LIMITED, UPLOAD_QUOTA_EXCEEDED | The upload count or byte allowance is exceeded. Wait for Retry-After before retrying; see Uploads |
| 429 | RATE_LIMITED | Too many requests. Slow down and retry with backoff |
| 500, 502, 504 | INTERNAL_ERROR, SERVICE_UNAVAILABLE, REQUEST_TIMEOUT | A server error or processing timeout. First check whether a job was created, then retry with the original idempotency key |
| 503 | SERVICE_UNAVAILABLE, feature_disabled | The 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
429and5xxwith exponential backoff. If the response includesRetry-After, wait for the time it specifies. - Keep the original
Idempotency-Keywhen retrying a generation request so that no duplicate job is created or charged.