ExperientialDocs
Sign in

Guides

Errors

Every error the gateway returns is an OpenAI-compatible envelope with a stable code. The messages are written so an agent can self-correct from the code and message alone.

The error envelope

Every failure on /v1/chat/completions, /v1/responses, and /v1/models returns the same shape, so existing OpenAI error handling keeps working:

{
  "error": {
    "message": "The requested model alias is not granted to this identity.",
    "type": "permission_error",
    "code": "model_not_granted",
    "param": null
  }
}

Branch on code, not the message text; the message is human-readable and may change, the code is stable.

Stable codes

codeHTTPMeaningHow to recover
invalid_json400The request body is not valid JSON.Fix the request body.
invalid_request400The request is malformed.Read the message, fix the request, and resend.
invalid_parameter400A field is invalid; param names it.Correct that field and resend.
unsupported_capability400The model cannot do what you asked (a tool, a modality, reasoning).Pick a capable model; check supported_params and modalities in /api/models.
continuation_unavailable400previous_response_id is unknown or expired on this worker.Resend the full conversation instead of continuing.
invalid_key401The key is missing, malformed, expired, or revoked.Fix the Authorization header.
model_not_granted403Your organization cannot call this slug.Use a slug returned by GET /v1/models.
idempotency_conflict409The same Idempotency-Key was reused with a different body.Use a fresh Idempotency-Key.
idempotency_replay_unavailable409 / 500The original keyed result is gone after a restart.Resend with a new Idempotency-Key.
insufficient_quota429A spend limit or your credit balance is exhausted; the message says which (a daily org cap, a per-model cap, or credits).Add credits or raise limits at /credits (platform-funded lane only).
unavailable_route429 / 503Throttled, or no healthy route right now.Retry with backoff.
gateway_overloaded429The bounded replay window is full.Retry with backoff.
request_cancelled499The client disconnected before completion.Reissue the request if you still want the result.
all_routes_failed502Every provider in the waterfall failed.Retry; if you are on BYOK, check your provider key.
provider_output_too_large502Provider output exceeded the gateway response limit.Lower max output tokens.
gateway_draining503This instance is draining and is not taking new requests.Retry; the request lands on another instance.
deadline_exceeded504The request ran past the gateway deadline.Shorten the work or retry.
internal_error500An unexpected failure.Retry with backoff.

Any unknown /v1 path returns 404 with code=not_found. The gateway serves exactly /v1/models, /v1/chat/completions, and /v1/responses.

What to retry

  • Retry 429 (throttled or overloaded), 502, 503, and 504 with exponential backoff.
  • Do not blindly retry 400, 401, 403, or 409. Fix the request first; the same call fails the same way.
  • insufficient_quota is not transient: it clears when you add credits or raise a limit, not on retry.
Delivery is at-least-once: an ambiguous network failure that you retry can dispatch and bill the underlying provider twice. Pass an Idempotency-Key header so an exact retry replays the original result instead of running again.

See also

The API reference documents each endpoint, and /llms.txt carries this same error table for agents.