Claude Code on Windows: setup and common errors
Most Claude Code problems on Windows come from macOS commands that do not work in PowerShell or CMD. Here is a setup that works the first time, and fixes for the usual errors.
Install
- Install Node.js 18 or newer from nodejs.org (the LTS button), then close and reopen the terminal.
- Install Claude Code:
npm install -g @anthropic-ai/claude-code. - Open a terminal in your project folder. Check which one it is: blue PowerShell (the default in Windows 10/11 and VS Code) or black CMD.
Set the key in PowerShell
$env:ANTHROPIC_BASE_URL="https://api.klinch.cloud"
$env:ANTHROPIC_AUTH_TOKEN="kl_live_…"
claude
Set the key in CMD
set ANTHROPIC_BASE_URL=https://api.klinch.cloud
set ANTHROPIC_AUTH_TOKEN=kl_live_…
claude
These last until the window is closed. To keep them, create C:\Users\name\.claude\settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.klinch.cloud",
"ANTHROPIC_AUTH_TOKEN": "kl_live_…",
"ANTHROPIC_MODEL": "claude-sonnet-5-5"
}
}
Common errors
| What you see | What to do |
|---|---|
| It asks to sign in to Anthropic or pick a plan | The variables did not reach it. export does not work on Windows: PowerShell needs $env:, CMD needs set. settings.json is the most reliable. |
| Auth conflict, the old account is used | Run /logout in Claude Code, close it and remove the ANTHROPIC_API_KEY variable. |
| 404 Not found | ANTHROPIC_BASE_URL has no /v1 and no trailing slash. |
| 401 Invalid API key | A space or quote got into the key. Copy it with the copy button; the key starts with kl_live_. |
| Worked yesterday, asks to sign in today | $env: and set last until the window closes. Use settings.json or setx. |
| «claude» is not recognized | The terminal was opened before the install. Close every terminal window and open a new one. |
A step by step guide with a key check is in the cabinet under Connect. More on running it without a subscription: Claude Code without a Max plan.