Skip to content

Gemini API Key

Getting a Gemini API key is a straightforward process primarily done through Google AI Studio. The key allows you to access and integrate the Gemini models into your applications.

Here are the step-by-step instructions:

🔑 Get Your Gemini API Key

  1. Go to Google AI Studio: Open your web browser and navigate to the Google AI Studio website. You may need to sign in with your Google account.
  2. Agree to Terms: If it’s your first time, you’ll be prompted to review and accept the Terms of Service for Google APIs and the Gemini API.
  3. Find the API Key Section: Once logged in, look for the option to get your API key. This is often a prominent button or link labeled “Get API key” or in a “Settings” or “API Keys” section.
  4. Create the Key: Click the “Create API key” button.
  5. Select/Create a Project: You will be prompted to either select an existing Google Cloud project to associate the key with or create a new one. Select the appropriate option.
  6. Copy and Secure Your Key: Your new API key will be generated and displayed as a string of characters. Copy this key immediately and store it in a secure location.

🛡️ Security Best Practices

It’s critical to treat your API key like a password. Here are essential security practices:

  • Never commit your API key directly to your source code repository (like Git/GitHub).
  • Use environment variables to securely store and access the key in your code. The recommended variable name for the Gemini SDKs is typically GEMINI_API_KEY.
  • You can manage and track your API key usage in the Google AI Studio user interface under the “API keys” section.

For a visual guide on the process, you can watch this tutorial:

How To Get Your FREE Google Gemini API Key (2025). This video provides a helpful walkthrough of the steps in Google AI Studio.

Manage Preferences