top of page

Gemini API 402 "prepayment credits are depleted" even with a balance: every cause and fix

5 minutes ago
9 min read
Gemini API 402 prepayment credits are depleted error explained, with the Gemini logo over a city skyline. Data Studios original cover

Last verified: November 23, 2026


When the Gemini API stops answering and every request comes back with HTTP 402 and the message "Your prepayment credits are depleted", Google is telling you that the Prepay wallet attached to your project has no usable money in it. The usual fix is to buy Prepay credits on the Google AI Studio Billing page, or turn on auto-reload, and wait for the purchase to be confirmed. Retrying the same request will not help, because Google treats 402 as an error that needs a billing change before anything works again.


The confusing cases are the ones where the developer is sure there is money available: a funded Google Cloud billing account, Google Developer Program credits, a bank transfer sent days ago, or a balance that AI Studio itself shows as positive. Most of these have a documented explanation, since Google keeps the AI Studio Prepay balance separate from other Cloud money and applies some credits only after a Prepay purchase. The error affects projects on the Prepay plan, which has been the default for new Gemini API billing accounts since Google began moving users to its new Prepay system on March 23, 2026, and it has carried the 402 code since September 18, 2026.


··········


THE GEMINI API 402 ERROR MESSAGE AND WHERE IT APPEARS.


Google announced on its developer forum on September 18, 2026 that requests failing because a project's prepayment credits are depleted would return HTTP 402 Payment Required instead of HTTP 429 Resource exhausted. The company said the change separates retriable errors from errors that need the developer's attention, and that other rate-limit errors keep returning 429. The response body published in that announcement looks like this, with the status field still reading RESOURCE_EXHAUSTED even though the HTTP code is now 402:


{
  "error": {
    "code": 402,
    "message": "Your prepayment credits are depleted. Please go to AI Studio at https://ai.studio/projects to manage your project and billing. Learn more at https://ai.google.dev/gemini-api/docs/billing#prepay.",
    "status": "RESOURCE_EXHAUSTED"
  }
}

The same failure shows up in different places depending on how you call the API: as a 402 error in your SDK or HTTP client, as a failed call in tools and agents that use your API key, and as a red "No credits" label next to the project on the AI Studio Projects page, where other projects may show "Set up billing" or "Set up Prepay". Threads written before mid-September quote the same message with a 429 code, so older forum answers about "429 prepayment credits are depleted" describe the same condition. In Google's API error table the 402 row is listed as payment_required, with the description "Your Prepay credit balance is depleted."


A detail that surprises many developers is the scope of the stop. Google's billing documentation says that when the Prepay balance reaches zero, all API keys in all projects linked to that billing account stop working at the same time, and requests fail with 402 until credits are added. The projects are not moved back to the Free tier, so free-tier quotas do not take over in the meantime.


··········


WHY THE GEMINI API SAYS YOUR PREPAYMENT CREDITS ARE DEPLETED.


The table lists the causes that Google's documentation or Google's forum staff describe, plus the case that remains reported by users without an official explanation.


........


Cause

How to check

Fix

Prepay balance used up or never funded

AI Studio Billing page shows zero available credits; project shows "No credits"

Select Buy credits (minimum $5) or set up auto-reload

Payment not yet confirmed

Purchase made by bank transfer or still pending in your payment method

Wait: Google says services resume only after the purchase is confirmed, and bank transfers can take several days

Money sits in Google Cloud Billing, outside the AI Studio Prepay wallet

Cloud console shows a prepayment or credit, AI Studio Billing shows zero

Buy Prepay credits in AI Studio; ask for a refund of the Cloud payment if you no longer need it

Google Cloud or Developer Program credits waiting for a Prepay purchase

Credits visible in Cloud Billing, AI Studio balance at zero

Make a Prepay purchase first; Google says eligible credits apply only after that

Credits expired

Credits bought more than 12 months ago

Buy new credits

Missed payment on the Cloud Billing account

Cloud console shows an overdue or failed payment

Settle the payment; Google says the Gemini API is suspended regardless of Prepay balance

Prepay setup canceled or left incomplete

AI Studio shows "Prepay billing is required for this account" or "Set up Prepay"

Complete the setup, or contact Cloud Billing Support

