On this page
An OpenRouter 402 means your balance, your API key’s credit limit or your in-flight spending budget can’t cover the request. Check error.metadata.limit_source, then add credit, raise the key’s limit, wait for Retry-After, or lower max_tokens. Tired of topping up at all? Off Grid AI Boost is a flat plan from $4.99 a month with usage worth twice the price.
What the 402 is telling you
OpenRouter’s error docs define 402 as: “Your account or API key has insufficient credits. Add more credits and retry the request.” The limits docs add the detail. There are three places the shortfall can be, and the error names the one you hit in error.metadata.limit_source:
limit_source |
What ran out | Will retrying help? |
|---|---|---|
openrouter_credits |
Your account balance can’t cover the request, or this one request’s estimate is bigger than your whole in-flight budget | No. Add credit or shrink the request |
openrouter_key_limit |
The credit cap set on this API key | No, until you raise the cap or it resets |
openrouter_in_flight_budget |
Requests you have running or just finished are holding your budget | Yes. Wait for Retry-After, then retry |
Every 402 with a limit_source also carries a remedy_hint, a one-line next step for people reading logs. OpenRouter says to branch your code on limit_source, not on the hint text.
Why a positive balance still gets a 402
OpenRouter charges a request when it finishes. To stop parallel requests spending more than you have, it estimates each paid request’s cost up front and holds it against your account while the request runs. For chat, the estimate is your input tokens plus the output tokens max_tokens allows, up to a fixed per-request cap. Leave max_tokens unset and the cap is used, so the hold can be far bigger than what the model writes.
The total it will hold at once is your in-flight spending budget, a fraction of your balance up to a fixed ceiling. It only applies to some prepaid accounts: those with a balance under a threshold and, while it rolls out, newer accounts. Free models, BYOK-only requests, and enterprise, subscription and invoice-billed accounts aren’t subject to it.
Fix it in five steps
- Read the error body. Log
error.metadata.limit_sourceandreason. That decides everything below. -
Check the key. Call
GET https://openrouter.ai/api/v1/key.limit_remainingis what’s left on this key’s cap, andlimit_resetsays whether it resets daily, weekly, monthly or never.curl https://openrouter.ai/api/v1/key \ -H "Authorization: Bearer $OPENROUTER_API_KEY" - Set
max_tokens. Give every request a realisticmax_tokens, for example 2,000 for a chat reply instead of the model’s maximum. This is the fix forreason: "weight_exceeds_budget". - Add credit, or turn on auto top-up. On the credits page, buy credit or set auto top-up, which refills your balance when it drops below a threshold you choose (FAQ). A bigger balance also raises your in-flight budget, up to its ceiling.
- Retry only the transient one. If
limit_sourceisopenrouter_in_flight_budget, wait the seconds inRetry-Afterand resend. OpenRouter notes that SDKs which honourRetry-Afterstill won’t retry a 402 on their own, so add the retry yourself.
Symptom, check, fix
| Symptom | Check | Fix |
|---|---|---|
| 402 on every request | GET /api/v1/key and your balance on the credits page |
Add credit so the balance is above zero |
| 402 on one key, other keys work | limit_remaining on that key is 0 |
Raise the key’s credit limit, or wait for limit_reset |
| 402 with money in the account, only under load | limit_source is openrouter_in_flight_budget |
Wait for Retry-After, then retry. Run fewer requests at once |
| 402 on one big request, small ones work | reason is weight_exceeds_budget |
Lower max_tokens, trim the prompt or send fewer images |
| Free models stopped working too | Balance is negative | Add credit to bring it above zero |
| Agent dies overnight with 402 | No auto top-up, or the threshold is too low | Turn on auto top-up, or move to a flat plan |
| You top up so often the fees add up | Count top-ups on your billing history | Top up less often in bigger amounts, or move to a flat plan |
What topping up really costs
OpenRouter charges 5.5% on every credit purchase, with a $0.80 minimum. Small top-ups pay the most. A $5 top-up pays $0.80, which is 16%.
For example, say a coding agent burns $80 of credit a month and you top up $20 at a time. Each top-up carries 5.5% × $20 = $1.10 in fees. Four a month is $4.40, or $52.80 a year, before a single token.
| Option | How you pay | Price | Status |
|---|---|---|---|
| OpenRouter | Credits, 5.5% fee ($0.80 minimum) | Each model’s per-token price | Live |
| NanoGPT PRO | Fixed monthly | $12, with 60M input tokens a week | Live |
| Synthetic | Fixed monthly | $9, $30 or $90, weekly credit limits | Live |
| Hugging Face PRO | Subscription, then per token | $9 with $2 of credit, no fee on provider rates | Live |
| Featherless Chat | Fixed monthly | $25, interactive use only, no app traffic | Live |
| Off Grid AI Boost | Fixed monthly or yearly | $4.99, $9.99 or $49.99 (first cohort). Flat plan, usage worth 2x the price | Pre-order, key in January 2027 |
OpenRouter still wins on choice. It routes to more models than any plan above, and if your use is small and uneven, paying per token can cost less than any monthly plan. Stay on it for that, and set max_tokens plus auto top-up so the 402 doesn’t come back.
Stop topping up
Off Grid AI Boost gives you one OpenAI-compatible key for open models. You change one base URL in any OpenAI SDK or tool. The page names Qwen 3.8 and DeepSeek V4.1 Flash, and more.
- One flat price. Starter $4.99, Pro $9.99, Max $49.99 a month in the first cohort, half the regular $9.99, $19.99 and $99.99, for as long as you stay. Yearly costs ten months’ price.
- Usage worth twice what you pay, counted at each model’s token rate and refilled every month. Need more in a busy month? Top up.
- No prompts kept. We don’t keep your prompts or train on them.
- A pre-order. You pay now, your key arrives by email in January 2027, and your plan starts that day. If we miss January, you get all your money back.
Need a fixed bill today? NanoGPT PRO is live now. More plans are in OpenRouter alternatives with a monthly subscription, and every price is on the open-model API prices page. If you’re also hitting rate limits, see how to fix OpenRouter 429 rate limit exceeded.
FAQ
What does OpenRouter error 402 mean?
Your account or API key doesn’t have enough credit for the request. The error’s metadata.limit_source says which: openrouter_credits (your balance, or a request too big for your budget), openrouter_key_limit (the key’s own cap) or openrouter_in_flight_budget (too much spend already running).
Why do I get a 402 when my OpenRouter balance is positive?
OpenRouter reserves each paid request’s estimated cost up front, counting max_tokens. If your running and recently finished requests fill your in-flight budget, or one request’s estimate is bigger than the budget, you get a 402 with money still in the account.
Does lowering max_tokens fix an OpenRouter 402?
Often, yes. OpenRouter’s estimate covers input tokens plus the output allowed by max_tokens, up to a fixed cap when max_tokens isn’t set. A lower max_tokens shrinks the estimate so it fits your balance and budget.
How much does OpenRouter charge to top up credits? 5.5% of each purchase, with a $0.80 minimum. So a $5 top-up carries a $0.80 fee, and a $20 top-up carries $1.10. Crypto payments carry a 5% fee.
Is there an open-model API with a flat monthly bill instead of credits? Yes. Off Grid AI Boost starts at $4.99 a month with usage worth $9.99, on one OpenAI-compatible key. It’s a pre-order with keys in January 2027. NanoGPT PRO at $12 a month is a flat plan you can use today.