The envelope
Every response body — success or error — wraps its payload in a top-level envelope. Thestatus field always mirrors the HTTP status code.
Success
Error
Error types
HTTP status alone does not determine
error.type: an HTTP 500 may carry system_error, storage_error, billing_error (credit-ledger failures) or provider_error (generation failures). Always branch on error.code or error.dev, not on the status code.
Developer codes
Thedev field is a 5-digit internal code that gives you a precise signal beyond the HTTP status. The first three digits mirror the HTTP status; the last two differentiate within that status.
For example:
40100→unauthorized(HTTP 401)40200→insufficient_credits(HTTP 402)40034→invalid_image_url(HTTP 400)50000→internal_error(HTTP 500)
Paginated responses
List endpoints wrap their payload in an additionaldata + pagination layer:

