Skip to content

Error Handling

Check the HTTP status before reading a successful response. API errors can include an error object with a message, type, or code; fields and codes vary by endpoint. Do not assume a single error envelope or an exhaustive fixed code list.

A successful polling HTTP response does not necessarily mean generation succeeded. Inspect the task’s status and, for failed, its error field. The video integration uses task_failed for a confirmed task failure; inspect the message for context.

SituationAction
Authentication or access rejectedCheck the API key, its status, expiry, quota, model access, and IP restrictions
Invalid requestCheck the exact model ID, required inputs, duration, resolution, and parameter types
Insufficient balance or key quotaCheck both account balance and the API key’s remaining quota
HTTP 429Reduce request frequency and concurrency; use bounded backoff
Polling connection errorRetry the GET using the same task ID
Submission timeout or lost responseTreat submission as uncertain; check task history or contact support before submitting again
Task failedRead the error, correct the cause, and decide whether a new paid submission is appropriate
Task unknownStop automatic resubmission and ask support to reconcile the task

Do not automatically repeat a paid POST just because a connection failed or an HTTP 5xx was received. The task may already have been accepted.

Record the HTTP status, task ID when available, model ID, request time, and a redacted error response. Never log an API key, Authorization header, login token, or private media URL containing access credentials.

See Video Errors & Recovery and Rate Limits.