ModelSite
Concepts

Error codes

HTTP error status codes, error response shape, and retry strategy

All errors return JSON; the error object has type and message, sometimes code/param.

Status codes

StatusExample typeMeaningTroubleshoot
400invalid_request_errormalformed request / bad paramscheck body, required fields, model
401authentication_errorAPI key missing or invalidcheck Authorization: Bearer header
402insufficient_quotainsufficient balancetop up, see Billing
403permission_deniedno access to that model/actioncheck key permissions or model availability
404not_foundmodel/resource doesn't existverify ID via GET /v1/models
408request_timeoutrequest timed outretry; use async for long jobs
413invalid_request_errorrequest body too largereduce tokens
422invalid_request_errorparam semantics unprocessablecheck tools/response_format etc.
429rate_limit_errorrate limit or quota hitlower concurrency, see Retry-After, Rate limits
500server_errorgateway/router errorplatform auto-failovers; contact support if persistent
502/503server_errorupstream unavailableplatform auto-switches upstream; retry shortly
504server_errorgateway timed out waiting on upstreamretry

Error response

{
  "error": {
    "type": "invalid_request_error",
    "code": "model_not_found",
    "param": "model",
    "message": "model not found: foo-1"
  }
}
FieldNotes
error.typeerror category (see table)
error.codespecific code (optional)
error.paramthe offending param (optional)
error.messagehuman-readable explanation

Retry strategy

The platform already auto-failovers on 5xx / upstream timeouts, switching upstreams — no aggressive client retry needed. Clients should only do exponential backoff on 429 (rate limit) and the occasional 503.

import time
def call_with_retry(fn, tries=4):
    for i in range(tries):
        try:
            return fn()
        except RateLimitError:
            time.sleep(2 ** i)   # 1, 2, 4, 8s
    raise

On this page