-
Notifications
You must be signed in to change notification settings - Fork 128
How to Get Gemini API Key
Jdaie edited this page Dec 1, 2025
·
4 revisions
- Sign in to Google Cloud Console: https://console.cloud.google.com/
- Create or select a project: use the project dropdown → New Project (or choose an existing project).
- Enable the Gemini API: Console → APIs & Services → Library → search for "Gemini API" and click Enable.
- Create an API key: Console → APIs & Services → Credentials → Create Credentials → API key.
- Secure the key:
- Restrict the key by application type (HTTP referrers, IP addresses, or Android/iOS apps).
- Restrict the key to the Gemini API via API restrictions.
- Store keys in environment variables or a secure secret manager; do not commit them to source control.
- Test and rotate:
- Follow the Gemini API documentation for request examples and where to include the key.
- Regularly rotate keys and revoke unused keys.
- 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.