Errors & Retry
Practical error handling, idempotency, and backoff retry rules for async generation endpoints, task polling, and webhooks.
/v1/generationsClient requests
Retry when:
- request timed out before you received a response
- network connection dropped
- the server returned a retriable
5xx, or a429withretryable: true
Use the same Idempotency-Key when retrying a create call.
Error shape and common codes
{"error":{"code":"invalid_request","message":"...","request_id":"req_...","retryable":false}}request_idmatches theX-Request-Idresponse header; include it when contacting support.retryable: truemeans waiting and retrying with the same idempotency key can succeed;falsemeans fix the request, permissions, or balance first.429and some503responses carryRetry-Afterin seconds; wait at least that long.
| HTTP | Common code | Action |
|---|---|---|
400 | invalid_request, quote_error | Fix model or parameters; do not retry unchanged |
400 | invalid_callback_url | callback_url must be a public https URL (max 2048 characters); fix it before resubmitting, do not retry unchanged |
400 | callback_secret_required | Set the workspace callback_url signing secret on /console/webhooks before using callback_url; see Webhooks |
400 | group_param_not_allowed | The parameter value is not allowed for your group; adjust it |
401 | unauthenticated | Check the Bearer API key |
402 | insufficient_balance | The key's workspace lacks API balance; add funds to the API wallet before calling again and do not blindly retry; read api_credits from GET /v1/user/balance |
403 | scope_forbidden | Grant the required scope or use another key |
403 | ip_not_allowed | The request IP is outside the key's IP allowlist; update the key's allowed IPs in the console |
403 | model_not_allowed | The key has a model allowlist that excludes this model; update the key's allowed models in the console |
404 | model_not_found, task_not_found | Check IDs and workspace ownership; use the id returned by GET /v1/models |
409 | idempotency_conflict | Use a new key for a different request body |
409 | idempotency_in_progress | Follow Retry-After, then retry the same key and body |
429 | group_rate_limited, risk_limited | Per-minute request or risk window is full; back off for Retry-After, then retry |
429 | group_limit_exceeded | Concurrent-task, daily credit, or request quota is full; Retry-After can be long (for example until the next day). Wait for in-flight tasks or raise the key's limits |
429 | budget_exceeded | The API wallet's daily or monthly budget is exhausted; wait for the budget period to reset or ask a workspace admin to adjust the API wallet budget |
503 | no_available_route, upstream_provider_error, gateway_error | No route is available right now or the limiter is down; retry a limited number of times after Retry-After with the same idempotency key |
Other 5xx | Server error | Retry a limited number of times with the same idempotency key |
Rate-limit headers
When the API key has a requests-per-minute (RPM) limit, responses to requests that count against it (image and video generation and text model calls) include:
| Header | Meaning |
|---|---|
X-RateLimit-Limit-Requests | Requests allowed in the current window |
X-RateLimit-Remaining-Requests | Requests left in the current window |
Read endpoints such as model lists, quotes, and task lookups do not count against RPM and omit these headers. They are also omitted when the key has no RPM limit or the request was rejected before it counted.
Task polling
Treat these separately:
- transport failure: retry the poll
- task failure: inspect the business error payload and decide whether to resubmit
Webhook receivers
If you return non-2xx, Aibubu will retry until the retry budget is exhausted.
Return 2xx only after:
- signature passes
- request is accepted for internal processing

