Errors
Only endpoints that intentionally differ from the standard API carry a chip; the chip links to the note that explains the difference.
For paid requests, a zero rate cap, a 100% minimum discount, missing official rates under an applicable percentage rule, unavailable offers within your caps, or a fixed-price model listed above your cap can refuse a request without charge. See Budgets before loosening limits or retrying. Routing wait is separate from generation time.
Each surface below names its own envelope: inference answers typed envelopes, dashboard and affiliate answer a plain-string error, webhooks mix JSON acks with plain-text bodies. Match the surface before parsing.
/v1/chat/completions/v1/messagesDiffers from standard{
"error": {
"message": "balance too low for this request: top up to continue",
"type": "insufficient_balance"
}
}OpenAI surface — POST /v1/chat/completions
Envelope {"error":{"message","type"}}: typed, except the message-only rows noted below. The session playground path shares this shape.
| Status | Type | What it means |
|---|---|---|
| 405 | (message only) | "method not allowed" — only POST serves this path. |
| 400 | (message only) | "failed to read body" / "invalid JSON" — unreadable payload. |
| 400 | invalid_request | "model is required". |
| 400 | invalid_request | "messages must be a non-empty array" — empty arrays are rejected locally so no foreign upstream envelope leaks. |
| 400 | invalid_request_error | "max_tokens must be a positive integer" — present but below 1 or not a number. |
| 401 | invalid_api_key | "missing or invalid API key" (no ar- prefix) / "invalid API key" (unknown or revoked). |
| 402 | insufficient_balance | Available balance cannot cover the reservation. Add funds or reduce the prompt or output cap. |
| 402 | insufficient_quota (+code) | Free atmo/ model without $1.00 lifetime deposits — "free model requires at least $1.00 in lifetime deposits". |
| 403 | model_not_allowed | This key has an allowlist that excludes the model. |
| 404 | model_not_found | Unknown model id. |
| 429 | rate_limit_exceeded | Per-account per-minute budget spent, or "too many concurrent requests…" under a thin balance. No Retry-After — back off. |
| 429 | balance_temporarily_reserved | Other requests are temporarily reserving the balance. Wait for them to finish, then retry; this does not establish that a top-up is required. |
| 429 | rate_limit_exceeded (+free_tier_quota_exceeded) | Promo token quota spent; watch the spelling, tier not free-tier. |
| 429 | rate_limit_error | "upstream rate limit exceeded, please retry shortly" — provider-side limit, retry with backoff. |
| 502 | upstream_error | "upstream unavailable" / "upstream provider error" / "upstream service error" — hold refunded, nothing billed. |
| 503 | upstream_error | "service temporarily unavailable" — a provider 402 mapped here, never a billing state. |
| 503 | availability_error + code: price_limit_unavailable | No qualifying offer was available within your price limits. This rejected request is not charged. Review Budgets or retry later; limits are never raised automatically. |
| 429 / 503, or an SSE error inside HTTP 200 | no_capacity / capacity_saturated | Providers within the effective price ceilings are busy. Follow Retry-After or error.retry_after_seconds. error.retryable is false if the stream has already produced output. |
| 503 | model_route_cooling_down | Repeated connection failures pause the model route. Repeated capacity refusals pause its effective price scope. Follow Retry-After and error.retry_after_seconds. The rejected request is not forwarded or charged. |
| 503 | availability_error + code: pricing_unavailable | Fresh pricing cannot be verified, including official rates needed by a percentage rule. This rejected request is not charged. Retry later; adding funds does not resolve pricing availability. |
| 424 | upstream_error + code: billing_settlement_pending | Generation may already have completed. Accounting is recovering; do not automatically resend. Check Usage before sending another request. X-Should-Retry is false. |
| 502 | upstream_error + code: billing_metadata_unavailable | The model response had incomplete or invalid billing metadata. This response is not charged. |
| 500 | (message only) | "streaming unsupported" — client cannot flush SSE. |
Other upstream 4xx pass through with their original status after sanitization: provider names and hostnames are replaced with neutral wording, and key-like strings become sk-***.
Streaming errors use the same error codes inside SSE events after HTTP headers have been sent. A billing_settlement_pending event must not trigger an automatic replay; inspect Usage first.
Anthropic surface — POST /v1/messages
Envelope {"type":"error","error":{"type","message"}} so Anthropic SDKs parse it. SDK base URL is the bare host, no /v1 suffix.
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "missing or invalid API key"
}
}| Status | Type | What it means |
|---|---|---|
| 405 | invalid_request_error | "method not allowed" — only POST serves this path. |
| 400 | invalid_request_error | Unreadable body, bad JSON, missing model, empty messages, or a missing/non-positive max_tokens — max_tokens is required here, unlike the OpenAI path. |
| 401 | authentication_error | "missing or invalid API key" / "invalid API key". |
| 402 | invalid_request_error | Available balance cannot cover the reservation. Add funds or reduce the request size. |
| 403 | permission_error | "model not allowed for this key" — note the type differs from the OpenAI 403. |
| 404 | not_found_error | Unknown model id — note the type differs from the OpenAI 404. |
| 429 | rate_limit_error | Per-account per-minute budget, thin-balance concurrency, promo-quota refusal message, or upstream limit — all share this type on this surface. |
| 424 | api_error + code: billing_settlement_pending | Generation may already have completed. Accounting is recovering; do not automatically resend. Check Usage before sending another request. X-Should-Retry is false. |
| 502 | api_error + code: billing_metadata_unavailable | The model response had incomplete or invalid billing metadata. This response is not charged. |
| 500 | api_error | "streaming unsupported" — client cannot flush SSE. |
| 502 | api_error | "upstream unavailable" / "upstream provider error" / "upstream service error" — hold refunded, nothing billed. |
| 503 | api_error | "service temporarily unavailable". |
| 503 | api_error + code: model_route_cooling_down | Follow Retry-After or error.retry_after_seconds. Capacity pauses follow the effective input/output ceilings, with customer limits isolated by account. The rejected request is not charged. |
| 503 | api_error + code: price_limit_unavailable / pricing_unavailable | Read error.code to distinguish no offer within your limits from unavailable fresh pricing. Review Budgets for the former; retry later for either. Neither rejection is charged. |
| 429 | rate_limit_error + code: balance_temporarily_reserved | Other requests temporarily reserve your balance. Wait for them to finish before retrying. |
Other upstream 4xx are re-emitted with their original status: scrubbed text wrapped in this envelope, or cleaned JSON passed through unchanged.
Dashboard and Management API — /api/dashboard/…
Envelope {"error":"…"}: a plain string, except the nested signup envelope below. An ar- inference key never works here and answers 401; unknown API paths answer the plain-text 404 page not found.
| Status | Body | What it means |
|---|---|---|
| 405 | "method not allowed" | Wrong method on a dashboard route — login, keys, logout, topup status, epusdt webhook/status, sumopod webhook. |
| 400 | "invalid JSON" / "invalid body" / "unreadable body" | Unparseable dashboard or webhook body. Combos create reports "invalid body" only after auth passes. |
| 400 | "invalid key id" | Key DELETE with a malformed id — not UUID-shaped. |
| 404 | "key not found" | Key DELETE with a well-formed id that is unknown or owned by someone else — scoped DELETE answers identically so ids cannot be probed. |
| 400 | "user_id required" / "invalid id" | Missing user scope or a non-numeric QRIS invoice id. |
| 404 | "topup not found" | Well-formed QRIS invoice id that is unknown or owned by someone else — the scoped read answers identically so ids cannot be probed. |
| 400 | "invalid combo id" | DELETE id not UUID-shaped. |
| 404 | "combo not found" | Well-formed DELETE id that is unknown or owned by someone else — scoped DELETE answers identically so ids cannot be probed. |
| 401 | "invalid credentials" | Login: wrong password, unknown email, or unverified account — identical either way, with a dummy bcrypt comparison so timing matches. |
| 401 | "not authenticated" | Missing or expired session; an ar- Bearer presented as a session cookie is rejected. |
| 401 | "not authenticated" (401, account lookup failed) | Session cookie holds an id that no longer resolves to an account. |
| 403 | "account is pending deletion" (+type) | Session is valid but the account is in the 7-day grace window — cancel deletion to continue. |
| 403 | "current password incorrect" / "password incorrect" | Reset-password or delete-account confirm with the wrong password. |
| 403 | "QRIS payment is disabled" / "affiliate program is disabled" | Admin kill-switch off for that rail or program. |
| 409 | "you already have a withdrawal awaiting processing" | One affiliate payout in flight per user, any method. |
| 410 / 415 / 413 / 403 (signup nested) | {"error":{"code","message"}} | Register/verify only: verification_invalid on expired links, unsupported_media_type, request_too_large, origin_rejected. Signup 429s carry a Retry-After header plus retry_after_seconds. |
| 429 | "too many sign-in attempts …" | Login flood guard spent — 20 per IP plus 8 per account per 15 minutes; Retry-After says when to retry. |
| 429 | "too many webhook calls …" | Provider-callback throttle: 30/min per IP, Retry-After attached. |
| 429 | "wallet withdrawals are limited to … per day" | usdt only, counted per UTC day excluding rejected requests — a rejected request returns its reservation, so a same-day retry is allowed; api_balance is never limited. The number is policy-live (default 1) — the current value is rendered into the body. |
| 500 | "could not start session" / "internal error" / "failed to generate secure key" | Session-store or store failure across the dashboard surface: login, keys list/create/delete (entropy included), usage, deposits, combos create/delete, payouts, topup and epusdt order reserve. Duplicate combo slugs return 409 (the slug is unique per account). |
| 502 | "failed to create payment order" / "failed to create payment" | Provider order creation failed; the reserved order is marked failed — re-create and pay only the newest invoice. |
| 503 | "… not configured …" | Rail checked before field validation: Epusdt, QRIS, or the signup service. |
Deposit and payout shapes beyond errors live where they belong: order lifecycle and idempotency under Billing, payout validation under Affiliate §6.
Webhooks — provider callbacks, not user API
These routes take provider signatures, never user credentials. Integrators only need the non-2xx rows (your server never calls these); the 200 rows matter to webhook operators deciding whether a delivery will be retried. Unknown networks and tokens are terminal non-credits — acked so the provider does not loop the same payload.
| Status | Body | What it means |
|---|---|---|
| 405 | {"error":"method not allowed"} | Non-POST on a webhook path. |
| 429 | {"error":"too many webhook calls …"} | Epusdt/Sumopod throttle: 30/min per IP with Retry-After. |
| 401 | {"error":"bad signature"} / {"error":"unauthorized"} | Epusdt HMAC mismatch — never logged with the expected value; Sumopod Svix/token rejection. |
| 400 | {"error":"invalid JSON"} | Unparseable Epusdt callback body. Sumopod answers 200 ignored parse_failed instead; see Billing for the full ack matrix. |
| 200 | {"status":"ignored"/"rejected"} or plain ok | Epusdt: settleable callbacks ack plain-text ok; non-payable answer 200 JSON with no credit. QRIS answers 200 JSON with a named reason. |
| 500 | {"order_id","status","error"} / {"ok":false,…} | Transient settlement failure — the provider retries. Deterministic rejects stay 200 so the provider does not loop. |
Affiliate — /api/dashboard/affiliate/…
Envelope {"error":"…"}: the same plain string as dashboard. Full validation order and policy numbers live in Affiliate §6 — this table pins the error surface only. Check pending_payout and pending_verification in the summary before requesting: either one means a withdrawal is already live.
| Status | Body | What it means |
|---|---|---|
| 401 | {"error":"not authenticated"} | Missing session, or an ar- key presented as session — only POST creates a payout; other methods return the list, not 405. |
| 400 | {"error":"invalid request"} | Unparseable payout body (4 KB cap). |
| 400 | {"error":"invalid payout method" / "invalid amount"} | Method not usdt/api_balance (trimmed, case-folded); amount ≤ 0, NaN, or infinite. |
| 400 | "minimum withdrawal is … USDC" | Below the live minimum for the selected method — usdt uses min_withdraw, api_balance uses min_withdraw_api_balance (default 0, no minimum) — at the request or re-checked at the confirmation. |
| 400 | "a valid Solana wallet address is required" | usdt address outside 32–44 chars — length only, never verified real. |
| 400 | {"error":"insufficient affiliate balance"} | No wallet, or the atomic reserve found too little — at the request, or the balance fell between the request and the confirmation. |
| 400 | {"error":"invalid or expired payout token"} | Confirmation only: the token is wrong, expired, or already used — one message for all three, deliberately. |
| 400 | {"error":"token is required"} | Confirmation only: the body carried no token. |
| 403 | {"error":"affiliate program is disabled"} | Program kill-switch off. |
| 404 | {"error":"not found"} | Unknown sub-path after auth. |
| 409 | "you already have a withdrawal awaiting processing" | One in-flight payout per user, any method. The request answers it while a payout is in flight; the confirmation answers it when one was created in between. |
| 429 | "wallet withdrawals are limited to … per day" | usdt daily quota per UTC day, evaluated at the confirmation step — rejected requests excluded, so a same-day retry after a reject is allowed; api_balance never limited. |
| 500 | "could not …" | Store failure: prepare referral code, load referrals/payouts/ledger, start or record payout. |
Retry guidance
Retry 429, 502 and 503 with exponential backoff. When a 429 carries a Retry-After header (login, step-up checks and webhooks send one), wait that many seconds instead of guessing. Inference and playground 429s carry no such header, so back off there. Do not retry 400, 401, 403 or 404, as they will fail identically until you change the request. Treat 402 as an alert to top up rather than a transient fault.
import time
from openai import OpenAI, APIStatusError
def call(**kw):
for attempt in range(5):
try:
return client.chat.completions.create(**kw)
except APIStatusError as e:
if e.status_code in (429, 502, 503) and attempt < 4:
# Honor Retry-After where the gateway sends one; otherwise back off.
time.sleep(float(e.response.headers.get('Retry-After', 2 ** attempt)))
continue
raise{"type":"error","error":{...}} so Anthropic SDKs parse it, and its base URL carries no /v1 suffix.429, 502 and 503 with exponential backoff. 402 means your balance is empty, so top up instead of retrying. Never retry 400, 401, 403 or 404.502 / 503) settle with no usage report, so no balance is deducted. Billing happens only for requests that settle with token counts.