Skip to content

Instantly share code, notes, and snippets.

@lmike-mnc
Forked from christo-zero-john/instructions.md
Created January 10, 2026 20:55
Show Gist options
  • Select an option

  • Save lmike-mnc/2849250e4a91fc9c61c7b450ab5117b7 to your computer and use it in GitHub Desktop.

Select an option

Save lmike-mnc/2849250e4a91fc9c61c7b450ab5117b7 to your computer and use it in GitHub Desktop.
Instructions to get your free Gemini API Key

How to Get a Gemini API Key & Set Up Billing

This guide walks you through obtaining a Gemini API key from Google AI Studio, understanding the Free vs. Paid tiers, and setting up Google Cloud billing to unlock the $300 free credit.

1. Get Your Free Gemini API Key

  1. Go to Google AI Studio: Visit aistudio.google.com.
  2. Sign In: Log in with your Google account.
  3. Get API Key:
    • Click on the "Get API key" button in the top-left corner or sidebar.
    • Click "Create API key".
    • Select "Create API key in new project" (recommended for a fresh start) or choose an existing project if you have one.
  4. Copy Key: Copy the generated key immediately and store it securely (e.g., in a password manager or .env file). Do not commit this key to public repositories.

2. Free vs. Paid Tier

Google AI Studio offers two primary modes for the Gemini API.

Free Tier (No Billing Required)

  • Cost: Free of charge.
  • Usage: Great for development, testing, and personal projects.
  • Data Privacy: Important: Prompts and responses in the free tier may be used by Google to improve their products. Do not use this for sensitive or production data.
  • Rate Limits (Examples, subject to change):
    • Gemini 1.5 Flash: ~15 requests per minute (RPM).
    • Gemini 1.5 Pro: ~2 requests per minute (RPM).
    • Note: Limits are lower than the paid tier and usage is capped daily.

Paid Tier (Pay-As-You-Go)

  • Cost: You pay only for what you use (per 1k characters/images). View Pricing.
  • Data Privacy: Enterprise-grade privacy. Your inputs and outputs are NOT used to train Google's models.
  • Rate Limits: Significantly higher limits suitable for production applications (e.g., 1000+ RPM).
  • Features: access to higher limits and Scalability.

3. Setting Up Billing & The $300 Free Credit

To use the Paid Tier (and ensure data privacy), you need to enable billing on your Google Cloud Project.

The $300 Free Credit Offer

New Google Cloud customers automatically receive $300 in free credits valid for 90 days.

  • Risk-Free: You won't be charged actual money until you use up the $300 credit or the 90 days expire.
  • Production Testing: This allows you to test the API with "Paid Tier" privacy and rate limits without spending your own money initially.

How to Enable Billing

  1. Go to API Keys in AI Studio: Navigate back to the "Get API key" usage page in Google AI Studio.
  2. Edit Key / Project: Click on the project name associated with your API key.
  3. Set Up Billing:
    • You will see an option to "Set up billing" or "Link to Google Cloud project".
    • Click it to complete the setup in the Google Cloud Console.
  4. Create Billing Account:
    • Follow the prompts to create a new Billing Account.
    • You will need to enter a credit/debit card for identity verification.
    • Verify the $300 Credit: During signup, you should see a banner confirming the $300 free trial credit.
  5. Link Project: Ensure your API Key project is linked to this new Billing Account.

Benefits of Setting Up Billing

  1. Data Privacy: As mentioned, data is not used for model training.
  2. Higher Rate Limits: Avoid "429 Too Many Requests" errors during heavy testing.
  3. Scalability: Your app can grow without hitting free-tier ceilings.

Tip

Recommendation: Start with the Free Tier to run your first "Hello World" test. Once you are comfortable and ready to process real data or run larger jobs (like a full competitor scan), switch to the Paid Tier to utilize the $300 credit and ensure data privacy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment