Google Gemini API error
Gemini API 402 RESOURCE_EXHAUSTED: what it means and how to fix it
402 RESOURCE_EXHAUSTEDRetry? NoLast verified 2 documented fixes2 sources
What it means
generateContent API: your Prepay credit balance is depleted, so every API key linked to that billing account stops working.
Causes
- The billing account ran out of Prepay credits
How to fix it
- Fix 1.
Add credits to your billing account, or turn on auto-reload.
- Fix 2.
Do not retry this request: it will not succeed until credits are added.
More Gemini API errors
All 30 Gemini API errorsHTTP 402 at other providers
402 billing_errorRetry? Not statedAnthropic API402 Payment RequiredRetry? Not statedCohere API402 - Insufficient BalanceRetry? Not statedDeepSeek API402 Payment requiredRetry? Not statedMistral API402 payment_requiredRetry? NoOpenRouter402 in_flight_budget_exhaustedRetry? YesOpenRouter402 weight_exceeds_budgetRetry? NoOpenRouter
FAQ
What does the Gemini API error "402 RESOURCE_EXHAUSTED" mean?
generateContent API: your Prepay credit balance is depleted, so every API key linked to that billing account stops working.
How do I fix Gemini API "402 RESOURCE_EXHAUSTED"?
There are 2 documented fixes. Start with the first: Add credits to your billing account, or turn on auto-reload.
Should I retry Gemini API "402 RESOURCE_EXHAUSTED"?
No. The official docs treat this error as not retryable: fix the cause before sending the request again.
Which other AI APIs return HTTP 402?
Per their official error docs: Anthropic API (402 billing_error), Cohere API (402 Payment Required), DeepSeek API (402 - Insufficient Balance), Mistral API (402 Payment required), OpenRouter (402 payment_required; 402 in_flight_budget_exhausted; 402 weight_exceeds_budget).
Sources
Last verified against 2 sources: Gemini API's official docs and official SDK repositories.
Newsletter
Know when the APIs change
One email per week. New model releases, API changes, what broke, and how developers are working around it.