Skip to main content
Every error uses this envelope. Branch on error.code, which is stable, and show error.message to developers, not to end users. The x-request-id response header carries the same request ID.

Decide what to do

Error codes

A 429 is not always safe to retry. budget_exceeded also returns 429, and retrying it only repeats the failure. Check error.code, not just the status.

Retry with backoff

Retry only rate_limit_exceeded, upstream_rate_limit, upstream_unavailable, and upstream_timeout, with exponential backoff and jitter. Never retry authentication, permission, archived-project, invalid-request, or model-restriction errors without changing the request or configuration.

Rate limit headers

Responses include headers that show how much of your project’s limit is left: Slow down before remaining reaches zero instead of waiting for a 429.

Contact support with the request ID

Include the x-request-id value (it looks like req_...) when you contact support. It ties your report to the exact request in Platform logs.