If you want to use Google’s Gemini models in your own apps (web, mobile, scripts, tools like SVG ORA Studio, etc.), you’ll need a Gemini API key.
Think of the API key like a secret password your code uses to talk to Google’s AI servers.
In this guide, we’ll go from zero → first working key in simple steps.
1. What you need before you start
Before generating a Gemini API key, make sure you have:
- ✅ A Google account (Gmail is enough)
- ✅ Internet access and a modern browser (Chrome, Edge, Firefox, etc.)
- ✅ You’re in a supported country for Gemini API’s free/paid tiers Google AI for Developers+1
You do not need:
- Any special IDE
- A credit card (for basic free-tier usage, in most regions) Google AI for Developers+1
2. Go to Google AI Studio
- Open this URL in your browser:
https://aistudio.google.com/ - If you’re not signed in, log in with your Google account.
- After login, you’ll see Google AI Studio, which is Google’s playground for Gemini (chat, prompt experiments, file uploads, etc.). AI Studio+1
AI Studio is where you create & manage your Gemini API keys and projects. Google AI for Developers+1
3. Accept the terms (first-time only)
The first time you use Gemini API:
- AI Studio may show you a Terms of Service / Gemini API terms dialog.
- Read through (or at least skim 😅).
- Click Agree / Continue to proceed. merge.dev+1
This step is usually one-time per account.
4. Open the API Keys page
Now let’s get to the actual key:
- In AI Studio, look for something like “API Keys” in the left sidebar or top nav.
- Click it to open the API Keys dashboard.
From here, you can:
- See existing keys
- Create new keys
- Delete (revoke) old keys
All of this is managed inside AI Studio. Google AI for Developers+1
5. Create a new Gemini API key
On the API Keys page:
- Click Create API key (or “+ Create API key” button).
- A dialog will ask you to choose:
- Create in a new Google Cloud project OR
- Use an existing project
For most people, especially if you’re just testing:
- Choose Create in new project
→ AI Studio will automatically create a lightweight Google Cloud project behind the scenes and attach the key to it. Google AI for Developers+1
- Click Create.
Within a second or two, you’ll see a new API key string appear, something like:
AIzaSyC9XoExampleKey_1234567890
That’s your Gemini API key. 🎉
6. Copy and store your API key safely
This part is important.
Your API key:
- Grants access to Gemini models from your account/project
- Is tied to usage and billing for that project Google AI for Developers+1
So you should treat it like a password.
Do:
- Copy the key and store it in:
- A
.envfile - A password manager
- A secure backend config
- A
- Use environment variables in your code:
GEMINI_API_KEY="your_real_key_here"
Don’t:
- ❌ Commit the key to GitHub
- ❌ Paste it into public CodePen / JSFiddle / StackBlitz
- ❌ Embed it directly in frontend code that runs in the browser in production
(People can “View Source” or inspect your bundle and steal it.)
For tools like SVG ORA Studio, the idea is usually:
👉 The user pastes their own Gemini key locally in their browser. That’s fine as long as the app doesn’t secretly send it anywhere else.
7. (Optional) Name and organize your key
For clarity, you can rename the key:
- In the API Keys list, click the three dots (⋮) next to your key.
- Choose Rename.
- Use something like:
svg-ora-studio-devpic-2-code
You can also manage multiple keys and projects from AI Studio’s Projects and API Keys pages. Google AI for Developers+1
8. Quick test: Use your Gemini key in code
Just to prove it works, here’s a simple example using the Google Gen AI SDK for JavaScript / TypeScript (official library). Google AI for Developers+2Google for Developers+2
Install the SDK
npm install @google/genai
Simple Node.js example
import { GoogleGenerativeAI } from "@google/genai";
const apiKey = process.env.GEMINI_API_KEY; // set in your .env
const genAI = new GoogleGenerativeAI(apiKey);
async function run() {
const model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" });
const result = await model.generateContent("Say hello in one short sentence.");
console.log(result.response.text());
}
run().catch(console.error);
If you see a response in the console like
“Hello! Great to meet you 👋”
…then your API key is working.
9. Free tier, limits, and billing (short version)
Some essentials:
- Gemini API has a free tier + pay-as-you-go paid tier. Google AI for Developers+1
- Free tier has rate limits (requests per minute / per day) depending on the model and region. Google AI for Developers+1
- AI Studio usage (the playground UI) is generally free, but API calls from your own app are subject to free/paid tier rules. gemini-api.apidog.io+1
If you start doing heavy usage or go beyond limits, you’ll need to:
- Link a billing account to your project.
- Monitor costs via Google Cloud Billing.
10. How to rotate or delete your key (if it leaks)
If you accidentally exposed your key:
- Go back to AI Studio → API Keys.
- Find the compromised key → click ⋮ → Delete or Revoke.
- Create a new key.
- Update your
.env/ server config with the new key.
Old key stops working immediately once revoked, so no one can abuse it.
Conclusion
Generating your own Gemini API key is surprisingly simple—and once you have it, you unlock the full power of Google’s AI models inside your own tools, apps, and experiments. Whether you’re building something small like a personal script or a full production-ready application, the API key is your gateway to text generation, image understanding, chat-based workflows, and advanced reasoning.
By following the steps above—signing into AI Studio, creating a project, generating a key, and keeping it secure—you’re now fully equipped to start integrating Gemini into anything you build. Treat your key like a password, store it safely, and use environment variables to keep your projects secure.
Now that your key is ready, the real fun begins:
✨ Build tools, automate tasks, prototype apps, or power AI features in your own projects.
Your creativity is the only limit.

