Skip to main content
Use the HTTP status to classify transport-level outcomes, then read the machine-readable code when one is present. Keep the human-readable message for logs and diagnostics, not control flow.

Error envelopes

APIPod media and shared service errors can use the standard envelope:
Authentication and protocol-compatible endpoints can use an OpenAI-compatible envelope:
Client normalization should check error.code, then data.error_code, while always preserving the HTTP status and message.

HTTP status codes

Common machine codes

Provider and model-specific failures can expose additional codes. Treat unknown codes as forward-compatible values and fall back to the HTTP status class.

Asynchronous failures

A task may be accepted successfully and fail later. Polling and webhook payloads expose the terminal task status separately from the original create response.
Do not convert capacity or service failures into moderation errors. Preserve an unknown asynchronous error_code, show the safe message to operators, and decide retry behavior from the semantic code and task state.

Retry checklist

  • Retry 429, 503, and transient 5xx responses with exponential backoff and jitter.
  • Reuse the original Idempotency-Key and unchanged body when retrying an ambiguous media create request.
  • Do not automatically retry 400, 401, 402, 403, or 404 without first changing the condition that caused them.
  • Put an upper bound on attempts and total elapsed time.
  • Log X-Request-ID, task_id, HTTP status, machine code, and attempt number.