ModelRail

Docs
Dashboard

Errors

Every failure returns a unified error object. Always capture request_id for support and debugging.

Error shape

json

{
  "error": {
    "code": "bad_request",
    "type": "request_error",
    "message": "Human-readable message",
    "request_id": "...",
    "param": "model",
    "details": ["optional validation messages"]
  }
}

error.type: request_error | provider_error | server_error

Things to note

Validation failures are normally 400. 422 is used for no_compatible_model. Streaming errors may arrive inside the SSE stream after HTTP 200.

Fix the request

HTTPTypical codeWhat to do
400bad_request, provider_invalid_request, capability_mismatchFix body fields; check param / details
413payload_too_largeShrink body (limit 2 MB)
409idempotency_*, request_id_conflictUse a new Idempotency-Key or x-request-id

Authentication and access

HTTPTypical codeWhat to do
401unauthorizedFix or recreate the API key
403forbiddenCheck project, org, or environment

Back off and retry

HTTPTypical codeWhat to do
429rate_limit_exceeded, concurrency_limit_exceeded, spending_limit_exceeded, provider_rate_limitBack off; honor Retry-After and rate-limit headers when present
504gateway_timeout, provider_timeoutRetry with a shorter prompt or later

Model capabilities

HTTPTypical codeWhat to do
422no_compatible_modelChange alias or drop unsupported capabilities (images, JSON mode, tools)

Availability

HTTPTypical codeWhat to do
499request_cancelledClient aborted the request
502provider_protocolUpstream protocol issue — retry or contact support with request_id
503inference_not_enabled, providers_unavailable, limits_unavailableService or upstream unavailable — retry later