Get your free Gemini API key
Create a free Google Gemini API key in AI Studio, add it to Purrx, and understand exactly where it is stored and how to keep it safe.
Every exercise in this course talks to a real model: your code, your key, Google's servers. No simulations or canned answers. That takes about five minutes of setup, so let's do it first.
Where the key comes from
Google AI Studio is Google's free website for the Gemini . You sign in with an ordinary Google account and it gives you an : a long string that tells Google the requests are yours. The is enough for this whole course.
- 1
Open Google AI Studio
Go to aistudio.google.com/apikey and sign in with your Google account. - 2
Create an API key
Click Create API key. If you are asked to pick a project, the default one is fine — you can always change it later. - 3
Copy it
Keys start withAIza. Copy the whole string. Treat it like a password: anyone who has it can use up your . - 4
Paste it below
Purrx checks the key with Google, then saves it to your Purrx account, encrypted.
Under the hood — What is an API key, exactly?
An API key is a long random string that identifies which account a request belongs to. That is all it does. It is not a password and there is no username beside it — possession is the whole of the proof.
That is why a leaked key matters: whoever holds it can spend your quota, and the server has no way to tell them from you. It is also why revoking is the fix rather than changing a password — you delete that identifier and issue a new one, and the old string instantly means nothing.
Larger systems add more on top: tokens that expire after an hour, scopes that limit what a credential may do, service accounts tied to one machine. A plain API key is the simplest point on that spectrum, which is what makes it good for learning and risky to scatter around.
Where your key actually lives
This matters, so here it is plainly. When you save your key:
- It is encrypted and saved to your Purrx account, so it works on every device you sign in on.
- When you run an exercise, your browser loads the key and your code runs in a sandboxed that calls Google directly. Exercise requests don't pass through Purrx.
- It is only ever used for your own requests. You can remove it in Settings at any time.
Two habits worth forming now
Restrict the key. In the Google Cloud console you can limit a key to specific APIs and to requests from specific websites. If a restricted key leaks, it is far less useful to whoever finds it.
Replace it whenever in doubt. If you ever paste a key somewhere public, like a screenshot, a gist or a support ticket, delete it in AI Studio and create a new one. It takes fifteen seconds and costs nothing.
Key takeaways
- Get a free key at aistudio.google.com/apikey. The free tier covers this whole course.
- Purrx encrypts your key, saves it to your account, and only uses it for your own requests.
- Treat a key like a password. If it ever leaks, delete it and create a new one.
Sign in to run the exercise
Reading is free. Writing code here needs an account so we have somewhere to keep your Gemini key and the +15 XP you are about to earn.