Insufficient Quota, 402 Payment Required & Other API Billing Errors
Every call to the Claude or GPT API suddenly dies with "insufficient quota", "credit balance is too low", or a bare 402 Payment Required. These are billing errors: the provider rejected the request before the model ever ran. Here is what each variant means at the official providers versus an AI API gateway like byesu, how to check what you have left, and how to keep a runaway script from draining the balance.
Quick answer
A billing error means your prepaid credits, monthly limit, or per-key quota ran out — the request is refused before inference, so blind retries change nothing. Read the error body to learn whether the account balance or a single token's quota cap is exhausted, then top up or raise the cap. On byesu you can check remaining balance any time in the console or on the public key balance page — no login needed.
Symptoms: What the Error Looks Like
Every provider wraps "you are out of funds" differently:
| Where | HTTP status | Typical message |
|---|---|---|
| Anthropic (official) | 400 invalid_request_error | "Your credit balance is too low to access the Anthropic API…" |
| OpenAI (official) | 429 insufficient_quota | "You exceeded your current quota, please check your plan and billing details." |
| Gateways & other APIs | 402 / 403 | insufficient quota, INSUFFICIENT_BALANCE, quota is not enough |
Two traps hide in that table. OpenAI's insufficient_quota arrives as a 429 — the same status as a rate limit — so a naive backoff loop retries a billing failure forever. Anthropic's arrives as a 400, which looks like a malformed request even when your JSON is perfect. The lesson: classify billing errors by the error body, never by status code alone.
Common Causes
- Prepaid credits ran out — official Anthropic and OpenAI accounts are prepaid or hard-capped; at zero, everything stops.
- A per-token quota cap was hit — on byesu, each token can carry its own spend allowance; the account may still hold balance while one capped key is spent.
- A monthly spend limit triggered — org-level budgets behave exactly like an empty balance until the month rolls over.
- A top-up was not credited — crypto payments must match the exact amount shown on the payment page; a mismatched amount waits for manual review.
- Wrong account, or a race — a key from an unfunded workspace fails regardless of other accounts, and concurrent long generations can push a small balance to zero at settlement.
Fixes, One by One
1. Read the error body, not just the status code
Use -i (or your SDK's raw error) so you see both status and body:
curl -i https://byesu.com/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.5",
"messages": [
{"role": "user", "content": "Reply with the single word: pong"}
]
}'If the body mentions quota, balance, or billing, it is a money problem — continue below. Invalid token or no available channel are different failures; see Common Errors.
2. Check how much you actually have left
- Console — the byesu console dashboard shows the account balance and per-token usage in real time.
- Public balance page — paste one or more
sk-keys into byesu.com/media/query.html to see remaining quota without logging in. - Programmatically — the OpenAI-compatible billing endpoint reports the allowance left on that key:
curl https://byesu.com/dashboard/billing/subscription \
-H "Authorization: Bearer sk-YOUR_TOKEN"3. Work out which layer is empty: account or token
byesu has two layers: the account balance, shared by all your tokens, and an optional per-token quota cap. If the balance page shows funds remaining but one key keeps failing, that key has hit its own cap — open Console → Tokens and raise it or set the token to unlimited. Official APIs lack this layering: one credit pool backs every key.
4. Top up if the balance itself is empty
Top up with USDT, Alipay or WeChat Pay in the console. For crypto, pay exactly the amount shown on the payment page — if you sent a different amount, screenshot the payment record and contact support to have it credited manually.
5. Handle billing errors in code — never blind-retry
Billing failures are not transient, so route them to a human instead of a retry loop:
from openai import OpenAI, APIStatusError
client = OpenAI(api_key="sk-YOUR_TOKEN", base_url="https://byesu.com/v1")
def ask(prompt: str) -> str:
try:
resp = client.chat.completions.create(
model="grok-4.5",
messages=[{"role": "user", "content": prompt}],
)
return resp.choices[0].message.content
except APIStatusError as e:
body = e.response.text.lower()
if e.status_code == 402 or "quota" in body or "balance" in body:
# Billing problem: alert a human, do NOT retry in a loop
raise RuntimeError("Out of quota: top up or raise the token cap") from e
raise # real rate limits and 5xx can go to your normal retry logic
print(ask("Summarize the difference between HTTP 402 and 429 in two sentences."))Preventing Overspend on Pay-As-You-Go
Pay-as-you-go means no surprise subscription renewals, but spend tracks usage — so add guardrails:
- Cap every production token. A quota cap is a hard budget: the key stops at its allowance instead of draining the account.
- One token per app or environment. The usage log then shows exactly which service overspent, and revoking one key kills only that service.
- Mind the output multiplier. byesu bills with public group multipliers — input 1x, output 5x, cache hit 0.1x — so long generations dominate cost while cached context is nearly free. The console shows your live billed price next to the official list price.
- Review usage logs weekly. Five minutes in the console catches a misbehaving cron job before it matters.
Balance Semantics: Official APIs vs a Gateway
At the official providers, every vendor is its own silo: Anthropic credits cannot pay an OpenAI invoice, and each account fails independently — often in a different error format, as the table above shows. byesu is an AI API gateway with OpenAI-compatible and Anthropic-native endpoints, so one pay-as-you-go balance and one sk- key cover Claude, GPT-5.6, Grok, Gemini and more. That consolidation simplifies billing errors too: whichever model you call, "out of funds" surfaces as the same explicit message, one console shows what is left, and the same token caps enforce your budget across all models at once.
Related Links
- Common Errors & Fixes — 401, no available channel, timeouts and more
- Key Balance Query Page — check remaining quota with just a key
- Quick Start (3 steps) — create a token · set the address · pick a model
- Console — balance, usage logs, and live billed prices
FAQ
Why does the Anthropic API say my credit balance is too low?
The official Anthropic API is prepaid. When your credit balance reaches zero, every request fails with an HTTP 400 invalid_request_error saying the balance is too low. Add credits in the Anthropic Console, or route calls through a gateway such as byesu, where one pay-as-you-go balance covers Claude, GPT-5.6, Grok and Gemini.
Is 402 Payment Required the same as the insufficient_quota error?
They mean the same thing — no remaining funds or quota — but the wire format differs. Some services return the semantically correct HTTP 402, OpenAI returns 429 with the code insufficient_quota, and Anthropic returns 400. Always check the error body, not just the status code, before deciding whether to retry.
How do I check my remaining balance on byesu?
Open the byesu console to see your live balance and per-token usage, or paste your sk- key into the public balance page at byesu.com/media/query.html. The page calls the same billing endpoint your key already has access to, so no login is needed.
How do I stop one API key from spending my whole balance?
Set a quota cap on the token in Console → Tokens. A capped token stops working once it has spent its allowance, so a runaway script or a leaked key cannot drain the whole account. Use one capped token per app or environment.
I topped up but still get an insufficient quota error — why?
Crypto top-ups must be paid in the exact amount shown on the payment page; a different amount is not credited automatically. If you paid the wrong amount, take a screenshot of the payment record and contact support. Also confirm the token you are calling with has not hit its own quota cap.
