Errors
ModelGates uses standard HTTP status codes and returns errors in an OpenAI-compatible format.
Error format
json
{ "error": { "message": "Invalid API key", "type": "invalid_request_error", "code": "invalid_api_key", "param": null }}Error codes
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The API key is missing or invalid |
account_frozen | 402 | Account is suspended |
balance_too_low | 402 | Insufficient credits for this request |
worst_case_too_expensive | 402 | Request would exceed the $10 hard ceiling |
concurrency_limit_exceeded | 429 | Too many parallel requests (Retry-After: 5) |
rate_limit_per_key | 429 | Rate limit hit (Retry-After: 60) |
invalid_request | 400 | Malformed request body |
upstream_unavailable | 503 | Provider temporarily down |
upstream_timeout | 504 | Provider did not respond in time |
internal_error | 500 | Unexpected server error |
Retries
For 429, 503, and 504 errors, we recommend exponential backoff with jitter. The Retry-After header is included when applicable.