Skip to content

How to Get Gemini API Key

Jdaie edited this page Dec 1, 2025 · 4 revisions

To get a Gemini API key

  1. Sign in to Google Cloud Console: https://console.cloud.google.com/
  2. Create or select a project: use the project dropdown → New Project (or choose an existing project).
  3. Enable the Gemini API: Console → APIs & Services → Library → search for "Gemini API" and click Enable.




  1. Create an API key: Console → APIs & Services → Credentials → Create Credentials → API key.






  1. Secure the key (optional):
  • Restrict the key to the Gemini API (Generative Language API) via API restrictions.
  • Store keys in environment variables or a secure secret manager; do not commit them to source control.
  1. Test and rotate:
  • Follow the Gemini API documentation for request examples and where to include the key.
  • Regularly rotate keys and revoke unused keys.

Note — Billing and quotas

  • Google Cloud APIs are paid services; enable billing for the project to avoid interruptions.
  • New users may receive a free trial credit (check the console for current offers and terms).
  • Configure budgets, alerts, and quota monitoring in Billing → Budgets & alerts to avoid unexpected charges.
  • Review quota limits for the Gemini API and request increases if needed.

For exact request formats and SDK examples, see the official Google Cloud / Gemini API documentation in the Cloud Console.

Clone this wiki locally