Errors and recovery

Introduction

Errors return an error.code. Handle the HTTP status first, then react to the specific code; do not retry every error the same way. Validation failures (400 invalid_input) also carry error.message explaining what to correct and, when one can be identified, error.field naming the offending field or header; nothing is submitted or charged when that status is returned.

StatusMeaningTypical codes
400Invalid parameters or material.invalid_input
401Missing or invalid key.unauthorized
402Insufficient credits.insufficient_credits
403Not permitted for this source or account.forbidden
404Unknown source or task not owned.not_found
409Quote, request or idempotency conflict.conflict
429Concurrency or rate limit.concurrency_limit_reached
503Configuration or service temporarily unavailable.—
  • A timeout, a dropped connection or a 5xx response does not prove failure.
  • Read the task with the UUID you already saved; a 404 does not prove the provider never received it.
  • GET requests may retry with bounded backoff; leave pending tasks for reconciliation.
Never blind-resubmit a billable generation with a new idempotency key after an ambiguous outcome.