API model string
gemma-3-4b-itContext window
131K tokens
Max output not published
- Knowledge cutoff
- not published
- Released
- March 13, 2025 (GA)
- Modalities
- text + vision (multimodal)
Last verified July 10, 2026
Rate limits by tier
Gemma 3 offers two fundamentally different access paths: open-weight self-hosting (unlimited throughput, hardware-bound) and a Google AI hosted API with project-specific quotas shown in AI Studio. The hosted path does not publish stable RPM/TPM numbers.
| Tier | Requirements | RPM | TPM | RPD | Concurrent | Notes |
|---|---|---|---|---|---|---|
| Self-host (open weights) | Apache 2.0 / Gemma License (commercial use allowed); download from Hugging Face | unlimited (hardware-bound) | unlimited (hardware-bound) | unlimited (hardware-bound) | hardware-bound | 4B runs on consumer GPU (RTX 3090/4090); 27B requires server GPU (A100/H100). Zero per-token cost. Ollama one-command deploy. |
| Free (AI Studio) | Google account; no billing required | not published | not published | not published | not published | Free tier availability for Gemma 3 is not explicitly published. AI Studio project quotas apply. Per third-party trackers, Flash-class models see ~1,500 RPD — confirm in your AI Studio console. |
| Google AI Hosted (PAYG) | Google Cloud billing account linked to project | not published (project-specific; shown in AI Studio console) | not published | not published | not published | 4B variant: $0.040 input / $0.080 output per MTok. 12B and 27B hosted pricing not published as of July 10, 2026. |
| Hugging Face / Ollama / third-party hosts | Free or host-billed account | host-dependent | host-dependent | host-dependent | host-dependent | Wide ecosystem: HF Inference API (rate-limited on free tier), HF Dedicated Endpoints, Groq, Together AI, and more. Pricing and limits vary by host. |
| Enterprise / Vertex AI | GCP project + Vertex AI enabled; Google Cloud agreement | negotiated | negotiated | negotiated | negotiated | VPC Service Controls, data residency, committed use pricing. Deploy via Vertex AI Model Garden. |
Swipe the table sideways to see every limit column.
- 1.Limits for the hosted API are project-specific. Google's documentation warns that published limits are 'not guaranteed' — always check AI Studio for your active quota.
- 2.Self-host throughput is purely hardware-bound. vLLM and TGI continuous batching can dramatically improve requests-per-second on a given GPU.
- 3.Gemma 4 (26B-a4b, 31B) was released in 2026 and is newer than Gemma 3. Evaluate Gemma 4 for new projects.
Limits verified against the Google docs, July 10, 2026.
Token pricing
What you pay per million tokens (USD). Input and output are billed separately.
Input
$0.04
per 1M tokens
Output
$0.08
per 1M tokens
Batch discount
−50%
on batch jobs
- Pricing applies to the 4B hosted variant on Google AI. 12B and 27B hosted pricing is not published as of July 10, 2026.
- Self-host has zero per-token cost — compute/infra cost only.
- 50% batch discount is Google's standard for async batch API workloads.
- No long-context surcharge documented for Gemma 3; no context caching pricing published for hosted API.
Side-project with hosted API
$0.28
per month
Assumptions
5M in / 1M out/month (4B hosted)
5M × $0.040/1M + 1M × $0.080/1M = $0.20 + $0.08
Self-hosted production
$0 tokens (infra only)
per month
Assumptions
60M in / 12M out/month on 1× A100 spot (~$2–3/hr)
Token cost = $0; cloud GPU spot ~$2/hr × 720 hrs ≈ $1,440/month infra. Breaks even vs hosted at ~36B tokens/month.
Mid-volume hosted (4B)
$22.40
per month
Assumptions
400M in / 80M out/month
400M × $0.040/1M + 80M × $0.080/1M = $16 + $6.40
Run your own numbers
Drag your real monthly token volumes and watch the bill update live — priced against rival models at the same usage.
Estimated gemma-3-4b-it spend
$1.60/mo
Input: $1.20
Output: $0.40
30M in × $0.040 + 5M out × $0.080 = $1.60
Same volume, priced across models
- gemma-3-4b-itThis model$1.60
- Phi-3$3.25
- Llama 4 Scout$3.90
- Gemini 2.5 Flash$22
Rivals priced at their published input/output rates for the same monthly volumes. Prompt caching is model-specific, so it is applied to gemma-3-4b-it only. Estimates for comparison; real bills vary with request shape and long-context surcharges.
gemma-3-4b-it vs the alternatives
Gemma 3 (4B hosted) vs competing small open-weight and hosted models on cost, context, and capability.
| Aspect | gemma-3-4b-it | Phi-3 | Llama 4 Scout | Gemini 2.5 Flash |
|---|---|---|---|---|
| Context window | 131K | 128K (Phi-4-mini) | 128K (Llama 4 Scout on most hosts) | 1M (Gemini 2.5 Flash) |
| Input price hosted ($/MTok) | $0.040 | $0.07 (Phi-4-mini) | $0.08–0.11 (Scout/Groq) | $0.30 (Gemini 2.5 Flash) |
| Output price hosted ($/MTok) | $0.080 | $0.23 (Phi-4-mini) | $0.30–0.34 (Scout) | $2.50 (Gemini 2.5 Flash) |
| Self-host option | yes (Apache 2.0 / Gemma License) | yes (MIT) | yes (Llama 4 license) | no (closed API) |
| Multimodal (vision) | yes | yes (Phi-4) | yes (Scout) | yes (Flash) |
| Batch discount | 50% | not published (Phi/Azure) | host-dependent | 50% |
| Ecosystem maturity | Ollama, Hugging Face, Google AI | Azure Foundry, many hosts | many third-party hosts | Google API only |
Swipe the table sideways to see every model.
Hitting a 429? The playbook
The exact errors you'll see
429 Too Many RequestsRESOURCE_EXHAUSTEDQuota exceeded for quota metricRate limit exceededWhy it happens & how to fix it
Hosted API project quota hit
Check AI Studio dashboard for your current quota. Request a quota increase in Google Cloud Console → IAM & Admin → Quotas → Generative Language API.
Free-tier RPD limit reached
Upgrade to PAYG billing on your Google Cloud project. Free-tier quotas for Gemma 3 are not published — your limit is shown in AI Studio.
Concurrent request spike
Implement request queuing with controlled concurrency and exponential backoff. Self-hosting vLLM or TGI removes this constraint entirely.
API key scope incorrect
Ensure the API key has the Generative Language API enabled in Google Cloud Console → APIs & Services → Credentials.
Retry strategy
Google AI documentation recommends exponential backoff. Start with a 1-second delay, double on each retry, cap at 60 seconds. Add ±20% jitter to avoid thundering-herd. Check for a Retry-After header on quota responses. For high-volume workloads, consider switching to self-hosted Gemma 3 to eliminate API rate limits entirely.
1// retry.ts — Gemma 3 hosted API with exponential backoff2// Base URL: https://generativelanguage.googleapis.com/v1beta/models/gemma-3-4b-it:generateContent34const API_KEY = process.env.GOOGLE_API_KEY!;5const MODEL = 'gemma-3-4b-it';6const BASE_URL = `https://generativelanguage.googleapis.com/v1beta/models/${MODEL}:generateContent`;78async function generateContent(prompt: string, maxRetries = 5): Promise<unknown> {9 let delay = 1000;10 for (let attempt = 0; attempt <= maxRetries; attempt++) {11 const response = await fetch(`${BASE_URL}?key=${API_KEY}`, {12 method: 'POST',13 headers: { 'Content-Type': 'application/json' },14 body: JSON.stringify({15 contents: [{ role: 'user', parts: [{ text: prompt }] }],16 }),17 });18 if (response.ok) return response.json();19 if (response.status !== 429 || attempt === maxRetries) {20 throw new Error(`Gemma 3 error ${response.status}: ${await response.text()}`);21 }22 const retryAfter = response.headers.get('Retry-After');23 const jitter = 0.8 + Math.random() * 0.4;24 const waitMs = retryAfter ? parseInt(retryAfter) * 1000 : delay * jitter;25 console.warn(`Rate limited. Retrying in ${Math.round(waitMs)}ms (attempt ${attempt + 1})`);26 await new Promise((r) => setTimeout(r, waitMs));27 delay = Math.min(delay * 2, 60_000);28 }29 throw new Error('Max retries exceeded');30}How to raise your limits
The ladder from the starter tier to enterprise — what each rung takes, and what it unlocks.
Self-host (no limits)
Minutes (Ollama) to hours (full vLLM setup)Download weights from Hugging Face (google/gemma-3-4b-it); run via Ollama (`ollama run gemma3:4b`), vLLM, or HuggingFace transformers
Unlocks: Unlimited throughput (hardware-bound), zero per-token cost, no API quotas
AI Studio Free
ImmediateSign in at aistudio.google.com — no card needed
Unlocks: Evaluation quotas (not published; shown in console)
PAYG Hosted
Minutes after billing addedGoogle Cloud Console → create billing account → link to AI Studio project
Unlocks: 4B at $0.040/$0.080 per MTok, higher quotas, data not used for training
Quota increase
1–5 business daysGoogle Cloud Console → IAM & Admin → Quotas → Generative Language API → select quota → Request increase
Unlocks: Custom RPM/RPD per project
Enterprise / Vertex AI
NegotiatedContact Google Cloud Sales at cloud.google.com/contact; deploy via Vertex AI Model Garden
Unlocks: VPC, data residency, committed use pricing, dedicated capacity
Cut your token spend
Self-host 4B on a consumer GPU for high-volume use
Token cost drops to $0; only infra cost remainsRTX 3090/4090 (~$1–2/hr spot) runs Gemma 3 4B comfortably. Breaks even vs hosted at ~36B tokens/month. Use Ollama for simplest setup.
Quantized checkpoints (int4/int8) for self-hosted
4–8× memory reduction enabling smaller/cheaper hardwareOllama ships quantized Gemma 3 by default. For vLLM: load with --quantization awq or gptq. Minimal quality loss for most tasks.
Right-size model variant
3–4× latency/cost difference between 4B and 27BUse 4B for latency-sensitive or high-volume tasks; 27B only when reasoning quality explicitly requires it. Benchmark both for your task.
Batch inference on self-hosted vLLM / TGI
3–8× higher throughput vs sequential single requestsBoth vLLM and TGI support continuous batching. Batch size and scheduling are handled automatically — just send requests concurrently.
Application-layer prompt prefix caching
Significant savings on repeated system promptsContext caching is not published for Gemma 3 hosted API. For self-hosted, implement KV cache reuse via vLLM's prefix caching feature.
50% batch discount on hosted Google AI API
Halves cost to $0.020/$0.040 per MTokUse the async Batch API for non-latency-sensitive workloads: document processing, classification, overnight jobs.
Evaluate Gemma 4 for new projects
Newer generation (2026) may offer better quality/cost tradeoffGemma 4 (26B-a4b, 31B) is available in 2026. Benchmark both before committing to Gemma 3 for a new production system.
Frequently asked questions
Is Gemma 3 free to use?
Yes, in two ways. (1) Self-host: the open weights are free under Apache 2.0 / Gemma License — you only pay for hardware. (2) Hosted API: a free tier exists in Google AI Studio, though exact free-tier quotas for Gemma 3 are not published. Paid hosted API starts at $0.040/$0.080 per MTok for the 4B variant.
What are Gemma 3's API rate limits?
For the hosted API, Google does not publish stable RPM or TPM numbers. Your active quota is project-specific and visible in the AI Studio dashboard. Self-hosted Gemma 3 has no API rate limits — throughput is limited only by your hardware.
How much does Gemma 3 cost?
The 4B hosted variant on Google AI costs $0.040 per million input tokens and $0.080 per million output tokens (verified July 10, 2026). A 50% batch discount is available for async workloads. Pricing for 12B and 27B hosted variants is not published. Self-hosted has zero per-token cost.
How do I increase Gemma 3 rate limits?
For the hosted API: go to Google Cloud Console → IAM & Admin → Quotas → Generative Language API and request a quota increase (1–5 business days). Alternatively, upgrade to Vertex AI for enterprise-grade quotas. For unlimited throughput, self-host Gemma 3 with vLLM or Ollama — there are no external rate limits.
Gemma 3 vs Gemini 2.5 Flash — which should I use?
Gemma 3 4B hosted ($0.040/$0.080) is 7–30× cheaper than Gemini 2.5 Flash ($0.30/$2.50) per token, but Flash is a larger closed model with better general capability, 1M context (vs 131K), and native multimodal support for audio/video. Use Gemma 3 for cost-sensitive, high-volume tasks; Flash for quality-critical or long-context workloads.
Does Gemma 3 support vision (image input)?
Yes. Gemma 3 is multimodal — it supports both text and image input. This is a key advantage over the text-only Gemma 2 predecessor.
Should I use Gemma 3 or Gemma 4 for a new project?
Gemma 4 (released in 2026) is the newer generation. For new projects, benchmark Gemma 4 before committing to Gemma 3. Gemma 3 remains fully supported and is a strong choice, but Gemma 4 may offer better quality for your use case. RapidDev can help evaluate the right model for your architecture — see rapidevelopers.com/contact.
What does 'RESOURCE_EXHAUSTED' mean for Gemma 3?
RESOURCE_EXHAUSTED is Google's error code for quota exceeded. It appears alongside the 429 HTTP status. To fix: (1) add exponential backoff with Retry-After header handling, (2) check your quota in AI Studio, (3) request a quota increase in Google Cloud Console, or (4) switch to self-hosted Gemma 3 to eliminate this constraint.
We build AI apps that don't hit rate limits
- Retry, backoff & caching built in
- Multi-provider fallback routing
- Fixed price, you own the code
30-min call. No commitment.