An API key lets your app or script call Gemini models. You create it in Google AI Studio. Google changes the interface from time to time, so button names may differ slightly.
What you need
- A Google account.
- The service must be available in your region (availability depends on region and quotas).
- A browser — nothing to install.
Step by step
- Open aistudio.google.com and sign in with your Google account.
- Accept the terms of use if prompted.
- Find the “Get API key” button in the left menu.
- Create a key: pick an existing Google Cloud project or create a new one — the service offers this itself.
- Copy the key and save it right away somewhere safe, such as a password manager.
How to store the key safely
- Never put the key in code that goes to GitHub or other public places.
- Keep it in an environment variable or a separate config file that is not in the repository.
- Do not send it in chats or show it in screenshots.
- Create separate keys for separate projects so you can revoke just one.
What to do if the key leaks
Delete it immediately on the keys page in AI Studio and create a new one. Check the project’s usage; if you see requests you did not make, change your Google account password. Use the KiwiLab Password Generator for a strong one.
Free or paid
AI Studio has a free tier: it limits requests and available models, so treat it as a way to test an idea. The paid tier is billed by usage (mostly tokens). According to published descriptions, data submitted on the free tier may be used to improve models while the paid tier does not, so avoid sending sensitive information. Always check current terms in the service itself. For a general overview, see our Google AI Studio overview.
Common problems
- Service unavailable. Access depends on region and account — try another Google account or check the terms on the service site.
- Requests rejected because of limits. Wait or lower the request rate; the free tier runs out quickly.
- No “Get API key” button. The interface may have changed; look for the keys or projects section.
FAQ
Does an API key cost money?
Creating a key is free. The free tier has request limits; heavier usage is billed by usage.
Can I publish an API key on GitHub?
No. Anyone who finds it can use your quota or billing. Keep the key in an environment variable.
What is AI Studio and how is it different from Gemini?
Gemini is a ready-made chat for everyone; AI Studio is a developer environment: model settings, prototypes and API keys.