A Gemini API key is a bearer credential that authenticates calls to Google's Gemini models. There are two ways to get one: get it from Google AI Studio (official), or use Kunavo's single OpenAI-compatible key to call Gemini, Claude, GPT, and image/video models together (no Google Cloud project required). This guide covers both methods and how to choose between them for production.
Method 1 — Google AI Studio (official)
If you only use Gemini, getting a key directly from Google is the straightforward choice.
- Sign in to
aistudio.google.comwith your Google account. - Open Get API key → Create API key. The key has a format like
AIza.... - A free tier with rate limits is available for prototypes. For production volume, you need to link the key to a Google Cloud project with billing enabled.
If Gemini is the only model you'll call, this is the right path. But if you also use Claude or image and video models, you'll manage separate keys, SDKs, and bills for each provider.
Method 2 — Kunavo (recommended for production)
Kunavo puts Gemini behind an OpenAI-compatible API. A single sk-kn- key reaches Gemini and all the other models, with one wallet and Stripe billing; no Google Cloud project is required. Gemini costs around 70% below Google's list prices, and pay-as-you-go starts at $10.
- Sign up — create an account at kunavo.com.
- Top up $10 — pay as you go; your balance never expires.
- Create a key — create one at
/app/keys. It starts withsk-kn-and is shown only once, so save it in an environment variable. - Make a call — point the OpenAI SDK's
base_urltohttps://api.kunavo.com/v1and specify a Gemini slug.
You can also compare the two approaches in the Gemini API key documentation. For a pricing breakdown, see the Gemini API pricing guide.
Quickstart
Keep using the official OpenAI SDK. Change only base_url and the model name.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["KUNAVO_API_KEY"],
base_url="https://api.kunavo.com/v1", # 変更するのはこの 1 行だけ
)
resp = client.chat.completions.create(
model="gemini-2-5-flash", # Gemini モデルのスラッグを指定
messages=[{"role": "user", "content": "Gemini を一文で説明して。"}],
)
print(resp.choices[0].message.content)Key security
- Use environment variables. Read the key from an environment variable such as
KUNAVO_API_KEY, rather than hard-coding it in your code. Browser and mobile bundles are public, so never expose the key on the client side; always proxy requests through your own server. - Rotate keys regularly. Kunavo allows multiple active keys at once, so rotation can happen with a clean overlap rather than a hard cutover. Aim to rotate quarterly.
- Set a limit for each key. Set a per-key limit in the dashboard and use separate keys for each project or environment, so if one leaks, you can revoke that key without taking everything else down. Monitor
/app/usageto track traffic by key.
Frequently asked questions
Is the Gemini API free?
Google AI Studio issues a key with a free tier and rate limits. It's enough for prototyping, but production traffic moves to paid billing. Kunavo is pay-as-you-go starting with a minimum $10 top-up, requires no Google Cloud billing account, and the balance never expires.
Can I get a Gemini API key without a Google Cloud account?
Yes. Kunavo's sk-kn- key reaches Gemini through an OpenAI-compatible endpoint, so no Google Cloud project is needed. Sign up, top up your balance, and create a key to start calling Gemini right away.
Can I use Gemini with the OpenAI SDK?
Yes. Kunavo exposes Gemini behind an OpenAI-compatible /v1/chat/completions endpoint, so you can keep using the official OpenAI SDK and only change base_url to https://api.kunavo.com/v1 and model to a Gemini slug such as gemini-2-5-flash.
What's the difference between a Google Gemini key and a Kunavo key?
A Google key calls only Gemini and is billed through a Google Cloud account. A Kunavo key reaches Gemini, Claude, GPT, and image/video models through one OpenAI-compatible API, with consolidated billing via Stripe. Gemini is available below Google's list prices.