AI API Keys 7 min read
Gemini API Key: How to Get One, Pricing and Limits
You can get a free Gemini API key in Google AI Studio in about a minute. Here is how to create and test it, what the free tier covers, what each Gemini model costs per million tokens, and how to fix common errors.
Key takeaways
- You get a Gemini API key free in Google AI Studio at aistudio.google.com/apikey. New accounts get a project and a key created for them automatically.
- The free tier covers the Flash and Flash-Lite models, but your prompts can be used to improve Google products. Gemini 4 Argon and 3.1 Pro need billing, which now starts with a $5 prepayment.
- Prices rise soon: Gemini 4 Argon doubles on 1 December 2026, and Gemini 3.8 and 3.6 Flash double on 1 January 2027.
A Gemini API key lets your own app, script or coding tool call Google’s Gemini models. Getting one takes about a minute and costs nothing, but 2026 brought real changes: new “auth keys”, prepaid billing, a smaller list of free models and price increases scheduled for the coming months. This guide shows how to create and test a key, what the free tier includes, what each model costs per million tokens, and how to fix the errors people hit most. Everything is checked against Google’s AI Studio documentation as of 4 November 2026.
How to get a Gemini API key
- Sign in with your Google account at aistudio.google.com/apikey.
- Accept the Gemini API terms. For a new user, AI Studio then creates a default Google Cloud project and an API key automatically.
- Copy the key from the API Keys page and store it somewhere safe, such as an environment variable (see below). You can rename the project later under Dashboard › Projects.
If you already use Google Cloud
Existing Cloud users do not get a default project. Open Dashboard › Projects › Import projects, pick your project and click Import, then go to Dashboard › API Keys › Create API key.
Fixing “You do not have permission to create a key in this project”
This error appears in company Google accounts where you are not a project editor. Ask your admin for a role such as Project Editor, or create a new project that is not tied to your organisation.
How to test your Gemini API key
Set the key as an environment variable named GEMINI_API_KEY (if GOOGLE_API_KEY is also set, that one wins), then send Google’s official test request:
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H 'Content-Type: application/json' \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-X POST \
-d '{
"model": "gemini-3.8-flash",
"input": "Explain how AI works in a few words"
}'
A short answer back means the key works. Note that Google’s examples now use the Interactions API rather than the older generateContent endpoint, and that a successful call to list models does not prove the project can run requests.
Who can get a Gemini API key
- Age: you must be 18 or older.
- Country: the API is available in most countries, including India and the United States. It is not available in mainland China, Hong Kong, Macao, Russia, Belarus, Iran, Cuba, North Korea, Syria, Myanmar or Afghanistan (full list).
- Europe, the UK and Switzerland: you can get a key there, but an app that serves users in those regions may only use the paid tier.
- Purpose: Google’s terms describe the API as a service for professional or business use.
Some projects show “Free tier unavailable”. Creating another key in the same project does not change that; you need billing or a different eligible project.
Is the Gemini API key free? Free tier vs paid tier
The key itself is free, and so is a limited amount of usage on these models:
- Free: Gemini 3.8 Flash, 3.6 Flash, 3.5 Flash-Lite, 3.1 Flash-Lite and 3 Flash Preview, the 3.8 Live models, text-to-speech, embeddings and Gemma 4.
- Paid only: Gemini 4 Argon, 3.1 Pro Preview, the Nano Banana image models, Omni Flash video and Lyria music.
Two things to know before you build on the free tier. First, Google says content sent on the free tier can be used to improve its products and may be read by human reviewers; paid-tier content is not. Second, rate limits apply per project, not per key, and Google shows the exact per-model numbers only inside AI Studio. Daily limits reset at midnight Pacific time.
Setting up billing with Prepay
To use paid models or lift the limits, click Set up billing next to your project and link a Cloud Billing account. Since 23 March 2026 new users pay in advance:
- The minimum top-up is $5 and the maximum $5,000.
- Credits expire after 12 months and cannot be refunded.
- When the balance reaches $0, every key on that billing account stops and returns a 402 error.
- The $300 Google Cloud welcome credit cannot be used for the Gemini API on accounts opened since 2 March 2026.
Gemini API usage tiers
| Tier | How you qualify | Monthly spend cap |
|---|---|---|
| Tier 1 | Link a billing account | $250 |
| Tier 2 | $100 paid and 3 days since payment | $2,000 |
| Tier 3 | $1,000 paid and 30 days since payment | $20,000 to $100,000+ |
Gemini API pricing per million tokens
Standard prices from Google’s pricing page, in US dollars per 1 million tokens:
| Model | Input | Output | Free tier |
|---|---|---|---|
| Gemini 4 Argon | $2 ($4 from 1 Dec 2026) | $10 ($20 from 1 Dec 2026) | No |
| Gemini 3.1 Pro Preview | $2, or $4 over 200K tokens | $12, or $18 over 200K | No |
| Gemini 3.8 Flash | $0.75 ($1.50 from 1 Jan 2027) | $3.75 ($7.50 from 1 Jan 2027) | Yes |
| Gemini 3.6 Flash | $0.75 ($1.50 from 1 Jan 2027) | $3.75 ($7.50 from 1 Jan 2027) | Yes |
| Gemini 3.5 Flash-Lite | $0.30 | $2.50 | Yes |
| Gemini 3.1 Flash-Lite | $0.25 | $1.50 | Yes |
The Batch API halves these prices. Cached input costs a tenth of the input price on most models. Grounding answers with Google Search is free for the first 5,000 requests a month on Gemini 3 and newer, then $14 per 1,000.
Live API, image and video prices
- Live API (
gemini-3.8-live): $0.75 per million text input tokens and $3 for audio input (about $0.005 a minute); output is $4.50 for text and $12 for audio (about $0.018 a minute). - Images: Gemini Nano Banana 2.1 costs about $0.034 per 1K image, $0.050 per 2K and $0.113 per 4K. Imagen was shut down in August 2026.
- Video: Gemini Omni 1.1 Flash costs about $0.10 per second of 720p video. Veo was shut down in October 2026.
Gemini API models available in 2026
Google retired and renamed many models this year, which is why so many tutorials now return “model not found”. The current lineup:
gemini-4-argon: the flagship, generally available since 13 October 2026, paid only.gemini-3.8-flashandgemini-3.6-flash: fast general models, free tier available.gemini-3.5-flash-liteandgemini-3.1-flash-lite: the cheapest models; 3.1 Flash-Lite shuts down on 7 May 2027.gemini-3.1-pro-preview: preview model for harder reasoning, paid only.gemini-3.8-live: real-time voice and video for the Live API.- Deep Research API: two preview agents (
deep-research-preview-04-2026and a Max version) that run up to 60 minutes per task. Google estimates $1 to $3 per task, or $3 to $7 for Max.
Is the Gemini 2.5 Flash API still available?
Only for projects that already used it. Since 18 September 2026 the 2.5 models are limited to existing users, and on 2 November Google deprecated gemini-2.5-flash and gemini-2.5-pro. From 1 December 2026 requests to 2.5 Flash are routed to 3.5 Flash-Lite, and requests to 2.5 Pro to 3.8 Flash. Update your model names before then.
How to keep your Gemini API key safe
Gemini keys can run up real bills, and security researchers have found nearly 3,000 live Google API keys exposed in public code. Since 28 May 2026 every new key is an “auth key” tied to a service account and limited to the Gemini API. Older unrestricted keys are rejected, and since 7 May long-unused unrestricted keys are blocked.
- Keep the key in an environment variable or a secret manager, never in Git.
- Never put it in a website or mobile app. Call Gemini from your own server, and use ephemeral tokens for Live API calls made from a browser.
- Restrict older keys in AI Studio: hover Unrestricted, choose Add restrictions, then Restrict to Gemini API only.
- Set billing alerts and a project spend cap. A key reported as leaked is blocked with the message “Your API key was reported as leaked”.
Common Gemini API key errors and fixes
| Error | What it means | Fix |
|---|---|---|
| 401 | Key missing, invalid or expired | Check the header and the environment variable |
| 402 | Prepay balance is $0 | Top up; retrying will not help |
| 403 | Key restricted, leaked or blocked, free tier unavailable, or unsupported region | Check restrictions and billing, or create a new key |
| 404 | Model not found, often a retired model | Switch to a current model name |
| 429 | Per-minute rate limit, daily quota or spend limit reached | Retry with exponential backoff, or move up a tier |
Failed requests are not charged but still count against your quota. Source: Gemini API errors.
Does Google AI Pro include a Gemini API key?
No. A Google AI Pro or Ultra subscription unlocks Gemini in the app and in the AI Studio website, but API calls with a key are billed separately. Subscribers who join the Google Developer Program and have a billing-enabled Cloud project do get monthly Cloud credits that can be spent on the Gemini API, starting at $10 a month for AI Pro, with more for Ultra. If you want Gemini for chatting, writing and Google apps, the Google AI Pro subscription is the right product; if you are building something, you need an API key.
Buying a Gemini API key with crypto
Google’s Prepay billing needs a card or bank account linked to Google Cloud. If that is a problem, AITopUp sells a Gemini API key as a prepaid token pack paid in USDT or other crypto, from $3.99 for 10M tokens with no expiry at the time of writing. The key is issued by a third-party gateway provider, not created in Google AI Studio, and its base URL accepts both the Gemini and the OpenAI API formats, so tools such as Cursor, VS Code, Codex and Antigravity can use it. Every model on it counts at twice the pack rate, so about half the pack is usable, and there is no prompt caching. Because requests go through the gateway, keep sensitive data out of it.
Comparing providers? See our guides to DeepSeek API pricing and ChatGPT pricing, which also covers the OpenAI API.
Gemini API key FAQ
Yes. Creating a key in Google AI Studio is free, and the free tier covers the Gemini Flash and Flash-Lite models within rate limits. Gemini 4 Argon, 3.1 Pro and the image and video models need billing, which starts with a $5 prepayment.
The same way as anywhere else: sign in at aistudio.google.com/apikey, accept the terms and copy the key AI Studio creates for you. India is a supported country; you must be 18 or older.
You have hit a per-minute rate limit, the daily quota or a spend limit for your project. Limits apply per project, not per key, so a new key will not help. Wait and retry with backoff, or enable billing to move to a higher tier.
No. AI Pro and Ultra cover the Gemini app and the AI Studio website, but API calls are billed separately. Subscribers can get monthly Cloud credits through the Google Developer Program, starting at $10 a month for AI Pro.
Only for projects that already used it. Google deprecated gemini-2.5-flash on 2 November 2026, and from 1 December 2026 requests to it are routed to Gemini 3.5 Flash-Lite.
Gemini 3.1 Flash-Lite at $0.25 per million input tokens and $1.50 per million output tokens, followed by 3.5 Flash-Lite at $0.30 and $2.50. The Batch API halves both prices.
Get these plans on AITopUp
Pay with crypto. Orders are activated in about 30 minutes during support hours (8:00–22:00 GMT+7), and each plan shows its warranty on the product page.