Errors
402 insufficient balance
The key is valid and the request is valid; the prepaid balance reached zero. This is a billing state, not a transient error — and it is the only error that stays broken until a human does something.
What causes it
- A batch job consumed the remaining balance.
- Another key on the same account spent it — balance is shared at the account level.
- Nobody noticed the low-balance threshold because nothing alerted.
How to fix it
- Top up from the console: USDT (TRON or Solana), card via Creem, or Alipay / WeChat via EasyPay.
- Retry after the payment is credited — do not loop, and do not treat 402 like 429.
- Add an alert on the first 402 rather than on the hundredth.
How to not hit it again
# cheap guard: warn before the balance is empty
curl -s https://todapi.work/v1/usage \
-H "Authorization: Bearer $TODAPI_KEY"
Alert when spend over the last 24 hours exceeds your expected baseline, or when the balance drops below a day of average spend. A budget alarm is cheaper than an outage.
Why retrying is the wrong reflex
A retry loop against an empty balance produces no tokens, no revenue and a lot of noise in logs. If your client retries 5xx and 429 automatically, make sure 402 is excluded — most SDKs treat 4xx as permanent, but hand-rolled retry wrappers often do not.
FAQ
Is 402 a rate limit?
No. A rate limit clears on its own; a balance does not.
Will my keys keep working after top-up?
Yes — the block is a balance condition, not a revocation. Once the credit lands, the same key serves requests again.