#402 error despite having enough credits

3 messages · Page 1 of 1 (latest)

leaden pilotBOT
#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

To help debug this issue, I need a bit more information:

  • Can you share the exact API request you're making (including your max_tokens and any other relevant parameters, but please remove your API key)?
  • Is your $12.00 balance in regular credits, or are there any promotional/trial credits involved?
  • Are you using any additional features (like image inputs or special output settings) that might increase costs?

These details will help pinpoint why you're getting a 402 error despite your credit balance.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.

The author you are looking for could not be found.

#

Thanks for the details. Based on current pricing for google/gemini-2.5-pro ("Starting at $1.25/M input tokens, starting at $10/M output tokens") and regular credits, $12 should be enough for many requests at your token size.

However, this error usually means one of the following:

  1. The API calculates the maximum possible cost if you use all allowed output tokens (max_tokens).

    • Even if you only input 1160 tokens, if you set max_tokens to a high number (like "unlimited"), the API assumes you could consume the maximum allowed, and checks if your credits cover the worst-case cost.
    • Example: If you set max_tokens to a very high value, the system may require enough credits for input + max output, even if you won't use them all.
  2. To resolve this:

    • Set max_tokens to a lower explicit value that matches your expected output length (e.g., 500, 1000, etc.), instead of "unlimited."
    • Try a request with max_tokens set to 1000 and see if it works.

As quoted in the OpenRouter API docs: "You requested up to 8000 tokens, but can only afford 2045. To increase, visit https://openrouter.ai/settings/credits and upgrade to a paid account" – the system checks what you “could” spend, not what you “will” spend in a single request. This is a common pattern for preventing accidental large charges.

See pricing and cost calculation details at OpenRouter Models and Gemini 2.5 Pro.

If you keep running into this after reducing max_tokens, please contact the mods in Discord for manual review.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.

OpenRouter

Browse models on OpenRouter

The model you are looking for could not be found.

small oracle
#

Where do you have $12,000 in credits? At Google or with open router?