Setting Environment Variables for Claude Code in Windows
Method 1: PowerShell Command (Recommended)
powershell
$env:ANTHROPIC_BASE_URL = "https://claude.ctok.ai/api/"
$env:ANTHROPIC_AUTH_TOKEN = "your-key"
Method 2: Command Prompt (CMD)
cmd
set ANTHROPIC_BASE_URL=https://claude.ctok.ai/api/
set ANTHROPIC_AUTH_TOKEN=your-key
Method 3: Permanent Setup (Using setx command)
cmd
setx ANTHROPIC_BASE_URL "https://claude.ctok.ai/api/"
setx ANTHROPIC_AUTH_TOKEN "your-key"
Method 4: Graphical Interface Setup
- Right-click "This PC" → "Properties"
- Click "Advanced system settings"
- Click "Environment Variables"
- Click "New" in "User variables" or "System variables"
- Add the two variables separately
Verify Your Setup
After setup, you can verify with the following commands:
PowerShell:
powershell
echo $env:ANTHROPIC_BASE_URL
echo $env:ANTHROPIC_AUTH_TOKEN
CMD:
cmd
echo %ANTHROPIC_BASE_URL%
echo %ANTHROPIC_AUTH_TOKEN%
Note:
- Methods 1 and 2 are only valid for the current session
- Methods 3 and 4 will save permanently
- After using setx, you need to reopen the command line window for changes to take effect