RELIABILITY · 2026-12-05

Errors, idempotency and safe retries

How to avoid duplicate generation requests when an API call is slow, unknown or disconnected.

Source-linkedNo credential examples

Classify the failure before retrying

A 4xx validation error may be safe to correct and resubmit. A connection failure or timeout after the request body was sent is ambiguous and must not automatically become a new generation.

SituationRecommended action
Local validation failed before submissionCorrect the request and submit with a new idempotency key.
HTTP 202 returnedPersist the task ID, poll the original task and do not submit again.
Network timeout without a responseQuery the original task or support channel before deciding whether a retry is safe.
Terminal provider rejectionRead the structured reason, fix the input if appropriate, and preserve the original receipt.

Use a stable idempotency key

Generate the key from your application's request identity, not from a random value on every retry. If your client retries the same logical operation, reuse the same key.

Log only what you need

Log the model, status code, request ID, task ID and terminal state. Do not log the bearer token, full private prompts or private media URLs in shared systems.