Error Format
All errors follow a consistent JSON format:Error Types
| HTTP Status | Error Type | Description |
|---|---|---|
400 | invalid_request_error | Malformed request body or missing required fields |
401 | authentication_error | Missing, invalid, or expired API key |
403 | permission_error / forbidden_error | Key doesn’t have access to the requested provider or resource |
429 | rate_limit_error | Rate limit exceeded (RPM or daily cap) |
502 | server_error | Upstream provider request failed |
503 | server_error | Authentication service temporarily unavailable |
Common Errors and Solutions
401 — Invalid API Key
403 — Provider Not Allowed
allowed_providers restriction. Use a different key
or update the allowed providers via the management API.
429 — Rate Limited
502 — Upstream Failed
Handling Errors in Code
- Python (OpenAI)
- Node.js (OpenAI)
- Go
Retry Strategy
For production applications, we recommend:- Retry on 429 and 502 with exponential backoff
- Do not retry on 400, 401, 403 — these are permanent errors
- Set a max retry count (e.g., 3 attempts)
- Consider provider fallback — if one provider fails, try another via the
provider/modelformat