How to Get a Google Gemini API Key (Beginner's Guide)

2026-07-12·
Google GeminiTutorialBeginners

Why Gemini?

Google's Gemini models are competitive with GPT-4 on many benchmarks and offer a generous free tier — perfect for learning, prototyping, and side projects.

Step 1: Go to Google AI Studio

Visit aistudio.google.com and sign in with your Google account. No credit card required for the free tier.

Step 2: Create an API Key

  1. Click "Get API Key" in the left sidebar
  2. Choose an existing Google Cloud project or create a new one
  3. Click "Create API Key"
  4. Copy the key — it starts with AIza

Step 3: Test Your Key

Option A: Api Key Chain (Easiest)

Paste your key at apikeychain.app. The tool auto-detects it as Gemini and validates it instantly.

Option B: curl

curl "https://generativelanguage.googleapis.com/v1/models?key=YOUR_API_KEY"

If you get a JSON response with model names, your key works.

Understanding Gemini's Free Tier

FeatureFree Tier Limit
Requests/min (Gemini 2.5 Flash)15 RPM
Requests/min (Gemini 2.5 Pro)2 RPM
Tokens/min1 million
Requests/day1,500

The free tier is rate-limited but not time-limited — it doesn't expire after a trial period.

Making Your First API Call

const API_KEY = 'YOUR_API_KEY';
const url = `https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent?key=${API_KEY}`;

const response = await fetch(url, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    contents: [{ parts: [{ text: 'Hello, Gemini!' }] }]
  })
});

const data = await response.json();
console.log(data.candidates[0].content.parts[0].text);

Security Tips

  • Keep your key server-side — Gemini's query-param auth makes it easy to accidentally expose in URLs
  • Set up API key restrictions in Google Cloud Console
  • Never commit your key to git — use .env files

When to Upgrade to Paid

The free tier works for:

  • Learning and prototyping
  • Low-traffic side projects
  • Testing prompts before scaling

Switch to paid (pay-as-you-go) when you need higher rate limits or production reliability.

🔑 Gemini key format: Starts with AIza — one of the easiest to recognize. Api Key Chain auto-detects it among dozens of provider key formats.

Related Posts