Gemini 429 RESOURCE_EXHAUSTED — Fix Guide | AI Error Hub
AI Error Hub/ Google Gemini/ Rate Limits/ 429 RESOURCE_EXHAUSTED
Google Gemini Rate Limits HTTP 429

Gemini 429 RESOURCE_EXHAUSTED

429 RESOURCE_EXHAUSTED
Gemini's rate limit or quota exceeded. This is Google's canonical status for all quota-related issues — could be RPM, TPM, or daily quota depending on the specifics in the error message.

What you see when this happens

  • HTTP 429 with `status: 'RESOURCE_EXHAUSTED'`
  • Error message specifies which quota was hit (RPM, TPM, RPD)
  • Retry-After header may or may not be present
  • Different limits between AI Studio and Vertex AI

Common causes

RPM limit hit on AI Studio

Free tier: 15 RPM. Paid tier: 1,000+ RPM. Easy to exceed on free tier.

TPM limit hit

1M TPM on free tier, 4M+ on paid. Large-context requests burn TPM fast.

Daily quota exceeded

Free tier has strict RPD (1,500 requests/day). Paid is higher but finite.

Per-model quota exhausted on Vertex AI

Vertex quota is per-project per-model — one model can be exhausted while others still serve.

How to fix it

Retry with exponential backoff

Standard retry pattern with full jitter.

from google.genai import errors
import random, time

def call_with_backoff(fn, max_attempts=5):
    for attempt in range(max_attempts):
        try:
            return fn()
        except errors.APIError as e:
            if e.code != 429 or attempt == max_attempts - 1:
                raise
            wait = random.uniform(0, min(60, 2 ** attempt))
            time.sleep(wait)

Upgrade from free to paid tier

Enable billing in Google AI Studio or GCP to unlock significantly higher quotas (1,000+ RPM vs. 15 RPM).

Request quota increase on Vertex AI

In GCP Console, navigate to IAM & Admin > Quotas, filter for 'Vertex AI', find the specific model quota, and request an increase. Usually approved within 24-48 hours.

Fail over to a cheaper model

Gemini Flash has separate quotas from Pro — failover routing distributes load.

MODELS = ["gemini-3.5-pro", "gemini-3.5-flash"]

def call_with_model_fallback(prompt):
    for model in MODELS:
        try:
            return client.models.generate_content(
                model=model, contents=prompt,
            )
        except errors.APIError as e:
            if e.code == 429:
                continue
            raise

How to prevent it

  • Enable billing early — free tier limits are prototyping-only
  • Monitor per-model quotas separately
  • Use Vertex AI for production (better quota controls than AI Studio)
  • Cache responses where semantics allow

Frequently asked questions

What's the difference between AI Studio and Vertex AI rate limits?

AI Studio has account-wide limits scaled by billing status (free vs. paid). Vertex AI has per-project per-model quotas managed through GCP quota system, with higher default limits and adjustable via quota requests.

How do I know which specific limit I hit?

The error message specifies the quota name. Common ones: 'GenerateContentRequestsPerMinutePerProjectPerModel', 'GenerateContentInputTokensPerMinutePerProjectPerModel', 'GenerateContentRequestsPerDayPerProjectPerModel'.