Create a Gemini API Key in Google AI Studio: Step-by-Step Screens
Get your Google Gemini API key through Google AI Studio or Google Cloud. This guide covers both methods, free tier limits, and how to make your first request.
Two Ways to Get a Gemini API Key
There are two main ways to get a Gemini API key: through Google AI Studio (simpler, recommended for most developers) or through Google Cloud Vertex AI (better for enterprise workloads with existing GCP infrastructure).
Google AI Studio is the fastest path. It provides a free tier and is ideal for prototyping and small projects. Google Cloud Vertex AI is better for production workloads that need IAM, billing controls, and enterprise support. For a comprehensive deep dive into the entire Gemini ecosystem — including model selection, pricing structures, and SDK integration — our complete Gemini API key guide is the definitive resource.
Method 1: Google AI Studio (Recommended)
Google AI Studio is the quickest way to get a Gemini API key. Search interest for 'Google AI Studio' grew 50% in 2026, reflecting its growing popularity among developers. The platform is browser-based, requires no local installation, and works with any standard Google account — no Google Cloud project setup needed upfront.
Go to aistudio.google.com, sign in with your Google account, and click 'Get API key' in the left sidebar. If you don't have a project yet, Google AI Studio will create one for you automatically. Accept the terms of service, and your API key will be generated. For a deeper look at the platform's features and capabilities, our Google AI Studio API key guide covers everything from navigation to advanced settings.
- Step 1: Go to aistudio.google.com
- Step 2: Sign in with your Google account
- Step 3: Click 'Get API key' in the left sidebar
- Step 4: Click 'Create API key' (a new Google Cloud project is created if needed)
- Step 5: Copy and store your API key securely
Method 2: Google Cloud Vertex AI
If you already use Google Cloud Platform, you can enable the Vertex AI API and generate credentials from the GCP Console. This method provides more control over IAM permissions, billing, and quotas. It also integrates seamlessly with existing GCP services like Cloud Functions, Cloud Run, and BigQuery, making it the natural choice for teams already invested in the Google Cloud ecosystem.
Navigate to the Google Cloud Console, enable the 'Vertex AI API', then go to 'Credentials' and create an API key or service account key. This approach is recommended for enterprise setups. Once you have your key, choosing the right model is critical — our Gemini models comparison breaks down the differences between Pro, Flash, and Flash-Lite to help you pick the best fit for your workload and budget.
Gemini API Free Tier
Google AI Studio offers a generous free tier for the Gemini API. The free tier has per-minute rate limits but no daily cap, making it suitable for development and testing. In our experience, a solo developer can build and iterate on a prototype for weeks without ever hitting the limits. The free tier includes access to all Gemini models, including the most capable Pro variant — a rarity among AI API providers.
When you're ready for production, you can enable billing in Google Cloud to access higher rate limits and additional features. The paid tier bills per million tokens, with separate rates for input and output. For a rapid end-to-end setup that takes you from key creation to verified first call in minutes, the Gemini API quickstart is the fastest route available.
Make Your First Request
The Gemini API has its own SDK, but you can also use the OpenAI-compatible endpoint. Here's a simple example using the Google Gen AI Python SDK:
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="Hello, what can you do?"
)
print(response.text)Minimal Gemini API call using the Google Gen AI SDK
FAQ
Is the Gemini API key free?
Google AI Studio offers a free tier with generous rate limits. You can create and use an API key for free during development. For production with higher limits, paid billing is required.
What's the difference between Google AI Studio and Google Cloud Vertex AI?
Google AI Studio is simpler and faster, ideal for prototyping and small projects. Vertex AI provides enterprise features like IAM, billing controls, and higher quotas, suited for production workloads.
Can I use the Gemini API key with OpenAI SDK?
Yes. Google provides an OpenAI-compatible endpoint for the Gemini API. You can use the OpenAI SDK by setting the base URL to the Gemini OpenAI-compatible endpoint.
Related in This Series
Related Providers
Sources
- Google AI StudioGoogle · Checked 2026-07-29
- Gemini API DocumentationGoogle AI for Developers · Checked 2026-07-29
- Gemini API PricingGoogle AI for Developers · Checked 2026-07-29