gemini
Test your Google Gemini API key.
Verify a Google Gemini API key from AI Studio in seconds — see which Gemini 2.0 / 2.5 models the key has access to, and benchmark the latency.
Stateless proxy — keys never logged, stored, or persisted. What happens to your key →
What this key does
A Gemini API key authenticates against Google's Generative Language API: generateContent, streamGenerateContent, embedContent, and the count-tokens helper. Keys are passed as a query parameter (?key=AIza...) rather than a header. Free-tier keys talk to the same endpoints, just with stricter rate limits.
How to get a Google Gemini API key
- Open aistudio.google.com/app/apikey.
- Click Create API key, choose the Cloud project, and approve the consent screen.
- Copy the AIza... key.
- Paste it here. We'll list the models accessible to your project.
- If you plan to ship to production, link a billing account — free-tier rate limits will not be enough.
Common errors and fixes
- 401 Unauthorized: Key is invalid, revoked, or pasted with extra whitespace. Generate a new key from the provider console and try again.
- 403 Forbidden: Key is valid but lacks permission for this resource. Check project / org / workspace scope, or that billing is set up for this key.
- 429 Too Many Requests: You hit the per-minute or per-day rate limit. Wait a moment and retry, or upgrade your tier.
- 404 Not Found: The endpoint or model id changed. Check the provider docs for the current path and model identifier.
- 5xx: The provider is having issues. Check their status page before assuming the bug is yours.
Security best practices
- Store keys in an env var or secret manager — never commit them to a repo, even a private one.
- Restrict scope: prefer per-project or per-deployment keys over a single root key shared across services.
- Rotate on a schedule (90 days is a sane default) and immediately on suspected leak.
- Audit usage in the provider console after rotation to confirm the old key has zero traffic.
- Set per-key spend limits where the provider supports them, so a leaked key has a bounded blast radius.
- Restrict the key in the GCP console to the Generative Language API only — IAM lets you scope a key to specific Google APIs.
Pricing at a glance
Gemini Flash is among the cheapest production-grade chat models on the market. Pro is priced higher but offers a much larger context window. Free tier exists but has aggressive RPM caps; switching to a billed key is the difference between 15 RPM and 1000+ RPM on Flash.
FAQ
- Is the AIza... key the same as a Google Cloud API key?
- Yes — Gemini keys are standard GCP API keys with the Generative Language API enabled. You can manage them from console.cloud.google.com.
- Why does my Gemini key only work for a few requests then 429?
- Free-tier RPM caps. Link a billing account and the same key starts hitting paid-tier limits.
- Can I use the same key on AI Studio and Vertex AI?
- No. Vertex AI uses Google Cloud auth (service accounts / ADC), not API keys. The AIza key is AI Studio only.
- Which Gemini model should I default to?
- gemini-2.0-flash for cost-sensitive workloads, gemini-2.5-pro for long-context reasoning. Always pull the live model list to see what's enabled.
- Are responses safe to log?
- Be careful with safety attributes — they can leak prompt content. Strip them before logging.
- How is the latency from outside the US?
- Generative Language API is hosted in us-central1 by default. From APAC you'll see ~150-250ms extra. Vertex AI offers regional endpoints if that's a problem.
Test other providers
Related reading
- How to get a Google Gemini API keyGenerate a Gemini API key from Google AI Studio, switch to a billed project, and avoid the free-tier surprises.
- API key security best practices for LLMsHow to store, scope, rotate, and revoke LLM API keys without leaking them through git, logs, or shared environments.
- Free LLM API keys for testing in 2026Which providers offer free credits, how long they last, and how to stretch them for prototyping without a credit card.