Back to blog

Gemini API Rate Limits Complete Guide: RPM, TPM, 429 Handling, and Tier Upgrades (2026)

API开发2026-01-2218 min readGemini APIRate LimitsRPM TPM429错误API配额

Your Gemini API app runs fine, then suddenly starts returning 429 errors. Code checks out, network checks out, but requests keep getting rejected. This is extremely common among Google Gemini API developers, especially after Google sharply cut free quotas in December 2025. The root cause is rate limits — a mechanism many developers only notice when it triggers.

Understanding Gemini API rate limits not only helps you avoid 429 errors, but lets you plan API usage, optimize costs, and build resilient production architectures. This guide systematically explains the four limit mechanisms — RPM, TPM, RPD, and IPM — provides the latest January 2026 quota data, and gives complete solutions from error handling to architecture design.

Rate Limit Basics: What Are RPM, TPM, RPD, and IPM?

Gemini API rate limits are the access-control mechanisms Google sets to protect service stability and distribute resources fairly. Unlike a simple "X requests per day" cap, Gemini uses a multi-dimensional limit system. Understanding these concepts is the foundation of using the API effectively.

RPM (Requests Per Minute) is the requests-per-minute cap — the most intuitive metric. Every API call counts as 1 request regardless of length. If your RPM limit is 15, you can make at most 15 calls per minute; exceeding it triggers a 429 error.

TPM (Tokens Per Minute) caps tokens processed per minute, a finer-grained metric. Tokens are the basic unit language models use for text; roughly 4 characters per token for English, and typically 2-3 tokens per Chinese character. TPM means even if you don't exceed request counts, requests with very long content (large input + output token totals) still get limited. In practice TPM trips more easily than RPM, because a single long-document request can consume tens of thousands of tokens.

RPD (Requests Per Day) is the daily request total cap, a longer-cycle constraint. For Free Tier users RPD is usually 1,500, meaning even if you tightly pace per-minute frequency, the daily total can't exceed this cap.

IPM (Images Per Minute) is the image-generation rate limit, specific to Gemini's image capabilities (e.g., gemini-2.5-flash image generation). Because image generation consumes more compute than text, Google sets a separate dimension for it.

All four limits apply simultaneously; any one triggering rejects the request. In practice, developers need to monitor all four, not just one.

Full Free Tier Limits: Latest January 2026 Data

Google's Free Tier lets developers experience the Gemini API at zero cost, but quotas were tightened significantly in December 2025. Below is the latest official January 2026 data from the Google AI developer docs:

ModelRPMTPMRPDIPM
gemini-2.5-pro5250,000100-
gemini-2.5-flash15250,00050010
gemini-2.5-flash-lite15250,0001,000-
gemini-3-pro-preview~10~250,000~500-
gemini-3-flash-preview~15~250,000~1,000-

Several observations stand out. First, Gemini 2.5 quotas were adjusted significantly — gemini-2.5-pro has only 5 RPM and 100 RPD, meaning Pro models under Free Tier are only usable for very light testing and can't support any real business. Second, Gemini 3 is now in Preview — gemini-3-pro-preview and gemini-3-flash-preview offer quotas similar to the 2.5 series, and developers should adapt early.

⚠️ Important: The Gemini 2.0 series (including gemini-2.5-flash) will be officially retired on March 3, 2026. If your app still uses 2.0, migrate to Gemini 2.5 or 3.0 as soon as possible.

Free Tier's use case is clear: development testing, proof of concept, personal learning projects. If your app needs more than ~10 requests/minute or more than 1,000 requests/day, Free Tier likely won't cut it and you should consider a paid tier.

Also note: all Free Tier limits are calculated per Google Cloud project, not per API key. Creating multiple API keys in one project shares the same quota cap. To isolate quota, you must create separate Google Cloud projects.

Paid Tier Comparison: Tier 1 Through Tier 3

When Free Tier isn't enough, upgrading to a paid tier is the natural choice. Google designed three paid tiers for the Gemini API, each with different quotas and unlock conditions:

TierUnlock Conditiongemini-2.5-flash RPMgemini-2.5-pro RPMNotes
Tier 1Link payment method + $50 spend150-30050-100Entry-level paid, for small projects
Tier 2$250 cumulative spend + 30 days1,000+300+Advanced, for mid-size apps
Tier 3$1,000 spend or enterprise application4,000+1,000+Enterprise, higher quota on request

Tier 1 is most developers' first stop. Link a valid payment method (credit card or bank account) in Google Cloud Console, reach $50 cumulative spend, and the system automatically upgrades your project to Tier 1. The most visible change: gemini-2.5-flash RPM jumps from 15 to 150-300 — a 10-20x increase — enough for most small and mid-size apps. RPD also relaxes dramatically, so you stop worrying about daily totals.

