ThinkFacility

Error messages

This request requires more credits, or fewer max_tokens.

The message

This request requires more credits, or fewer max_tokens.
OpenRouter as of September 26, 2026 read September 26, 2026OpenRouter402

What it means

Before running a request, OpenRouter reserves enough credit to pay for the longest reply you allowed. Your balance (or your key's limit) can't cover that reservation, even if it would cover the reply you'd actually get.

What to do

Set max_tokens at or below the number after "can only afford", or add credits. If the account has money, check whether the API key has its own credit limit.

The first sentence is fixed. The numbers after it are yours:

This request requires more credits, or fewer max_tokens. You requested up to 16000 tokens, but can only afford 15154. To increase, visit https://openrouter.ai/settings/credits and add more credits

It's an HTTP 402. The newer error bodies carry a hint and a source field too, as in this September 2026 report:

"metadata": {
  "limit_source": "openrouter_credits",
  "remedy_hint": "Add credits at https://openrouter.ai/settings/credits, or lower max_tokens / prompt size to fit your remaining balance."
}

Why a small request can fail

OpenRouter charges when a request finishes, so it holds money up front. Its limits page says it estimates each paid request's cost from "the input tokens, plus the completion tokens allowed by max_tokens." If you allowed 16,000 tokens of reply, it prices all 16,000, even if the model would have written 300.

That makes the numbers in the message easy to read. "Requested up to 16000" is your max_tokens. "Can only afford 15154" is how many reply tokens your remaining credit covers at this model's price. The gap between them is the whole problem.

When you never set max_tokens

This catches people whose tools don't send a limit at all. The limits page says a fixed cap is used "when max_tokens is not set," and an oh-my-pi bug from August 2026 shows what that means in practice. A user running GPT-5.6 Luna saw "You requested up to 65536 tokens", but the tool hadn't asked for 65,536. The project's investigation found that OpenRouter "runs its pre-flight credit check against the model's default max output (65536 for Luna)" when no cap is sent. The same account, at the same moment, ran a title-generator call with max_tokens set to 1024 without trouble.

Three places the limit can come from

The fix

Set max_tokens explicitly and keep it under the "can only afford" figure (in a tool, look for a "max output tokens" or similar setting). If you'd rather not cap replies, add credits until the reservation fits.

Don't just retry. OpenRouter says for the single-request case that "retrying will not help," and none of the major SDKs retries a 402 on its own anyway. A tool that swallows the error in a retry loop will keep failing until one of those numbers moves.

Other lines the same feature prints

Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.

  • 402 This request requires more credits, or fewer max_tokens. You requested up to 65536 tokens, but can only afford
  • You requested up to 16000 tokens, but can only afford 15154. To increase, visit https://openrouter.ai/settings/credits and add more credits
  • "limit_source":"openrouter_credits"
  • payment_required