Every DisSysLab office that uses an AI analyst needs an Anthropic API
key. This guide walks you through getting one and putting it where
dsl run can find it.
Time required: about 3 minutes.
Open console.anthropic.com and create an API key. Paid accounts get higher rate limits; a free account works for the gallery offices.
Your key starts with sk-ant- and is about 100 characters long.
Copy the whole thing to your clipboard. Anthropic only shows it
once — if you close the window you will need to generate a new one.
DisSysLab reads the key from a file named .env in the folder you run
dsl from, or in any folder above it. Put it in your course folder and
every office inside that folder finds it. The fastest way to create it —
on macOS, with the key still on your clipboard:
cd path/to/your/course/folder
echo "ANTHROPIC_API_KEY=$(pbpaste)" > .envThat's it. The file now contains exactly one line that looks like:
ANTHROPIC_API_KEY=sk-ant-api03-...(about 100 chars)...
On Linux the equivalent is xclip -o or xsel -b instead of
pbpaste. On Windows (PowerShell):
"ANTHROPIC_API_KEY=$(Get-Clipboard)" | Out-File -Encoding utf8 .envOpen .env in VS Code, nano, or any other plain-text editor.
Paste your key on a single line after ANTHROPIC_API_KEY=. Save.
Do not use TextEdit on macOS. TextEdit silently saves
.envas Rich Text Format (RTF), whichdsl runcannot read. If you've already used TextEdit, delete the file (rm .env) and recreate it with thepbpasteone-liner above, or with VS Code.
Run dsl doctor from the same folder:
dsl doctorYou should see:
Local .env:
[OK] .env format: ANTHROPIC_API_KEY present (prefix sk-ant-…, len 108)
Credentials:
[OK] ANTHROPIC_API_KEY: set (prefix sk-ant-…, len 108)
If anything says FAIL, jump to the next section.
dsl doctor prints a specific hint for each problem. The common ones:
TextEdit saved your file as rich text, not plain text. Fix:
rm .env
echo "ANTHROPIC_API_KEY=$(pbpaste)" > .envRe-copy your key to the clipboard first if needed.
You pasted terminal history into .env instead of a single
KEY=VALUE line. Same fix:
rm .env
echo "ANTHROPIC_API_KEY=$(pbpaste)" > .envThe file exists but doesn't have your key in it. Open .env and add
a line:
ANTHROPIC_API_KEY=sk-ant-api03-...
You probably copied only part of the key, or copied a placeholder.
Go back to console.anthropic.com,
copy the full key (starts with sk-ant-), and redo step 2.
The key was found but Anthropic rejected it. Either the key is revoked or you copied the wrong one. Generate a fresh key from console.anthropic.com and redo step 2.
Your shell is finding a different dsl binary than the one you just
installed. Check which one it's using:
which dsl
pip show dissyslab | grep -E '^(Version|Location)'If the which path is not inside the pip install location, you
probably forgot to activate your virtual environment:
source /path/to/your/venv/bin/activate
dsl --versiondsl looks for .env in the folder you run it from, then in each folder
above it, and uses the first it finds. So one .env in your course
folder serves every office inside it:
dsl_course/
.env <- ANTHROPIC_API_KEY=...
my_desk/
inbox_sorter/
dsl doctor, run from inside an office folder, names the .env file it
found. A key exported in your shell (export ANTHROPIC_API_KEY=...) is
used when no .env sets it.
Never commit .env to git. Anyone with the key can spend money on
your account.