On this page
Reference
Errors
Error shapes, status codes, and the provider codes you may see.
Error shapes
Most errors use a flat shape:
{ "error": "out of credit — top up via POST /deposits" }Per-key RPM limits return { "error": "rate limited" }. Per-IP concurrency limits return a structured 429 with too many concurrent requests.
Normalize once
type ApiError = { status: number; message: string; code?: string; retryAfter?: number;};
async function apiError(res: Response): Promise<ApiError> { let body: any = null; try { body = await res.json(); } catch { // empty body }
const error = body?.error; const retryAfter = Number(res.headers.get("retry-after") || 0) || undefined;
if (typeof error === "string") { return { status: res.status, message: error, retryAfter }; } if (error && typeof error === "object") { return { status: res.status, message: error.message ?? "request failed", code: error.code, retryAfter, }; } return { status: res.status, message: res.statusText || "request failed", retryAfter, };}Status codes
Signup, sign-in and claim
These carry specific messages you can surface directly. Signup is gated hard; see the signup gate.
400 invalid input400 invalid email400 invalid email domain400 <provider> addresses can sign up (provider not on the server allowlist)400 disposable email addresses are not accepted400 that email domain cannot receive mail400 that email domain is too new — use a longer-standing address400 captcha token missing400 captcha failed — try again409 an account already exists for this address429 an account was already created from this network today429 an account was already created from this device todayLimit errors
These come from the account and model limits rather than the upstream:
{ "error": "prompt is too long: ~1,200,000 tokens exceeds the 1,000,000 token context window of <id>" }
{ "error": "daily input limit reached for this model: 690,000/700,000 tokens used today (resets at 00:00 UTC)" }
{ "error": "daily output limit reached for this model: 300,000/300,000 tokens used today (resets at 00:00 UTC)" }Check GET /account/limits to render remaining budget before a request fails.
Provider error codes
You may see no_api_key, provider_auth_error, model_unavailable, invalid_request, rate_limited, upstream_timeout, upstream_unreachable, empty_response, and upstream_error.
no_api_key,provider_auth_error, andmodel_unavailablefail fast with no failover.- Transport errors, timeouts,
429,5xx, andempty_responseare retryable and may fail over. - Failed upstream calls are never billed.
Do not expose raw upstream error text to end users. Show the sanitized code and a retry action.