File size: 1,586 Bytes
2f95553 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# Setting LLM API Keys
You can use either OpenAI or OpenRouter (or both) for LLM reasoning. Set whichever keys you have.
## Option A: OpenRouter (GPT-5-nano, etc.)
### Quick Setup (Current Session)
```powershell
$env:OPENROUTER_API_KEY = "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"
$env:OPENROUTER_MODEL = "gpt-5-nano" # optional override
```
### Make It Permanent
```powershell
[System.Environment]::SetEnvironmentVariable("OPENROUTER_API_KEY", "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", "User")
[System.Environment]::SetEnvironmentVariable("OPENROUTER_MODEL", "gpt-5-nano", "User")
```
### .env Example
```env
OPENROUTER_API_KEY=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
OPENROUTER_MODEL=gpt-5-nano
```
### Hugging Face Spaces
- `OPENROUTER_API_KEY`: `sk-or-...`
- `OPENROUTER_MODEL`: `gpt-5-nano` (optional, defaults to this)
---
## Option B: OpenAI (GPT-4o, etc.)
### Quick Setup
```powershell
$env:OPENAI_API_KEY = "sk-your-openai-api-key"
```
Or run:
```powershell
.\set_api_key.ps1
```
### Make It Permanent
```powershell
[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-openai-api-key", "User")
```
### .env Example
```env
OPENAI_API_KEY=sk-your-openai-api-key
```
### Hugging Face Spaces
- `OPENAI_API_KEY`: `sk-...`
---
## Verification
Run:
```powershell
python test_env.json.py
```
You should see at least one of the LLM keys marked as `set`, and `llm_enabled: true`.
|