Skip to content

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:

bash
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

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:

bash
# 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:

bash
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:

bash
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:

bash
export OPENROUTER_API_KEY="sk-or-..."

Which Key Should You Get?

If you...Get
Want the simplest setupNone (use mock LLM)
Want to follow the course exactlyAnthropic (Claude Sonnet)
Already have OpenAI accessOpenAI (GPT-4o or o3-mini)
Want the cheapest optionGemini (Flash is $0.15/M)
Want to try different modelsOpenRouter (one key for everything)

Testing Your Key

bash
# 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

ProviderFree CreditsRate Limit
Anthropic$5-10 signup creditVaries by model
OpenAI$5-18 signup creditVaries by tier
GeminiFree tier (60 req/min)60 requests/minute
OpenRouterVaries by modelVaries

The course uses ~$0.50-2.00 in API costs total with Anthropic, or $0 with the mock LLM.

Last updated:

FDSA Agency — Agentic Engineering Course. Part of the fdsa.ai orchestration platform.