Setup

Setting up your environment

To setup your environment, cd to the week5 directory, and give the commands:

uv venv
uv sync
source .venv/bin/activate

Run this command to see if the packages installed correctly:

llm --version

You should see this:

llm, version 0.27.1

Configuring the OpenAI API key

You’ll need an OpenAI API key for this workshop. You can either get your own here:

https://platform.openai.com/api-keys

Or you can use a shared one created for this class. You’ll need the password that is distributed in class:

This shared key is restricted to the following models: gpt-5-mini, gpt-5-nano.

Key obtained, you can configure it for LLM like this:

llm keys set openai
# Paste your key here

Set your default model to be gpt-5-mini.

llm models default gpt-5-mini

Testing that it worked

Test that the keys works like this:

llm 'five fun facts about terrapins'

The key will be saved to a JSON file. You can see the location of that file by running:

llm keys path

A useful trick is that llm keys get openai will print the key out again. You can use this pattern to use that key with other tools that require an environment variable:

export OPENAI_API_KEY="$(llm keys get openai)"