Every live example in the AI Engineer course runs on Google's Gemini API free tier: no card, no bill. This page shows how to get a key, where to run the code, which models the lessons use, and what to do when the free tier says "slow down".
1. Get a free API key (2 minutes)
- Open Google AI Studio and sign in with a Google account.
- Press Create API key. If asked, let it create a new project.
- Copy the key. Treat it like a password: never put it in code, a chat, a screenshot or GitHub.
No card is needed. If a page asks you to set up billing, you've gone to a paid option: go back.
2. Where to run the live examples
Live examples are marked "Run this in Google Colab or on your laptop". Practice questions run in your browser and need no key.
Option A: Google Colab (easiest, nothing to install)
- Open colab.research.google.com and start a new notebook.
- Click the key icon (Secrets) on the left, add a secret named
GEMINI_API_KEYwith your key, and allow notebook access. - In the first cell:
!pip install -q google-genai
import os
from google.colab import userdata
os.environ["GEMINI_API_KEY"] = userdata.get("GEMINI_API_KEY")
- Paste the lesson's live blocks into cells, in order, and run them.
In Colab, code that uses asyncio.run(main()) must be written as await main() instead, because Colab already runs an event loop.
Option B: your laptop
python -m venv .venv
.venv\Scripts\activate # Windows; on Mac/Linux: source .venv/bin/activate
pip install google-genai python-dotenv
Create a file named .env next to your code with one line, GEMINI_API_KEY=your-key-here, add .env to .gitignore, and load it at the top of your script:
from dotenv import load_dotenv
load_dotenv()
Later subjects add more packages (qdrant-client, mcp, fastapi, streamlit); each lesson says which.
3. The shop data
Lessons use the same online-shop data as the rest of the course. For live examples, download the files you need and put them next to your code (or upload them to Colab with the folder icon):
- help_articles.csv: the shop's help centre
- support_tickets.csv: labelled customer messages
- product_reviews.csv: reviews with star ratings
- orders.csv, customers.csv, products.csv, order_items.csv, payments.csv, returns.csv, web_sessions.csv, events.csv
4. The models the lessons use
| Use | Model name | Free tier |
|---|---|---|
| Text, chat, JSON, tool calls | gemini-3.5-flash-lite |
Yes, free of charge |
| Harder tasks, comparisons | gemini-3.6-flash |
Yes, with lower limits; often busy or slow (30 s or more per call when checked 2026-11-17) |
| Embeddings (RAG) | gemini-embedding-001 |
Yes, free of charge |
| An open-weights model through the same API | gemma-4-26b-a4b-it |
Yes |
Each example sets the name once, in a line like MODEL = "gemini-3.5-flash-lite". Google retires models every few months. If you get 404 NOT_FOUND … is not found for API version v1, the model has been retired or renamed: list the current ones and change that one line.
from google import genai
client = genai.Client()
for m in client.models.list():
print(m.name)
Model names ending in -latest don't work with the current Python SDK (it calls API version v1, where those aliases aren't available), so use the exact names above.
5. Free tier limits, and what to do when you hit them
The free tier limits how many requests and tokens you can use per minute and per day. Your exact limits are on the rate limits page in AI Studio. Two things to know:
- Limits apply per project, not per key: making more keys doesn't give you more.
- The daily request count resets at midnight Pacific time (about 1:30 PM IST).
- On 2026-11-16 (checked 2026-11), Google's error message gave the free limit for
gemini-3.5-flash-liteas 15 requests per minute per project. Space calls about 4 seconds apart in loops; the lessons' examples do.
| You see | It means | Do this |
|---|---|---|
429 RESOURCE_EXHAUSTED |
Too many requests or tokens | Wait a minute and retry; space calls a few seconds apart |
503 UNAVAILABLE, "high demand" |
The model is busy for everyone | Wait and retry, or switch to another model for now |
400 INVALID_ARGUMENT |
Your request is wrong | Fix the code; retrying won't help |
401 / 403 |
Key missing or wrong | Check GEMINI_API_KEY is set |
The lesson Cost, rate limits, retries and streaming shows how to retry properly with backoff.
6. Your data on the free tier
On the free tier, Google says it may use what you send to improve its products. So in this course:
- Use the course's shop data or other public data.
- Never send real customers' personal details, passwords or company secrets to a free-tier model.
Paid plans have different data terms. A real company project should use a paid plan or a model it hosts itself.
7. Want to work offline?
Ollama runs small open models on your own laptop, free and private (ollama pull gemma3:1b). They're slower and make more mistakes than the cloud models, so the lessons' sample outputs won't match, but the code ideas are the same. The lesson Choosing a model covers this.
8. Prices, if you ever go paid
You never need to pay for this course. For reference, Google's listed paid price for gemini-3.5-flash-lite is $0.30 per million input tokens and $2.50 per million output tokens, and gemini-embedding-001 is $0.15 per million input tokens (checked 2026-11-16 on Google's pricing page). Lessons use made-up example prices for practice, so the maths stays simple.