If you have your API key ready, you can add it in one of these ways:
- Create a file named
.envin the project root (same folder asrequirements.txt) - Add this line:
OPENAI_API_KEY=your-actual-api-key-here - The system will automatically load it when you run the app
Note: The .env file is already in .gitignore so it won't be committed to git.
Windows PowerShell:
$env:OPENAI_API_KEY="your-actual-api-key-here"
python web_app.pyWindows CMD:
set OPENAI_API_KEY=your-actual-api-key-here
python web_app.pyLinux/Mac:
export OPENAI_API_KEY="your-actual-api-key-here"
python web_app.pyYou can also add it directly to config/config.yaml (though this is less secure):
ai:
enabled: true
api_key: "your-actual-api-key-here" # Not recommended for productionIf you don't have one yet:
- Go to https://platform.openai.com/api-keys
- Sign in or create an account
- Click "Create new secret key"
- Copy the key (it starts with
sk-)
When you run python web_app.py, you should see:
✓ AI/LLM service initialized
If you see:
Warning: OPENAI_API_KEY not set. Falling back to pattern matching.
Then the API key isn't being found. Check:
- The
.envfile exists and has the correct format - The environment variable is set (if using Option 2)
- No typos in the key name
Never commit your API key to git! The .env file is already in .gitignore for safety.