View as /docs.md
Reference

Error codes

Errors follow the OpenAI shape — an error object with type, code, message, and param. The canonical code is stable across versions and what your client should branch on.

Error table

StatusCodeMeaning
400invalid_requestMalformed JSON, missing required field, bad parameter type.
401invalid_keyKey missing, revoked, or out of scope.
402insufficient_creditsTop up or enable auto-recharge in the dashboard.
403scope_exceededScoped key hit its spend ceiling or model allow-list.
404unknown_modelModel ID not found — hit /v1/models for the live list.
409idempotency_conflictSame idempotency-key with a different body payload.
413payload_too_largeUpload exceeded 100MB or message history exceeded model context.
422unsupported_parameterModel doesn't support a parameter you sent (non-fatal warning).
429rate_limitedRead the retry-after header — see Rate limits.
499client_closedClient disconnected mid-stream. No charge for uncompleted tokens.
500internal_errorGateway-level fault. Include the request id when reporting.
502provider_unavailableWe auto-failover; only surfaces if all fallbacks fail.
503capacity_exceededGlobal capacity hit — backoff + retry with jitter.
504provider_timeoutUpstream didn't respond in the configured budget.

Request IDs

Every response (success or error) carries x-request-id. Include it when you ask for help — it unlocks the full upstream trace in support tooling.

Retry strategy

Do retry on 429, 502, 503, 504 with exponential backoff (start 250ms, double on each attempt, jitter ±20%). The SDKs do this by default. Don't retry on 400, 401, 402, 403, 404, 409, 413, 422 — the request is broken and will fail again.