02 — Setting up the environment + API key
Duration: 10 min Prerequisites: Python 3.9+, an OpenAI account (free to create).
1. Clone the two repos
Section titled “1. Clone the two repos”mkdir project-2cd project-2
# Shared library (mandatory)git clone https://github.com/inskillflow/csv-llm-shared.git
# The OpenAI appgit clone https://github.com/inskillflow/csv-llm-openai.gitIf you already did Project 1, you already have csv-llm-shared/ cloned — you can reuse it (just clone csv-llm-openai/ next to it).
2. Install the Python deps
Section titled “2. Install the Python deps”pip install -r csv-llm-shared/requirements.txt # pandas, plotly, pyyamlpip install -r csv-llm-openai/requirements.txt # + streamlit, openai, python-dotenvSanity check:
python -c "import pandas, plotly, yaml, streamlit, openai, dotenv; print('OK')"3. Create an OpenAI API key
Section titled “3. Create an OpenAI API key”- Sign in at platform.openai.com.
- Go to Settings → Billing and add at least $1 of credit. (You can spend more later but $1 is the minimum payment.)
- Go to Settings → API keys → Create new secret key.
- Give it a name like
csv-llm-openai-courseand click Create. - Copy the key (
sk-...). You won’t see it again. Save it somewhere temporary (a sticky note window, not committed anywhere).
4. Store the key in .env
Section titled “4. Store the key in .env”The repo ships with a template:
copy csv-llm-openai\.env.example csv-llm-openai\.envOpen csv-llm-openai\.env in your editor and paste:
OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX5. Verify .env is gitignored
Section titled “5. Verify .env is gitignored”csv-llm-openai/.gitignore already contains:
.env.cache/__pycache__/Double-check with git status after copying:
cd csv-llm-openaigit statusExpected: no mention of .env. If you see .env listed as untracked, STOP, and verify .gitignore is correct before going further.
6. Smoke test (no Streamlit)
Section titled “6. Smoke test (no Streamlit)”Quick sanity check that your key works:
python -c @"import osfrom dotenv import load_dotenvload_dotenv('csv-llm-openai/.env')from openai import OpenAIclient = OpenAI()r = client.chat.completions.create( model='gpt-4o-mini', messages=[{'role':'user','content':'Say OK in one word.'}],)print(r.choices[0].message.content)"@Expected output:
OKIf you see OK, you’re good. If you see AuthenticationError, re-check the key and that the .env was loaded.
7. Verify the data path
Section titled “7. Verify the data path”The app reads csv-llm-openai/data/data1-anonymized.csv by default. Confirm it’s there:
ls csv-llm-openai\data\data1-anonymized.csv# expected: 1 file, ~57 KBIt should exist (the repo ships with it).
Cost expectations for the course
Section titled “Cost expectations for the course”Across the 7 chapters and 4 canonical questions, you’ll make roughly:
- 10 chat completions (test calls, demos)
- ~6,000 input tokens + ~3,000 output tokens total
- Total cost: under $0.005 — half a cent.
You’ll hit your $1 minimum hundreds of courses before running out.
Troubleshooting
Section titled “Troubleshooting”| Error | Likely cause | Fix |
|---|---|---|
AuthenticationError: Incorrect API key | Wrong key, or trailing whitespace in .env | Re-copy the key, no quotes, no spaces |
RateLimitError: 429 | New account, billing not active | Add $1 of credit in Settings → Billing |
ModuleNotFoundError: openai | Pip install missed | pip install -r csv-llm-openai/requirements.txt |
.env shows up in git status | Wrong .gitignore | Add .env to csv-llm-openai/.gitignore |
Takeaways
Section titled “Takeaways”- One key, one
.envfile, one.gitignoreentry — that’s the whole secret-management story. - Smoke test with
openai.chat.completions.create()confirms the key works. - Cost for the full course: under one cent.