Gemini API Key: Get a Google AI Studio Key (2026)
Create and manage a Gemini API key in Google AI Studio, understand the current free and paid tiers, migrate to Auth keys, and test a secure first request.
Official Gemini API key page
Create and manage your key on the official Google AI Studio API Keys page: https://aistudio.google.com/app/apikey. A new user who accepts the terms gets a default Google Cloud project and API key automatically; you can also create another key and associate it with a project.
Google calls newly created AI Studio keys Auth keys. They are restricted to the Gemini API by default and include leaked-key enforcement. Do not paste a key into public source code or browser-side JavaScript.
- Sign in to Google AI Studio
- Accept the Gemini API terms
- Open the API Keys page
- Copy the Auth key and store it as GEMINI_API_KEY
Important: migrate Standard keys before September 2026
Google states that the Gemini API will reject Standard keys in September 2026. New AI Studio keys are already Auth keys. If an older integration uses a Standard key, open AI Studio and migrate it before the deadline to prevent service interruption.
A Standard key with explicit API restrictions can continue to work under Google's current transition rules, but the safest documented route is to migrate to an Auth key in AI Studio.
What the Gemini free tier actually includes
New accounts begin on the Free Tier. It provides free input and output for selected Gemini models, subject to the active limits shown for your project in AI Studio. Google does not promise one universal RPM or daily quota: limits depend on the model, project tier, account status, and available capacity.
The Paid Tier requires linking billing. Google's current billing guide says some accounts must prepay at least $10. Paid usage provides higher limits, access to additional models and features, and different data-use terms. Since March 2026, Gemini API usage is excluded from the $300 Google Cloud Free Trial credit.
Rate limits apply per project, not per API key. Check the live RPM, TPM, and RPD values in AI Studio before deployment.
Test the key with the current Google Gen AI SDK
Install Google's current SDK, keep the secret in an environment variable, and make a small request before adding application logic. Replace the model ID only with one shown as available in your AI Studio project.
from google import genai
import os
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="Reply with exactly: KEY_WORKS",
)
print(response.text)Server-side Python key check
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-X POST \
-d '{"contents":[{"parts":[{"text":"Reply with exactly: KEY_WORKS"}]}]}'Minimal cURL request
Common key and quota errors
A 400 response usually indicates an invalid request or unavailable model ID. A 403 can indicate a key, project, terms, API restriction, or supported-region problem. A 429 RESOURCE_EXHAUSTED response means a rate or spend limit was reached; wait and retry with backoff, reduce request size, or inspect the project's current limits in AI Studio.
Google says failed 400 and 500 requests are not billed for tokens, although they can still count against quota.
Choose the right follow-up guide
For a screen-by-screen AI Studio walkthrough, use the step-by-step key tutorial. For key and project management, use the Google AI Studio guide. For a code-first path, use the Gemini API quickstart. For model prices, see the current Gemini model pricing guide.
FAQ
What is the official Gemini API key URL?
Use https://aistudio.google.com/app/apikey. This is Google AI Studio's official key-management page.
Is a Gemini API key free?
Creating a key is free. Selected models have a Free Tier with project-specific limits; paid usage requires billing.
Do I need a credit card for the Free Tier?
Google describes new accounts as starting on the Free Tier. Billing and a payment method are needed only when upgrading to a Paid Tier.
Are Gemini limits shared across API keys?
Limits are applied per Google Cloud project, not per API key.
In This Guide Series
Related Providers
Sources
- Using Gemini API keysGoogle AI for Developers · Checked 2026-08-10
- Gemini API billingGoogle AI for Developers · Checked 2026-08-10
- Gemini API rate limitsGoogle AI for Developers · Checked 2026-08-10
- Gemini API pricingGoogle AI for Developers · Checked 2026-08-10