Features
Error handling
When to retry, and when to stop.
Every status, body and cause is on Errors. This page says what a client should do.
| Status | Retry? |
|---|---|
| 400, 401, 404, 413 | No. Fix the request or the key. |
| 402 | No. Top up, or raise the key's spend limit. |
| 408, 502 | Yes, with backoff: wait 1 second, then 2, then 4. |
| 429 | Yes, after Retry-After seconds when the header is present; otherwise with backoff. |
| 500, 503 | Yes, after a few seconds. |
The gateway already tries the model's other hosts before it answers 408, 429, or a 502 for a failed host; see Rate limits. With Allow fallbacks off in your account settings, it tries one host per model.
To try other models too, list them in models; see Model fallbacks.