Intermediate Guide

Gemini API Key Setup

Last updated: January 2025 • 7 min read

Enable enhanced AI summarization with Google's Gemini 2.5 Flash model. This optional cloud AI mode provides superior quality for complex technical articles while maintaining TTS privacy (audio synthesis remains 100% local).

info Privacy Trade-off

When using Gemini API, article content is sent to Google's servers for summarization. For sensitive material (medical, legal, financial, personal), always use Local AI mode instead.

Why Use Cloud AI Mode?

Local AI vs. Gemini API

Feature Local AI (Default) Gemini API (Optional)
Privacy 100% Private - No data sent Article text sent to Google
Quality Good (Chrome AI) Excellent (Gemini 2.5 Flash)
Cost Free forever Free tier, then pay-per-use
Speed Fast (local processing) Fast (depends on internet)
Internet Not required Required
Best For Privacy, offline use, general content Complex tech articles, research papers

When to Use Gemini API

  • Complex technical documentation with dense jargon
  • Academic research papers requiring nuanced comprehension
  • Multi-topic articles needing sophisticated analysis
  • When highest quality summaries justify privacy trade-off

Step 1: Create Google AI Studio Account

1

Sign Up for Google AI Studio

  1. Visit ai.google.dev
  2. Click "Get API key in Google AI Studio"
  3. Sign in with your Google account (personal or workspace)
  4. Accept the terms of service

No credit card required for the free tier.

Step 2: Generate Your API Key

2

Create a New API Key

  1. In Google AI Studio, navigate to "Get API Key" in the left sidebar
  2. Click "Create API Key"
  3. Select an existing Google Cloud project or create a new one:
    • New Project: Google creates one automatically for you
    • Existing Project: Select from dropdown if you have one
  4. Click "Create API Key in new/existing project"
  5. Your API key will be generated and displayed

content_copy Copy Your API Key Immediately

The API key is only shown once. Copy it to a secure location (password manager recommended). You can regenerate it later if lost, but old keys will be invalidated.

API Key Format

Your Gemini API key will look like this:

AIzaSyA1234567890abcdefghijklmnopqrstuv

It starts with AIza followed by 35 alphanumeric characters.

Step 3: Configure TLD2 with Your API Key

3

Add API Key to TLD2 Settings

  1. Open TLD2 by clicking the extension icon or right-clicking → "TLD2 - Summarize Article"
  2. Click the settings icon (gear) in the sidebar
  3. Scroll to the "Developer Options" section
  4. Find the "Gemini API Key" input field
  5. Paste your API key (Ctrl+V / Cmd+V)
  6. Click "Save" at the bottom of the settings panel

TLD2 stores the key locally in encrypted Chrome storage. It's never transmitted except directly to Google's Gemini API.

Step 4: Test Cloud AI Mode

4

Verify Gemini API Integration

  1. Navigate to any article (try a technical blog post or news article)
  2. Click TLD2 extension icon or use right-click menu
  3. Watch the summary generate—it should use Gemini API automatically
  4. If "Info Printout" is enabled in settings, you'll see "Using Gemini API" in the status text

check_circle How to Verify It's Working

Gemini API typically produces longer, more detailed summaries with better comprehension of technical terms. Compare the same article using both local AI and Gemini to see the quality difference.

Understanding API Usage & Pricing

Free Tier Limits (As of January 2025)

  • 15 requests per minute (RPM)
  • 1 million tokens per day
  • 1,500 requests per day

For typical article summarization:

  • Average article: ~1,000-3,000 tokens input
  • Summary output: ~200-500 tokens
  • Realistic daily usage: 300-500 articles before hitting free tier limits

warning Monitor Your Usage

Check your usage in Google AI Studio under "Quota & System Limits." If you exceed the free tier frequently, you can upgrade to pay-per-use pricing (typically $0.00025-$0.001 per 1K tokens).

Paid Pricing (Pay-as-you-go)

If you need more than the free tier:

  • Input: $0.075 per 1M tokens
  • Output: $0.30 per 1M tokens
  • Realistic cost: $0.0001-$0.0003 per article summarized

For most users, the free tier is sufficient for daily use.

Security Best Practices

Protecting Your API Key

  • Never share your API key publicly (GitHub, forums, screenshots)
  • Don't commit it to version control (if customizing TLD2)
  • Regenerate if exposed—go to Google AI Studio → Delete old key → Create new
  • Use API key restrictions (optional)—limit to specific IP addresses or referrers in Google Cloud Console
  • Monitor usage regularly—watch for unexpected spikes indicating unauthorized use

Revoking API Keys

If your key is compromised:

  1. Go to Google AI Studio API Keys
  2. Click the trash icon next to the compromised key
  3. Generate a new key immediately
  4. Update TLD2 settings with the new key

Troubleshooting Common Issues

"API Key Invalid" Error

Cause: Typo, expired key, or key from wrong project

Solution:

  • Double-check you copied the entire key (starts with AIza)
  • Verify no extra spaces before/after the key
  • Regenerate a new key in Google AI Studio

"Quota Exceeded" Error

Cause: You've hit daily/minute request limits

Solution:

  • Wait until limits reset (typically at midnight UTC)
  • Temporarily switch to Local AI mode
  • Upgrade to paid tier if you need higher limits

"Network Error" or "Failed to Connect"

Cause: Internet connectivity issue or Google API downtime

Solution:

  • Check your internet connection
  • Verify Google AI services status at status.cloud.google.com
  • Fallback to Local AI mode if urgent

Summary Quality Isn't Better

Cause: TLD2 may still be using local AI despite API key

Solution:

  • Verify API key is saved correctly in settings
  • Check for error messages in browser console (F12)
  • Try regenerating API key and re-entering

Switching Back to Local AI

To disable Gemini API and return to 100% local processing:

  1. Open TLD2 settings
  2. Navigate to "Developer Options"
  3. Clear the "Gemini API Key" field (delete all text)
  4. Click "Save"

TLD2 will immediately revert to local AI mode for all future summaries.