# How to get a Gemini API key

Get a Gemini API key in Google AI Studio: open aistudio.google.com/apikey and click Create API key. Plus: the free tier, prices and how to keep the key safe.

Tool: Gemini. By Julien Lieben. Updated 2026-11-23. Source: https://coldiq.com/university/gemini/gemini-api-key

## In short

- A Gemini API key (a password that lets a program use Gemini) is created in Google AI Studio, at aistudio.google.com/apikey.
- New users get a default project and key automatically after they accept the terms of service.
- The Gemini API has a free tier with limited models. Google uses free tier content to improve its products.
- Paid use is billed per million tokens (small pieces of text). As of November 2026, Gemini 4 Carbon costs $2 input and $10 output per million tokens.
- Google rejects unrestricted standard keys. Restrict your key to the Gemini API if AI Studio asks you to.

## Steps

1. Open aistudio.google.com/apikey and sign in with your Google account.
2. Accept the terms, then click Create API key.
3. Copy the key into the GEMINI_API_KEY setting of your tool.

## What is a Gemini API key?

An API key is a password for programs. It lets a tool you use, or a script you write, send requests to Gemini and get answers back.

You do not need a key to chat with Gemini in the app. You need one when a tool asks for it: an automation in Zapier or n8n, a spreadsheet add-on, or your own code.

Each request made with your key counts against your project. On the paid tier, it is billed to your account.


## How do you create a Gemini API key?

Google AI Studio is Google’s free web tool for developers. It is where keys are made and managed.

1. Go to aistudio.google.com/apikey.
2. Sign in with your Google account and accept the terms of service. New users get a default project and key at this step.
3. Click Create API key. Keys made in AI Studio are now bound to a service account by default.
4. Copy the key and paste it where your tool asks for it.

Tip: Already use Google Cloud and see none of your projects? Open Projects in AI Studio, choose Import projects, then create the key on the API Keys page.


## Where do you put the key?

Most tools have a field named API key. Paste it there.

In code, set an environment variable (a setting stored on your computer, outside the code) named GEMINI_API_KEY or GOOGLE_API_KEY. Google’s client libraries find it on their own. If both are set, GOOGLE_API_KEY wins.

Google says to pass the key directly in code only when you cannot use environment variables.


## Is the Gemini API free?

Yes, there is a free tier. It gives limited access to some models, free input and output tokens, and access to Google AI Studio.

There are two limits to know. First, Google uses content sent on the free tier to improve its products. Second, the top models, such as Gemini 4 Carbon and Gemini 4 Neon, are not on the free tier.

Imported Google Cloud projects may need project verification before they can use the free tier. Otherwise you set up billing and use the paid tier.


## How much does the Gemini API cost?

The paid tier bills per million tokens (a token is roughly a short word or part of a word). These are Google’s standard prices as of November 2026.

- gemini-4-carbon: $2 input and $10 output per million tokens. Google lists a rise to $4 and $20 on December 1, 2026.
- gemini-3.8-flash: $0.75 input and $3.75 output per million tokens.
- gemini-3.5-flash-lite: $0.30 input and $2.50 output per million tokens.
- Nano Banana 2.1 images (gemini-nano-banana-2.1): about $0.034 per 1K image.

Tip: Start with a Flash or Flash-Lite model for bulk jobs such as tagging 1,000 leads. Move to Carbon only for the hard tasks.


## How do you keep your key safe?

Treat the key like a password. Anyone who has it can spend on your account.

- Never commit the key to source control, such as GitHub.
- Never put it in a website or a mobile app. Use a backend server that holds the key instead.
- For production, store it in Google Cloud Secret Manager and set billing alerts.
- If a key leaks, create a new one, switch your tools to it, then disable the old key and check your usage.
- Restrict the key to the Gemini API. Unrestricted keys left unused since May 7, 2026 are blocked.


## Sources

- [Using Gemini API keys](https://aistudio.google.com/docs/api-key)
- [Gemini API pricing](https://aistudio.google.com/docs/pricing)
- [Google AI plans (developer options)](https://gemini.google/us/subscriptions/?hl=en)

## Questions

**Where do I find my Gemini API key?** In Google AI Studio, on the API keys page at aistudio.google.com/apikey. It shows keys that are unrestricted or restricted to the Gemini API.

**Is a Gemini API key free?** Creating a key is free, and the API has a free tier with limited models. Google uses free tier content to improve its products.

**Why does my Gemini API key not work?** Google rejects unrestricted standard keys. In AI Studio, use Add restrictions and choose Restrict to Gemini API only.

**Should I use GEMINI_API_KEY or GOOGLE_API_KEY?** Either one works: Google’s client libraries read both. If you set both, GOOGLE_API_KEY takes precedence.


## Related

- [What is Google Gemini?](https://coldiq.com/university/gemini/what-is-gemini)

## Try ColdIQ free

ColdIQ gives new accounts up to 1,450 free credits as they get started, no credit card required.
One subscription covers 40+ B2B data providers for finding, enriching and verifying
contacts and companies, through the web app, the API or the MCP server for AI agents.

1. Create an account: https://coldiq.com/marketplace/sign-up?utm_source=ai-assistant&utm_medium=markdown&utm_content=university
2. Run a first search on your own market with the free credits.
3. Connect the MCP server to Claude, ChatGPT or Cursor: https://coldiq.com/mcp
