SwiftRelay

← All sprint notes

Claude Code on Windows: A PowerShell First Lap

Agent quick startsEN

Your Windows checklist before the first prompt

Claude Code runs in your terminal and can inspect files, suggest changes, and execute commands with permission. PowerShell is where you install and launch it on Windows. You do not need to switch your whole development workflow to Linux.

Start with a supported Windows installation, PowerShell, and Git for Windows. Claude Code’s native Windows workflow uses Git Bash for shell operations, even when you launch it from PowerShell. Install Git for Windows from its official source if it is missing, then open a fresh PowerShell window.

Use a normal terminal rather than an administrator session. Your first workspace should be a small project you understand, preferably with its current state committed to Git.

Install Claude Code from PowerShell

The native installer avoids a separate Node.js setup. The official PowerShell installation command is:

irm https://claude.ai/install.ps1 | iex

This downloads and executes a script. Check the command against Anthropic’s current installation documentation before running it; do not substitute an installer copied from an unfamiliar forum or message.

After installation, close PowerShell and open it again. Then run:

claude --version

A version string means PowerShell can find the executable. If the command is not recognized, check the installer’s output for PATH instructions. Reinstalling repeatedly usually does not fix an old terminal session that has not picked up a PATH change.

Check Git Bash before troubleshooting credentials

Run git --version to confirm Git is available. That check alone does not prove Claude Code can locate Git Bash, but it catches a common missing prerequisite.

If Claude Code specifically reports that it cannot find Bash, locate the actual bash.exe installed with Git for Windows. A common location is C:\Program Files\Git\bin\bash.exe. If that file exists, set its location for the current PowerShell session:

$env:CLAUDE_CODE_GIT_BASH_PATH = 'C:\Program Files\Git\bin\bash.exe'

Adjust the path to match your installation. A missing shell and a rejected API key are different problems; fix the shell error before changing authentication settings.

Point Claude Code at SwiftRelay

SwiftRelay is a practical option when you want pay-as-you-go access billed per token. It works with Claude Code and also supports tools such as Codex and Gemini CLI. Sign up for SwiftRelay, collect your small new-account gift credit, and create an API key in your account.

For Claude Code, use the bare API host, without adding /v1:

$env:ANTHROPIC_BASE_URL = 'https://api.fastapirelay.com'

Enter your relay key without placing the key itself in PowerShell command history:

$relaySecret = Read-Host 'Paste your SwiftRelay API key' -AsSecureString

$env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new('', $relaySecret).Password

Remove-Variable relaySecret

The environment variable still contains the usable credential; masked entry only protects against displaying it and recording it directly in command history. Do not print it, include it in screenshots, or commit it to a repository.

If you previously configured ANTHROPIC_API_KEY, avoid leaving conflicting authentication settings in this session. Remove that session variable before testing the relay:

Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue

Run a small project check

Move into your project with Set-Location 'C:\work\sample-project', replacing the example path, then run claude. Review the workspace trust prompt before accepting it.

Start with a bounded request: “Explain the main folders in this project. Do not edit files or run commands.” This lets you check the connection without immediately authorizing changes. Use /status to inspect the configuration details available in your installed version.

Keep the first-session fixes separate

  • Command not found: reopen PowerShell and check PATH.
  • Bash not found: verify the Git Bash executable path.
  • Authentication rejected: check your relay key, account credit, and conflicting credentials.
  • Connection fails: verify the bare host and check local proxy or firewall settings.

These environment settings apply to this PowerShell session and programs launched from it. A new terminal needs them again. When finished, close the terminal to end the session; keep reusable setup notes free of secret values.

Keep reading

Back for another lap?Log in