Positive AI Studio balance, 402 continues

AI Studio shows credits and the project still fails on every model

Retest, then report on the forum or to Cloud Billing Support; no fix published


........


··········


FIXING THE GEMINI API 402 ERROR STEP BY STEP.


Start with the AI Studio Billing page rather than the Google Cloud console, because the balance that the Gemini API checks is the Prepay credit balance shown in AI Studio. A Cloud Billing account can be fully funded while that wallet is empty.


When the balance is simply at zero, the fix takes a few minutes:


1. Open Google AI Studio, go to the Billing page and select Buy credits. Google's minimum purchase is $5 and the maximum amount you can prepay is $5,000.


2. Pay with a method that clears quickly. Google says usage is drawn down from credits within minutes, while bank transfers may take several days to clear, and that services resume only after the purchase is officially confirmed.


3. Confirm that the "No credits" label has disappeared from the project on the Projects page, then send one test request before restarting batch jobs or agents.


4. To avoid a repeat, open the "Available credits" card on the Billing page, choose to set up auto-reload and set a monthly limit for automatic top-ups.


When the money was paid in the Google Cloud console, the situation is different. In a November 16, 2026 reply on the Google AI Developers Forum, a Google representative wrote that there is no sync issue between Cloud Billing and the AI Studio Prepay bucket, that Google cannot start manual syncs, and that prepayments made under Postpay cannot be used for Gemini API requests once the account is on Prepay. The steps Google gave were these:


1. Restore access by buying Prepay credits on the AI Studio Billing page.


2. If you want the earlier Cloud payment back, request a refund on the Payment overview page in the Google Cloud console, or open a case with Cloud Billing Support.


When the credits come from Google Cloud promotions or the Google Developer Program, a September 29 staff answer on the same forum said these credits cannot be applied to Gemini API usage until the AI Studio prepaid wallet has an active, positive balance, and that the minimum prepayment is needed first. Google's billing page adds that Prepay users must buy Prepaid credits before eligible Cloud credits apply, and that the Cloud welcome credit cannot be used for the Gemini API on accounts opened after March 2, 2026.


When the Cloud Billing account itself has a problem, such as a missed payment, Google's documentation says the Gemini API is suspended regardless of how many Prepaid credits are available. Fix the payment in the Cloud console first; buying more Prepay credits will not lift that suspension. If AI Studio keeps showing "Prepay billing is required for this account" or a "Set up Prepay" prompt, Google's billing FAQ treats a canceled or incomplete Prepay setup as a reason linked projects stop working, and the fix is to finish the setup or contact Cloud Billing Support.


Developers who were on Postpay should check which plan the billing account is on now. Google documents moving from Postpay to Prepay with a "Switch to Prepay" option, but says switching from Prepay back to Postpay is not supported. An account that moved to Prepay starts failing with 402 as soon as its Prepay wallet is empty, even if Postpay invoices were always paid.


··········


GEMINI API 402 VERSUS 429: WHICH ONE TO RETRY.


The September change exists so that client code can tell a billing stop from a temporary limit. Google's troubleshooting page, last updated October 27, 2026, says not to retry client errors such as 400, 402 or 403, because they point to invalid API keys, depleted Prepay credits or bad syntax, and to retry only transient errors (429, 408 and 5xx) with exponential backoff, jitter and a maximum number of attempts.


........


HTTP code

What it means in the Gemini API

Retry?

What to do

402

Prepay credit balance depleted (payment_required)

No

Add credits or turn on auto-reload

429

Per-minute, per-second or daily limit reached

Yes, with backoff

Wait, slow down, or raise your tier

403

Permission denied

No

Fix the key, project or permissions

503

Model temporarily overloaded

Yes, with backoff

Retry later or switch model


........


Older retry wrappers written before September 18 often treat every RESOURCE_EXHAUSTED status as retriable. Because the 402 body still carries that status string, such code can keep retrying a request that will never succeed. The illustrative Python sketch below, written for this page and not taken from Google's documentation, shows the logic Google describes: branch on the HTTP code, stop on 402, back off only on transient codes.


# Illustrative only: decide whether a failed Gemini API call should be retried
RETRY_CODES = {408, 429, 500, 502, 503, 504}
STOP_CODES = {400, 402, 403}