Tier 2 fits apps that have validated product-market fit and started scaling. It unlocks automatically at $250 cumulative spend with quotas again. For high-concurrency scenarios (batch document analysis, real-time chat), Tier 2 offers more headroom.

Tier 3 is the enterprise tier: besides $1000 cumulative spend, you can also apply proactively via the quota request form. Tier 3 quotas can be customized to business needs, suited to large enterprises with special requirements.

A simple decision framework: if 429 errors start hurting user experience, or your daily request volume consistently exceeds 50% of Free Tier (~750/day), it's time to upgrade. A detailed cost and pricing analysis helps with precise budget planning.

429 Error Handling in Practice: From Understanding to Fixing

When you trigger a rate limit, the Gemini API returns HTTP 429 with an error containing RESOURCE_EXHAUSTED. Understanding the error structure is the first step:

{
  "error": {
    "code": 429,
    "message": "You exceeded your current quota, please check your plan and billing details.",
    "status": "RESOURCE_EXHAUSTED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.RetryInfo",
        "retryDelay": "30s"
      }
    ]
  }
}

The retryDelay field in the response matters — it tells you how long to wait before retrying. But the better approach is exponential backoff, the industry-standard strategy for rate limiting.

Production-grade Python 429 handling:

import google.generativeai as genai
import time
import random

def call_gemini_with_retry(prompt, max_retries=5):
    """Gemini API call with exponential backoff"""
    genai.configure(api_key="YOUR_GPT88_API_KEY")
    model = genai.GenerativeModel("gemini-2.5-flash")

    base_delay = 1  # initial wait 1 second
    max_delay = 32  # max wait 32 seconds

    for attempt in range(max_retries):
        try:
            response = model.generate_content(prompt)
            return response.text
        except Exception as e:
            error_str = str(e)
            if "429" in error_str or "RESOURCE_EXHAUSTED" in error_str:
                if attempt == max_retries - 1:
                    raise Exception(f"Failed after {max_retries} retries: {e}")

                # exponential backoff + random jitter
                delay = min(base_delay * (2 ** attempt), max_delay)
                jitter = random.uniform(0, delay * 0.1)
                wait_time = delay + jitter

                print(f"Rate limited, waiting {wait_time:.1f}s before retry {attempt + 1}")
                time.sleep(wait_time)
            else:
                raise  # non-429 errors are re-raised

# Usage
result = call_gemini_with_retry("Explain the basic principles of quantum computing")
print(result)

JavaScript/Node.js implementation:

const { GoogleGenerativeAI } = require("@google/generative-ai");

async function callGeminiWithRetry(prompt, maxRetries = 5) {
  const genAI = new GoogleGenerativeAI("YOUR_GPT88_API_KEY");
  const model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" });

  const baseDelay = 1000;  // initial wait 1 second
  const maxDelay = 32000;  // max wait 32 seconds

  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      const result = await model.generateContent(prompt);
      return result.response.text();
    } catch (error) {
      const errorStr = error.toString();
      if (errorStr.includes("429") || errorStr.includes("RESOURCE_EXHAUSTED")) {
        if (attempt === maxRetries - 1) {
          throw new Error(`Failed after ${maxRetries} retries: ${error}`);
        }

        // exponential backoff + random jitter
        const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay);
        const jitter = Math.random() * delay * 0.1;
        const waitTime = delay + jitter;

        console.log(`Rate limited, waiting ${(waitTime/1000).toFixed(1)}s before retry ${attempt + 1}`);
        await new Promise(resolve => setTimeout(resolve, waitTime));
      } else {
        throw error;  // non-429 errors are re-thrown
      }
    }
  }
}

// Usage
callGeminiWithRetry("Explain the basic principles of quantum computing")
  .then(result => console.log(result))
  .catch(err => console.error(err));

Exponential backoff's core logic: wait 1 second on the first failure, 2 on the second, 4 on the third, and so on until the cap. Random jitter avoids a "thundering herd" of clients retrying simultaneously.

If your app frequently hits 429s, beyond improving error handling, check whether you need a higher quota tier or better request strategy.

Quota Monitoring and Optimization: Manage Your API Usage Proactively

Passively waiting for 429s is the wrong strategy; proactively monitoring quota is the right one. The Gemini API response headers carry quota state — using them enables preventive rate limiting.

import google.generativeai as genai
import requests

def check_quota_from_response(response_headers):
    """Parse quota info from response headers"""
    quota_info = {
        "remaining_requests": response_headers.get("x-ratelimit-remaining-requests"),
        "remaining_tokens": response_headers.get("x-ratelimit-remaining-tokens"),
        "reset_time": response_headers.get("x-ratelimit-reset")
    }
    return quota_info

