is now an ernd partner: 10% back on inference

The AI spend playbook

OpenRouter 402 "Your account or API key has insufficient credits"

OpenRouter returns 402 when a paid request can't be covered. The cause is your account balance, the API key's own credit limit, or the budget for requests still in flight.

By erndChecked 2 min read

Request your ernd card

4% back on AI vendor spend
For US companies

The short answer

Read the error code, restore access in the provider dashboard, then check your payment setup. Card rewards are separate from the fix.

In this guide

What does the error mean?

OpenRouter’s errors page describes a 402 as Your account or API key has insufficient credits. Add more credits and retry the request. The error type is payment_required.

The response body says which limit you hit. Look at error.metadata.limit_source.

limit_sourceWhat happenedRetry?
openrouter_creditsYour balance can’t cover the request, or one request costs more than your whole in-flight budgetNot until you add credits or shrink the request
openrouter_in_flight_budgetRunning and recently finished requests filled the in-flight budgetYes, after the Retry-After header
openrouter_key_limitThe API key’s own credit limit is used upNot until the key’s limit resets or goes up

Codes as listed on OpenRouter’s Limits page, checked November 5, 2026.

The in-flight case carries the message This request would exceed your available credits given your current in-flight requests. It’s the only 402 worth retrying unchanged.

Your AI bill, with ernd

What could your AI bill earn?

USD
$4,800

back a year at 4%

Request your card

For US companies. No annual fee. Illustration based on AI vendor spend only. Rewards are points redeemable as cash back.

How do you fix it?

  1. Log error.metadata.limit_source and remedy_hint. Branch your code on the source and leave the hint for people reading logs.
  2. For openrouter_credits, add credits at openrouter.ai/settings/credits until the balance is above zero.
  3. If the balance is fine, lower max_tokens or trim the prompt. The up-front estimate counts input tokens plus every token max_tokens allows, or a fixed cap when max_tokens isn’t set.
  4. For openrouter_in_flight_budget, wait for Retry-After and send it again. More credits also raise this budget, up to a ceiling.
  5. For a key limit, raise the key’s credit limit in the dashboard or wait for its daily, weekly or monthly reset at midnight UTC. Some key and budget limits come back as a 403 with Key limit exceeded instead, so check both codes.

How do you keep it from coming back?

Turn on auto top-up on the credits page so the balance refills below a threshold. Then set the low balance alert. It’s on every plan, goes out by email and defaults to $100.

Put a credit limit on every key, especially ones an agent uses. OpenRouter recommends it, since a key with no limit can spend the whole balance, auto top-ups included.

You can also check GET /api/v1/key from your own monitoring to see limit_remaining before requests fail. ernd is a card for AI spend that earns 4% back, a good fit for whatever pays for the top-ups.

The ernd card

Once your billing is back on track.

The card earns rewards on AI spend. It does not bypass provider quotas, fix account restrictions or change provider prices.

Request your card

The ernd card is a credit card for US companies, with partners across the AI stack built in.

Common questions.

Why do I get a 402 on OpenRouter with money in my account?

OpenRouter estimates each paid request's cost up front, counting the full max_tokens. If that estimate doesn't fit your balance or your in-flight budget, it rejects the request before it reaches a provider. Lower max_tokens or wait for running requests to settle.

Can a negative OpenRouter balance block free models?

Yes. OpenRouter's limits page says a negative balance can cause errors even on free models, and adding credits to get back above zero fixes it.

Do OpenRouter SDKs retry a 402 on their own?

No. None of the OpenAI, Anthropic, Vercel AI or OpenRouter SDKs retries a 402 automatically. For the in-flight case, catch it, read Retry-After and retry yourself.

Sources & methodology

Checked . Providers change prices and terms; the linked official page is the final word. This guide is published by ernd.

Make your next AI bill work a little harder.

4% back on AI vendor spend. Partner perks across your stack.

Request your card

ernd isn't affiliated with OpenRouter.