Error envelopes
APIPod media and shared service errors can use the standard envelope: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.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 transient5xxresponses with exponential backoff and jitter. - Reuse the original
Idempotency-Keyand unchanged body when retrying an ambiguous media create request. - Do not automatically retry
400,401,402,403, or404without 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.