class QuotaAwareGeminiClient:
    def __init__(self, api_key, warning_threshold=0.2):
        """
        warning_threshold: warn when remaining quota drops below this ratio
        """
        genai.configure(api_key=api_key)
        self.model = genai.GenerativeModel("gemini-2.5-flash")
        self.warning_threshold = warning_threshold
        self.last_remaining = None

    def generate(self, prompt):
        response = self.model.generate_content(prompt)

        # Check if close to quota cap (simulated; parse headers in production)
        if self.last_remaining and self.last_remaining < self.warning_threshold:
            print(f"Warning: less than {self.warning_threshold*100}% quota left, consider lowering request rate")

        return response.text

# Client-side rate limiting
import time
from collections import deque

class RateLimiter:
    def __init__(self, max_requests_per_minute):
        self.max_rpm = max_requests_per_minute
        self.request_times = deque()

    def wait_if_needed(self):
        """Wait if about to exceed the limit"""
        now = time.time()

        # Prune records older than 1 minute
        while self.request_times and now - self.request_times[0] > 60:
            self.request_times.popleft()

        # If at the limit, wait for the oldest request to expire
        if len(self.request_times) >= self.max_rpm:
            sleep_time = 60 - (now - self.request_times[0]) + 0.1
            if sleep_time > 0:
                print(f"Rate limiting: waiting {sleep_time:.1f}s")
                time.sleep(sleep_time)

        self.request_times.append(time.time())

# Usage
limiter = RateLimiter(max_requests_per_minute=8)  # keep 20% margin

for i in range(20):
    limiter.wait_if_needed()
    print(f"Sending request {i+1}")
    # actual API call...

Beyond code-level monitoring, Google Cloud Console offers a visual quota dashboard. Navigate to APIs & Services > Quotas to see real-time quota usage and history. Set alerts at 80% utilization so you have buffer to adjust strategy or request more quota.

Token optimization also cuts quota consumption. Avoid unnecessary long context, trim system prompts, and set a reasonable max_output_tokens — all help you do more under the same quota.

Upgrade Decision Guide: When to Move from Free Tier to Paid

Free Tier suits exploration and learning, but growth eventually hits its ceiling. Signals to upgrade:

Clear upgrade signals:

  • 429 error rate exceeds 5% of total requests
  • Users report "too slow" or "frequent failures"
  • Daily request volume consistently exceeds 1,000
  • You need gemini-2.5-pro but are limited to 5 RPM

Scenarios where Free Tier is fine:

  • Personal learning projects under 100 requests/day
  • Internal tools used by fewer than 10 people
  • Proof-of-concept before going public

Upgrading to Tier 1 is simple:

  1. Sign in to Google Cloud Console
  2. Open the Billing page
  3. Add a valid payment method (credit card / bank account)
  4. Generate $50 spend in a project with the Gemini API enabled
  5. The system upgrades automatically, usually taking effect after billing settles

Immediate changes after upgrade: gemini-2.5-flash RPM rises from 15 to 150-300, RPD relaxes dramatically, and error rates drop significantly. But paid usage is billed by actual call volume — keep an eye on costs.

Production Best Practices: Building a Resilient API Call Architecture

In production, exponential backoff alone isn't enough. You need a complete resilient architecture for all kinds of failures. Here's a proven three-layer defense:

Layer 1: Circuit Breaker

When the error rate exceeds a threshold, the circuit breaker "opens" and pauses all requests, preventing useless retries from burning quota and worsening service pressure.

import time
from enum import Enum

class CircuitState(Enum):
    CLOSED = "closed"      # normal state, requests allowed
    OPEN = "open"          # breaker open, all requests rejected
    HALF_OPEN = "half_open"  # half-open, allow a few test requests

class CircuitBreaker:
    def __init__(self, failure_threshold=5, recovery_timeout=60):
        self.failure_threshold = failure_threshold
        self.recovery_timeout = recovery_timeout
        self.failure_count = 0
        self.last_failure_time = None
        self.state = CircuitState.CLOSED

    def can_execute(self):
        if self.state == CircuitState.CLOSED:
            return True
        elif self.state == CircuitState.OPEN:
            # Check whether it's time to recover
            if time.time() - self.last_failure_time > self.recovery_timeout:
                self.state = CircuitState.HALF_OPEN
                return True
            return False
        else:  # HALF_OPEN
            return True

    def record_success(self):
        self.failure_count = 0
        self.state = CircuitState.CLOSED

    def record_failure(self):
        self.failure_count += 1
        self.last_failure_time = time.time()
        if self.failure_count >= self.failure_threshold:
            self.state = CircuitState.OPEN
            print("Circuit breaker opened: pausing all requests")

