Prefer to watch? This post goes with the video (3:31). Open it on YouTube.
Why you need a key
Any program that asks Google's Gemini a question needs a key: your own code, an app, or Spark, the study buddy on this site. So why a key at all? Let's try to understand.
Say you join a library. The books are there for everyone, but to borrow one, you show your own card. The card says who is borrowing, and how many books that person may take.
Gemini works the same way. Each question you send uses a little of Google's computing, and your key tells Google that the question is yours.
Google also sets how much each key may ask, per minute and per day. Those limits change from time to time, so check them in AI Studio.
That card is what we call an API key. First, get your key. Then, if you are learning with us, give it to Spark.
Get your Gemini API key
It takes three steps, all in Google AI Studio.
Create the key
Open Google AI Studio → API keys and sign in with your Google account. Then click Create API key.
Give your key a name you will recognise, such as Learn AI by Building. Keep the Default Gemini Project, or create a project of your own, as in the recording. Then click Create key.
Copy the key
The key appears in API key details. Click Copy key, or the copy icon beside it, and paste the key wherever you need it.
Delete a key, when you are done with it
Come back here when you stop using a key, or when someone else may have seen it. On the API keys page, open the ⋮ menu on the key's row, click Delete key, then Delete.
Deleting cannot be undone, and anything using that key stops working. To carry on, make a new key and use the new one instead.
Check that you are 18 or older, and that your Google account has your age verified. Also check that you are in a country where the Gemini API works.
Keep your key safe
Your key is like a password: whoever has it can ask Gemini as you, and use up your limits.
- Never share it, not in a chat, an email, a screenshot or a comment.
- Paste it only where you trust the page. On this site, that is Spark, and nowhere else.
- If it may have leaked, delete it (step 3 above), and make a new one.
How programs use a key safely, and why it never goes into shared code, comes later in the series.
That is your key. If you came for the key alone, you are done; to use it on this site, read on.
Use your key with Spark
Every lesson on this site has Spark, our study buddy, and Spark thinks with Gemini using your own key. You give it the key once. It stays in this browser, and it goes only to Google, together with your question.
Open Spark
Open any lesson, for example Chapter 0, and press the round ✦ Spark button at the bottom right.
Paste your key
Paste the key into Your Gemini API key, where it shows only as dots. Then press Save key & start. If you came in through ⚙ settings, the button says Save settings instead.
Chrome may offer Save password? when you paste the key. Choose Never, because the key is not a password for this site.
Ask a question
Type into Ask about this unit and press the arrow. Start simple, with Hello Spark.
See the answer
Spark answers from the page you are on. Then ask it something real.
Clear the key before you leave. Open Spark's ⚙ settings, empty the key box, and press Save settings.
When Spark goes wrong
Read the message first, because Spark tells you what Google said. Here is what each message means, and what to do.
- "That API key was rejected by Google — let's re-enter it." Part of the key was missed, a space came along, or the key was deleted. Copy it again with Copy key, and paste it again.
- "The quota for your key is used up for now — wait a minute and try again." You asked more than your key may ask in a minute. Wait, and ask again; AI Studio's Rate Limit page shows your limits.
- A message from Google about your location or region. The Gemini API does not work in your country yet. The list of countries is in the references.
- Spark says nothing at all. Check your internet connection, reload the page, and try once more.
Still stuck? Use Gemini chat at gemini.google.com for now, and come back to Spark later.
Ask, then check
The goal: use Spark, and check it instead of trusting it.
The steps: open Chapter 0, connect Spark, and ask it one question about the page. Then check its answer against the page itself.
Guess first: before you read the answer, do you expect Spark to get it right?
One question for you: what is the first thing you asked Spark, and was it right?
References
Where each rule on this page comes from. Checked on 20 Oct 2026.
- Google — Gemini API: Using API keys. Where keys are created (AI Studio, API keys page), and the advice to treat a key like a password. link
- Google — Gemini API Additional Terms of Service. You must be 18 or older, and use the API from an available region. link
- Google — Gemini API: Available regions. The countries where Google AI Studio and the Gemini API work (India is one), and why access can be blocked. link
- Google — Gemini API: Rate limits. How much a key can ask, per minute and per day; the limits change, so check here. link
- Google — Gemini API: Troubleshooting. What to do when a key is rejected, blocked or reported as leaked: make a new one. link
New chapters and episodes come out every week. Follow along on YouTube or the WhatsApp channel. Questions? Ask under the video on YouTube; I read every comment.