How to get a Google Gemini API key for n8n
If an n8n automation we built (or one of our templates) uses Google Gemini for its AI steps, you'll need your own Gemini API key. Good news: this is the easiest of the Google setups — a single API key, no OAuth screens.
- Go to aistudio.google.com/apikey and sign in
- Click Create API key (pick or create a project)
- Copy the key (it starts with
AIza…) - In n8n, add a Google Gemini (PaLM) API credential and paste the key
1. Open Google AI Studio
Go to aistudio.google.com/apikey and sign in with the Google account you want to use. Google AI Studio is the home for Gemini API keys — you don't need the Google Cloud Console for this (though AI Studio links to a Cloud project behind the scenes).
2. Create the API key
Click Create API key. If prompted, choose an existing Google Cloud project or let AI Studio create one for you — either is fine. Google generates the key right away.
Copy the key — it starts with AIza. Unlike most providers, AI Studio lets you view existing keys again later on the same page, so you're not locked out if you misplace it — but still store it safely.
3. Free tier vs. billing
The Gemini API has a free tier with rate limits that are fine for testing and light automations. If your workflow needs higher limits or production volume, enable billing on the linked Google Cloud project and you'll be billed per token.
For current limits and rates, see Google's Gemini API pricing. Free-tier availability can vary by country.
4. Connect the key to n8n
In n8n, the key goes on a Google Gemini (PaLM) API credential, which the AI nodes then reuse:
- Open your workflow and click the Google Gemini Chat Model node (it sits under an AI Agent node).
- In the node's Credential dropdown, choose Create New Credential — the type is Google Gemini (PaLM) API.
- Paste your key (
AIza…) into the API Key field and save. - Back on the node, pick a model from the dropdown (the model is set here, not on the credential).
- Click Execute / Test step — if it returns a response, you're connected.
That's it — every Gemini step in the workflow now uses your key and your quota.
Official reference
Google updates AI Studio from time to time. If a screen looks different from this guide, their own docs are the source of truth: Google AI Studio — API keys and the Gemini API key docs. For the n8n side, see n8n's Google Gemini credential docs.
FAQ
Is this the same as the Google OAuth setup for Gmail and Sheets?
No. Gemini uses a simple API key (starting with AIza) from Google AI Studio. Gmail, Sheets, and Calendar use OAuth2 (a Client ID and Secret). For Gemini you don't touch an OAuth consent screen or redirect URL.
Is the Gemini API free?
There's a free tier with rate limits — fine for testing and light use. For higher limits, enable billing on the linked Google Cloud project. See Google's pricing page for current details.
I lost my key. Can I get it back?
Yes — unlike most providers, Google AI Studio lets you view your existing keys again on the API keys page. You can copy an existing key or create and delete keys there anytime.
Want us to set it up for you?
We build AI lead-gen and CRM automations in n8n — and handle the wiring, keys, and quotas so you don't have to.
Book a Free Strategy Call