Skip to main content
Errors that occur before streaming begins are ordinary JSON responses:
  • statusCode - the HTTP status, repeated in the body.
  • message - a human-readable description. For validation errors this is an array of strings, one per problem.
  • error - the status text. Present on most errors; treat it as optional.
  • code - a stable machine-readable identifier, present only on the errors that define one (idempotency_key_reused, model_unavailable, model_input_unsupported). Those bodies carry message and code only, without statusCode or error, so always key off the HTTP status first.
Failures after streaming has begun arrive as an error frame inside the 200 stream instead - see Streaming.

Status codes

Example: validation error

Example: rate limited

Example: concurrency limit reached

Example: idempotency key reused

Retry guidance

  • Honor Retry-After on 429 and 503 rather than retrying immediately.
  • Use an Idempotency-Key on every request you might retry - it makes retries after timeouts, dropped connections, and 5xx responses safe.
  • Do not retry 400, 401, 402, or 422 unchanged; they will fail the same way until the underlying problem is fixed.