Skip to main content
Every error uses one envelope, whether a request is refused or a generation or one of its outputs fails:
A failed generation reports the envelope’s inner object as its error, and each failed output reports one as its own error.

Retry errors

Retry a request only when retryable is true. Back off between attempts, and for a 429, wait at least the number of seconds in the Retry-After header. Send the same Idempotency-Key on each retry of a POST, so that a retry never starts a second generation. For details, see Idempotency.

Request errors

Validation details

A validation_failed or invalid_request error from schema validation names the first problem in message and param. When the request has more than one problem, details.issues lists up to 10 of them, each with a message and, when it applies, a param:

Generation and output errors

A generation’s error and each output’s error use one of the following codes. retryable says whether creating the same generation again can succeed. details.reason gives a more specific cause, and details.providerMessage sometimes carries the provider’s own message. Both are for diagnosis: their values can change, so don’t branch on them. A failed output isn’t charged for its output, but a generation is still charged for billable work that actually happened. For details, see Billing.