Skip to documentation
On this page

Documentation

Errors / Rate limits

Errors

HTTP errors have an error object with code and message. A successfully accepted task can still fail later; query the task or handle its failure callback.

{
  "error": {
    "code": "invalid_request",
    "message": "input.prompt is required."
  }
}
HTTPFieldWhat to do
400invalid_request
Fix the JSON, missing prompt, parameter range or media URL before retrying.
401invalid_api_key
Check the Bearer token and whether the API key is active.
402insufficient_credits
Add credits or reduce the task cost. The response may include required and available amounts.
403forbidden
Check the account-level restriction described in the error message.
404not_found
Check the task ID and that the key belongs to the task's user.
429rate_limited
Wait for the Retry-After interval before retrying.
500internal_error
Inspect the error message and API logs. Retry cautiously; resubmitting a create request can create another billable task.

Rate limits

Create tasks: each API key allows up to 100 requests per minute by default. Custom rate limits are not currently available.

Query tasks: each API key allows up to 120 requests per minute by default. Query requests and task creation requests are counted separately.

Image and video creation requests share the same API key rate limit.

HTTP 429 includes Retry-After: 60 for creation and Retry-After: 5 for queries. Use backoff and avoid polling more frequently than necessary.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded."
  }
}