Why does a chat return 402 insufficient_credits when my balance is still positive?
Why does a chat return 402 insufficient_credits when my balance is still positive?
BeatAPI estimates the maximum cost of a text request from max_tokens before forwarding the request to the model. When a roleplay preset sends a large max_tokens value such as 32000, 65536, or 128000, BeatAPI’s pre-check can exceed a small positive USD balance and return 402 insufficient_credits even if the actual reply would be short.
How to fix it
- Lower
max_tokens(Max Response Length) in your client preset:- Standard roleplay dialogue: set
2000–4096. - Reasoning models: set
4096–8192. - When your balance is under a few dollars, avoid setting JanitorAI’s Max new tokens to
0(unlimited) or maxing out SillyTavern’s response slider.
- Standard roleplay dialogue: set
- Check the API key’s own quota cap: A
402 insufficient_creditsbody containingThis API key's remaining quota is below the price of this requestmeans that specific key hit its quota limit in Dashboard → API Keys, even when total account balance is higher. Raise that key’s quota or switch keys. - Verify the selected model ID: Flagship models charge higher output rates per million tokens, so a
65536-token pre-check reserves a larger balance than a flash-tier model. Check the active model ID against the pricing page.
Cost benefit of capping max_tokens
Output tokens cost three to five times more than input tokens on most text models. Setting max_tokens to the reply length you actually need keeps small balances past BeatAPI’s pre-check and caps runaway outputs.

