When a request is limited
The API returns HTTP429 Too Many Requests. Parse the OpenAI-compatible error body, wait, and retry only when the operation is safe to repeat.
Retry strategy
Use exponential backoff with random jitter and a strict retry cap. A practical sequence is approximately 0.5, 1, 2, and 4 seconds, randomized so concurrent workers do not retry together.Reduce limit pressure
- Queue bursts and control worker concurrency instead of releasing all work at once.
- Cache deterministic application results where your data policy allows it.
- Stream long generations to improve user-perceived latency, but remember that streaming does not necessarily reduce quota usage.
- Use separate keys for independent workloads so one batch job does not starve interactive traffic.
- Bound retry attempts; repeated failures consume capacity and can amplify incidents.
- Avoid retrying
400,401,403, and404responses without changing the request.
Retryable status codes
See Errors for the complete handling model.