Layer 2: Request Queue and Priority

Not all requests are equally important. A priority queue ensures critical requests are processed first when quota is tight.

Layer 3: Fallback

When the official API is persistently unavailable, falling back to an alternative keeps business continuity. For high-availability needs, the GPT88 unified gateway can serve as a fallback path. Gateways like GPT88 generally aren't bound by official rate limits and have relatively lower latency, suiting critical-business fallback. Note: gateways fit development testing and small-to-mid traffic; for large-scale production, prefer the official enterprise tier. Exact pricing and quotas are confirmed in the gpt88.cc console.

class ResilientGeminiClient:
    def __init__(self, primary_api_key, fallback_base_url=None, fallback_api_key=None):
        self.circuit_breaker = CircuitBreaker()
        self.primary_key = primary_api_key
        self.fallback_url = fallback_base_url
        self.fallback_key = fallback_api_key

    def generate(self, prompt, priority="normal"):
        # Check circuit breaker state
        if not self.circuit_breaker.can_execute():
            if self.fallback_url and priority == "high":
                return self._call_fallback(prompt)
            raise Exception("Service temporarily unavailable, please retry later")

        try:
            result = self._call_primary(prompt)
            self.circuit_breaker.record_success()
            return result
        except Exception as e:
            self.circuit_breaker.record_failure()

            # High-priority requests try the fallback
            if self.fallback_url and priority == "high":
                print("Primary failed, switching to fallback")
                return self._call_fallback(prompt)
            raise

    def _call_primary(self, prompt):
        # Call official Gemini API
        pass

    def _call_fallback(self, prompt):
        # Call fallback service
        pass

FAQ

Q1: Which trips first, RPM or TPM?

Usually TPM. RPM caps request count while TPM caps token volume. A single long-document request can consume 100k tokens, and Free Tier's TPM cap is only 250k (gemini-2.5-flash) — just 2-3 such requests trigger the limit, far earlier than RPM's 15 requests. Pay special attention to TPM when processing long content.

Q2: Is the Free Tier limit per API key or per project?

Per Google Cloud project, not per API key. Creating multiple API keys in one project doesn't increase total quota; they share the same cap. For more quota, upgrade to a paid tier or create separate Google Cloud projects (though this may violate terms of service; not recommended).

Q3: Will exceeding limits get my account banned?

No. Triggering a rate limit only rejects requests (429); it doesn't ban your API key or account. But circumventing limits improperly (e.g., mass-creating projects) may violate Google's terms of service. Within legitimate use, being over limit is a temporary rejection that recovers after quota resets.

Q4: How do I request higher quota?

Two ways: (1) increase spend to auto-upgrade tiers ($50→Tier 1, $250→Tier 2, $1000→Tier 3); (2) submit a quota request form in Google Cloud Console describing business needs. Enterprises can also contact the Google sales team for custom plans. Tier 3 users have a higher approval rate for extra quota.

Q5: How can users in China stably use the Gemini API?

Mainland China has unstable direct access to the Gemini API. Besides overseas cloud-server relays, the GPT88 unified gateway is another option. GPT88 provides a mainland-direct relay service with OpenAI SDK compatibility and low switching cost. Gateways suit development testing and latency-sensitive scenarios, but choose a reliable provider and understand its data-handling policies.

Q6: Do Batch API and real-time API share quota?

Partially. Batch API has an independent (usually higher) quota pool, but some limits (like daily totals) may be shared with real-time API. Using Batch for non-real-time tasks is an effective quota strategy: Batch prices are usually 50% of real-time and quotas are looser.

Q7: Why did I get a 429 before hitting my RPM limit?

You likely triggered a TPM or RPD limit, not RPM. The 429 message doesn't always say which limit. Check: (1) whether recent requests contain many tokens; (2) whether today's total approaches the RPD cap; (3) whether you're using image generation (triggers IPM).

Q8: How long does Free Tier → Tier 1 take?

It's near real-time. Once your account qualifies (linked payment method + $50 spend), the system usually upgrades within minutes to hours. If it hasn't after 24 hours, contact Google Cloud support to confirm account status.


Gemini API rate limits look complex, but once you understand the design logic they're predictable and manageable. RPM/TPM/RPD/IPM each have their focus; Free Tier gets you started, paid tiers support growth, and production needs the three-layer defense of circuit breaker, queue, and fallback. Starting from this guide, you can build a Gemini API architecture that's both stable and economical.

Related guide

错误码参考