Skip to content
Billfuse

Gemini API error 402: "Your prepayment credits are depleted"

Last updated

If the Gemini API answers with HTTP 402 and “Your prepayment credits are depleted”, stop retrying and check your Prepay credit balance in Google AI Studio. In Google's docs a 402 means one thing: your Prepay credits have run out. Requests fail until you add credits.

Everything here was checked against Google's docs on November 13, 2026. Parts that rest on forum posts say so and give the date.

The short version

  1. Stop retrying. Google says the request won't succeed until credits are added.
  2. Check your Prepay credit balance on the AI Studio Billing page.
  3. If the balance is $0 or less, select Buy credits.

Every API key in every project on that billing account stops at the same time. If AI Studio shows a balance above $0 and the error continues, see “If your balance isn't $0” below.

The full error

402 Payment Required
{
  "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"
  }
}

This is the response as a notice on Google's developer forum showed it on September 18, 2026, spaces included.

Sources: Google AI Developers Forum, notice of September 18, 2026, forum post of September 28, 2026, Google AI Studio, API errors (generate content), API errors (Interactions API)

A forum notice says it used to be a 429

The same forum notice announced a change: “Requests failing because a project's prepayment credits are depleted will now return HTTP 402 Payment Required instead of HTTP 429 Resource exhausted. This change separates retriable errors from ones that require your attention to resolve.” It adds that other rate limit errors keep returning 429.

Sources: Google AI Developers Forum, notice of September 18, 2026, forum post of September 16, 2026, Google AI Studio, Release notes

What Google says happens at $0

On the Prepay billing plan you buy credits first, and Google deducts your Gemini API usage from that balance in near real time. Google rolled the plan out on March 23, 2026.

Google's Billing page says new users default to Prepay. The same page also says accounts created after that date may start on Postpay and be switched to Prepay later. Its FAQ says new users “might be required” to use Prepay. Google says it is moving developer accounts from Postpay to Prepay for the Gemini API. The cutover date is in each account's notice.

Sources: Google AI Studio, Billing, Troubleshooting, Release notes, Google Cloud, In-product Cloud Billing setup

Don't retry a 402

Google's API errors page says: “Don't retry this request: it won't succeed until credits are added.” Its troubleshooting page lists 402 with 400 and 403 as errors not to retry. Check for it before you retry:

Python
from google.genai import errors

# For errors from client.models.generate_content


def prepay_credits_depleted(error: Exception) -> bool:
    """A 402. Google: the Prepay credit balance is depleted, don't retry."""
    return isinstance(error, errors.APIError) and error.code == 402
TypeScript
import { ApiError } from "@google/genai";

// For errors from ai.models.generateContent
// A 402. Google: the Prepay credit balance is depleted, don't retry.
function prepayCreditsDepleted(error: unknown): boolean {
  return error instanceof ApiError && error.status === 402;
}

When the check says yes, stop the job and tell someone who can add credits. Every other key on the billing account is failing the same way.

We ran the check with the Python SDK (google-genai 3.3.0 and 1.20.0) and the TypeScript SDK (@google/genai 3.3.0 and 1.10.0), against a local test server that sends the error above and eight others.

Sources: Google AI Studio, API errors (generate content), Troubleshooting, python-genai, js-genai

Add credits, and how long they take

  1. Open the AI Studio Billing page.
  2. Select Buy credits.

Auto-reload keeps buying credits as you spend them. To put a monthly cap on what a project can spend, see our Gemini spending limit guide.

Source: Google AI Studio, Billing

If your balance isn't $0

Developers keep posting this error on Google's forum while they see money on their account. On November 13, 2026, a forum search found dozens of such threads: their titles say the account is funded or the balance is positive. We can't tell you which case is yours. Here is what Google's docs say, and what developers and forum moderators have written.

You paid in the Google Cloud console

Google Cloud's docs say Prepay credits “are stored in a separate balance”. Google's Billing page says the balance and its transaction history are managed in the AI Studio Billing tab.

These are forum posts, not documentation.

You have Google Cloud credits

Google says Prepay users must buy Prepay credits before any eligible Google Cloud credits can be used for the Gemini API. A developer with monthly Google Cloud credits reported the 402 on September 28, 2026. A forum moderator answered the next day by quoting that rule.

Google also says its $300 Welcome credit can't be used for the Gemini API at all on billing accounts opened after March 2, 2026.

You see a positive Prepay balance

In both threads, forum moderators asked for details in private, and neither thread showed an outcome when we checked.

Google's Billing page names two causes for usage that stops while the balance is above $0. One is your tier's usage limit. The other is the status of your Cloud Billing account, such as a missed payment for other Google Cloud services. It doesn't say which error either one returns. Google's API errors page puts an unpaid balance under 403 PERMISSION_DENIED, and so does its troubleshooting page. The API errors page lists “exceeding spend-based limits for your account's billing history and tier” under 429. It lists neither under 402.

Google's Billing page also describes adding Prepay to an existing Postpay account and canceling halfway. The billing account stays in a state that restricts the linked projects that rely on Prepay services. To restore service, Google says to finish the setup or contact Cloud Billing support.

If none of this fits, Google's docs point to its developer forum for questions and to Cloud Billing support for billing help. In one of the threads above, a moderator asked the developer to send the project ID and the billing account ID through a form, not in the thread.

Sources: Google AI Studio, Billing, Google Cloud, In-product Cloud Billing setup, API errors (generate content), Troubleshooting. Google AI Developers Forum: November 2, 2026, September 16, 2026, September 28, 2026, October 5, 2026, October 9, 2026

Where Billfuse fits

Billfuse is the tool we built to watch AI API spend. It would not have prevented this error. It reads Gemini spend about a day late, it doesn't read your Prepay balance, and it can't pause Gemini.

What Billfuse does: one monthly budget across OpenAI, Anthropic, Gemini and OpenRouter, with emails at 50%, 80% and 100% of it. It also alerts you when one provider's day reaches 3 times a normal day, and at least $10 more. For Gemini, both arrive about a day late. Against this error, use Google's own tools: check the balance on the AI Studio Billing page, and if you turn on auto-reload, give it a monthly limit.

More guides

It's free while Billfuse is in early access. You can try it with sample data first, no sign-up needed.