API Key Setup Guide
Every lab needs at least one LLM API key. If you don't have one, the mock LLM handles everything offline.
Quick Start: Use the Mock LLM (No Key Needed)
All labs include automatic mock LLM fallback. Run without any setup:
python labs/L1-first-agent/solution.py test.txt "Summarize this file"The mock client returns realistic responses. Your code runs identically with real or mock LLM.
Provider Keys
Anthropic (Claude) — Recommended
Best for: All course labs. Claude Sonnet is the default model used throughout.
Cost: Free credits available on signup. Labs cost ~$0.01-0.05 each with Sonnet.
Get key: console.anthropic.com
Set it:
# Windows PowerShell
$env:ANTHROPIC_API_KEY="sk-ant-..."
# Mac/Linux
export ANTHROPIC_API_KEY="sk-ant-..."OpenAI (GPT)
Best for: Labs using the OpenAI SDK.
Cost: Free credits on signup. GPT-4o costs ~$0.02-0.10 per lab.
Get key: platform.openai.com/api-keys
Set it:
export OPENAI_API_KEY="sk-..."Google Gemini
Best for: Cost-sensitive experimentation. Gemini Flash is $0.15/M tokens.
Cost: Free tier available (60 requests/minute).
Get key: aistudio.google.com/apikey
Set it:
export GEMINI_API_KEY="..."OpenRouter (Multi-Provider)
Best for: Accessing multiple models from one key.
Cost: Pay-as-you-go. Free tier available for some models.
Get key: openrouter.ai/keys
Set it:
export OPENROUTER_API_KEY="sk-or-..."Which Key Should You Get?
| If you... | Get |
|---|---|
| Want the simplest setup | None (use mock LLM) |
| Want to follow the course exactly | Anthropic (Claude Sonnet) |
| Already have OpenAI access | OpenAI (GPT-4o or o3-mini) |
| Want the cheapest option | Gemini (Flash is $0.15/M) |
| Want to try different models | OpenRouter (one key for everything) |
Testing Your Key
# Anthropic
python -c "from anthropic import Anthropic; c=Anthropic(); print(c.messages.create(model='claude-sonnet-4', max_tokens=50, messages=[{'role':'user','content':'hi'}]).content)"
# OpenAI
python -c "from openai import OpenAI; c=OpenAI(); print(c.chat.completions.create(model='gpt-4o', messages=[{'role':'user','content':'hi'}]).choices[0].message.content)"
# Mock (no key needed)
python -c "from mock_llm import MockAnthropic; c=MockAnthropic(); print(c.messages.create(messages=[{'role':'user','content':'hi'}]).content[0].text)"Free Tier Limits
| Provider | Free Credits | Rate Limit |
|---|---|---|
| Anthropic | $5-10 signup credit | Varies by model |
| OpenAI | $5-18 signup credit | Varies by tier |
| Gemini | Free tier (60 req/min) | 60 requests/minute |
| OpenRouter | Varies by model | Varies |
The course uses ~$0.50-2.00 in API costs total with Anthropic, or $0 with the mock LLM.