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

CodeStatusMeaning
invalid_api_key401The API key is missing or invalid
account_frozen402Account is suspended
balance_too_low402Insufficient credits for this request
worst_case_too_expensive402Request would exceed the $10 hard ceiling
concurrency_limit_exceeded429Too many parallel requests (Retry-After: 5)
rate_limit_per_key429Rate limit hit (Retry-After: 60)
invalid_request400Malformed request body
upstream_unavailable503Provider temporarily down
upstream_timeout504Provider did not respond in time
internal_error500Unexpected server error

Retries

For 429, 503, and 504 errors, we recommend exponential backoff with jitter. The Retry-After header is included when applicable.