Set up your machine
- ▸Install Python and create a virtual environment
- ▸Configure a .env file with your API keys
- ▸Verify the OpenAI API is reachable before the first session
This page sets up everything you need before Session 1. Finish it once and every session in the course will work. The stack is deliberately tiny: Python 3.10+, a virtual environment, and a .env file with your API keys.
Step 1 — Check your Python version
You need Python 3.10 or newer (3.12+ recommended for Session 6). Verify yours:
If it prints 3.10 or higher, you are good. Otherwise install Python from python.org or via Homebrew (`brew install python@3.12`).
Step 2 — Clone the course material
Grab the course folder your instructor shared with you (Session1, Session5, Session6, etc.). Open a terminal and `cd` into it:
Step 3 — Create a virtual environment
Each session folder has its own requirements. Create a venv inside the session folder you are starting with. Example for Session 1:
Step 4 — Install dependencies
This installs openai, python-dotenv, and any other libraries the session needs. Repeat this step once per session folder.
Step 5 — Create your .env file
Copy the example and open it in your editor:
Paste your OpenAI API key (and, for Session 6, your Anthropic and Google keys). The file should look like this:
OPENAI_API_KEY=sk-...your-key-here...
# Session 6 only
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
# Optional overrides
OPENAI_MODEL=gpt-4o-mini
ANTHROPIC_MODEL=claude-sonnet-4-5
GEMINI_MODEL=gemini-2.0-flashSee "Get Your API Keys" in the sidebar if you do not have keys yet.
Step 6 — Verify your setup
Run this tiny Python snippet to confirm the key is loaded and the API reachable:
from dotenv import load_dotenv
import os
from openai import OpenAI
load_dotenv()
assert os.getenv("OPENAI_API_KEY"), "OPENAI_API_KEY not set"
client = OpenAI()
resp = client.responses.create(
model="gpt-4o-mini",
input="Say 'setup working' in 3 words.",
)
print(resp.output_text)