def should_retry(http_status: int) -> bool:
    if http_status in STOP_CODES:
        return False  # 402: add Prepay credits before trying again
    return http_status in RETRY_CODES

A 402 is also a good trigger for an alert, since every key on the same billing account fails at the same moment. Our page on Gemini API rate limits, tiers and 429 errors explains the 429 side in detail, and the Gemini API 503 high-demand error page covers the overload case.


··········


WHAT GOOGLE DOCUMENTS ABOUT PREPAY ERRORS AND WHAT DEVELOPERS REPORT.


........


Point

Status

Depleted Prepay credits return 402 since September 18, 2026

Announced by Google on its developer forum

All keys on the linked billing account stop at zero balance

Google billing documentation

Cloud Billing payments do not fund the AI Studio Prepay balance; no manual sync

Google staff answer, November 16, 2026

Cloud and Developer Program credits apply only after a Prepay purchase

Google billing documentation and staff answer

Bank transfers can take several days before service resumes

Google billing documentation

402 with a positive balance shown in AI Studio

Reported by several users; no cause or fix published


........


The last row is the one without an answer. Threads from October 5, October 9 and November 22, 2026 describe projects on Tier 1 Prepay that show a positive balance in AI Studio, with recent top-ups of about $20, KRW 50,000 and ¥800, yet fail on every model. In those threads Google staff asked one user to retry and report back and contacted another privately; neither thread contains a published cause or a confirmed fix, and the November 22 poster wrote that Cloud Billing Support had told them the case was outside its scope. Several forum users call this a "billing sync" problem, while Google's November 16 answer said there is no sync issue between Cloud Billing and the AI Studio Prepay bucket. Developers in this position should record the purchase time, the balance shown and the exact error, then report it on the Google AI Developers Forum and to Cloud Billing Support.


A developer in India reported on November 18 that AI Studio kept showing "Prepay billing is required for this account" despite a prepayment and a welcome credit visible in the Cloud console, with the Prepay setup button redirecting to a UPI AutoPay page. That thread had no reply when checked. Google's documentation explains the welcome-credit part (not usable for the Gemini API on accounts opened after March 2, 2026) but does not cover the redirect.


··········


KEEPING A GEMINI API PROJECT FROM RUNNING OUT OF PREPAY CREDITS.


Auto-reload is the setting Google itself recommends in its error table next to buying credits, and it removes the most common cause. Set a monthly limit that matches your expected spend, and check the AI Studio cost views regularly, keeping in mind that Google's billing page says usage is drawn down from credits within minutes.


Three other habits help. Keep track of when credits were bought, because unused credits expire after 12 months. Remember that one empty wallet stops every project on the billing account, so a test project burning credits can take a production app down with it; separate billing accounts avoid that. Plan for the tier caps as well: Google lists monthly caps of $250 for Tier 1, $2,000 for Tier 2 and $20,000 to $100,000 for Tier 3, after which service is paused for all linked projects until the first day of the next month, a different stop from an empty wallet. Our guide to Google AI Studio billing, the free tier and API credits covers the plans, caps and data-handling differences in more depth, and the Gemini API 401 ACCESS_TOKEN_TYPE_UNSUPPORTED page helps when a new key fails for authentication reasons instead.


··········


GEMINI API PREPAYMENT CREDITS DEPLETED: CONCLUSIONS FOR DEVELOPERS.


A 402 from the Gemini API is a billing stop tied to the AI Studio Prepay wallet, and it applies to every project on the same billing account at once. In most cases the wallet really is empty from Google's point of view: the money is in Google Cloud Billing, the payment has not cleared, the credits are promotional and need a Prepay purchase first, or the credits expired. Buying Prepay credits in AI Studio and enabling auto-reload resolves all of those.


Client code should stop retrying on 402 and raise an alert, because the RESOURCE_EXHAUSTED status string in the body no longer means a temporary limit. The one case without a documented answer, a positive AI Studio balance that still returns 402, has several recent forum reports and no published fix as of November 23, 2026; for that case the only route Google has offered is to report it with the purchase details.


··········


FOLLOW US FOR MORE.


·····


DATA STUDIOS


·····


datastudios.org


bottom of page