A Gemini API key authenticates your calls to Google's Gemini models: each request carries the key in the Authorization header, and the platform measures and bills usage through it. There are two ways to create a Gemini API key — directly through Google AI Studio (official), or through Kunavo: an OpenAI-compatible key that works with Gemini, Claude, GPT, and image/video models, with no Google Cloud project required.
Option 1 — Create a Google AI Studio API key (official)
If Gemini is the only model you'll ever call, get the key directly from Google:
- Go to
aistudio.google.comand sign in with a Google account. - Open Get API key → Create API key. Keys start with
AIza…and are shown only once. - The free tier is rate-limited and suitable for prototyping. For production, link the key to a Google Cloud billing account.
This is the right option as long as you only need Gemini. Once you also use Claude, GPT, or image and video models, you'll manage a separate key, SDK, and bill for each provider.
Option 2 — Create a Gemini API key through Kunavo (recommended for production)
Kunavo puts Gemini behind an OpenAI-compatible API. A single sk-kn- key accesses all models through the same endpoint — no Google Cloud project required, Gemini around 70% below Google's list price ($0.09 / $0.75 per 1M tokens), one Stripe balance, and pay-as-you-go starting with a $10 minimum top-up. The balance covers Gemini, Claude, GPT, and image and video models together, and never expires.
- Sign up. Create a Kunavo account at
kunavo.com. - Add $10. Pay-as-you-go with a $10 minimum top-up; your balance never expires.
- Create a key. Generate a key at
/app/keys. It starts withsk-kn-and is shown only once — store it in an environment variable. - Make a call. Point the OpenAI SDK to
https://api.kunavo.com/v1and call a Gemini slug.
Quickstart
Keep the official OpenAI SDK. You only need to change base_url and the model name — nothing else.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["KUNAVO_API_KEY"],
base_url="https://api.kunavo.com/v1", # die einzige Zeile, die sich ändert
)
resp = client.chat.completions.create(
model="gemini-2-5-flash",
messages=[{"role": "user", "content": "Fasse die Handlung von Dune in zwei Sätzen zusammen."}],
)
print(resp.choices[0].message.content)The same pattern works for Node.js and curl; for per-model rates and worked cost examples, see the Gemini API pricing guide.
Keep your key secure
- Use environment variables instead of source code. Never store the key in your repository; read it from an environment variable. Never expose it in browser or mobile bundles — always proxy through your own server.
- Use one key per project or environment. That way, a leaked key can be revoked without disrupting everything else.
- Rotate regularly. Kunavo allows multiple active keys, so rotation is a clean overlap rather than a hard cutover.
- Set spending limits per key. Set limits for each key in the dashboard and monitor
/app/usagefor unexpected traffic by key.
Frequently asked questions
How do I create a Google Gemini API key?
There are two ways. Official: go to aistudio.google.com, sign in with a Google account, and click “Get API key” → “Create API key”; the key starts with AIza… and is shown only once. Through Kunavo: sign up at kunavo.com, add at least $10, create a key under /app/keys, and point the OpenAI SDK to https://api.kunavo.com/v1. The second option doesn't require a Google Cloud project, and the same key also works with Claude, GPT, and image and video models. Both take less than five minutes.
How do I create an API key in Google AI Studio?
In Google AI Studio, go to aistudio.google.com, sign in with your Google account, click “Get API key” in the upper left, then “Create API key” and choose an existing or new Google Cloud project. The key is shown exactly once — copy it immediately and store it in an environment variable. The free tier is rate-limited; for production volume, link the project to a Google Cloud billing account.
What is a Gemini key, and where can I find it again?
A Gemini key is a string that authenticates every request to Google's Gemini models and associates it with billing; it is sent in the Authorization header. Google shows the full key only when it is created — afterward, Google AI Studio shows only its name and creation date. If you lose the key, delete it and create a new one; it cannot be recovered. Kunavo works the same way: the key is shown once, and afterward /app/keys displays only its metadata and usage.
Why isn't my Gemini API key working?
The most common cause of API_KEY_INVALID is an incompletely copied key or a space or line break in the environment variable. Other common causes include the key belonging to a different Google Cloud project, the Gemini API not being enabled for the project, or the key having been revoked. First check that the value starts exactly with AIza. For a Kunavo key, the most common cause is depleted balance — this returns 402, not 401. See the invalid Gemini API keys guide for the full list of errors.
Is the Gemini API free?
Google AI Studio issues a free-tier key with low rate limits, which is enough for prototyping. Production traffic uses paid billing. Kunavo is pay-as-you-go with a $10 minimum top-up, no separate Google Cloud billing account required, and your balance never expires.
Can I get a Gemini API key without a Google Cloud account?
Yes. A Google AI Studio key works for prototyping without a Google Cloud project, but it is rate-limited; Google requires a Google Cloud billing account for production volume. A Kunavo key needs no Google Cloud project at all — call Gemini through the OpenAI-compatible endpoint and pay once through Stripe.
Gemini key vs. Kunavo key — what's the difference?
A Google key calls only Gemini and is billed through a Google Cloud account. A Kunavo key calls Gemini along with Claude, GPT, image, and video models through an OpenAI-compatible API, using a single Stripe balance — without a Google Cloud project. Model prices are in the Gemini API pricing guide.
Which Gemini model should I start with?
Start with gemini-2-5-flash for everyday chat, extraction, and summarization — it's fast and very inexpensive. Switch to gemini-3-1-pro for more demanding reasoning, vision, and long-context analysis.