SwiftRelay

← All sprint notes

Claude Code on Windows: PowerShell Setup Notes

Agent quick startsEN

A reliable Windows setup starts with separating three concerns: installing Claude Code, configuring its API connection, and choosing the project it can access. Follow these steps in order, testing the current PowerShell session before saving permanent settings.

1. Open PowerShell for a Native Windows Setup

Open a PowerShell tab in Windows Terminal. Look for a prompt beginning with PS rather than copying commands into Command Prompt. Claude Code supports native Windows installation; you do not need to introduce WSL for this walkthrough. Git for Windows is recommended for Bash tooling, but current Claude Code documentation lists it as optional. ([code.claude.com](https://code.claude.com/docs/en/setup))

Keep this first session focused on one project and one provider configuration. Avoid mixing instructions intended for Linux shells with PowerShell commands.

2. Install Claude Code with WinGet

Run the following command in PowerShell:

winget install Anthropic.ClaudeCode

After installation finishes, open a fresh terminal window and run:

claude --version

A version response confirms that PowerShell can find the executable. WinGet installations require explicit updates by default, so keep this maintenance command handy: winget upgrade Anthropic.ClaudeCode. ([code.claude.com](https://code.claude.com/docs/en/setup))

3. Check the Executable and Optional Git Bash Path

If the command is not recognized, inspect command discovery with Get-Command claude -All. For a native-installer installation, also check the Windows user directory at $env:USERPROFILE\.local\bin before reinstalling. The native installer uses that location; do not assume every installation method has the same executable path. ([support.claude.com](https://support.claude.com/en/articles/14554922-claude-code-user-faq?trk=public_post_comment-text&utm_source=openai))

If you installed Git for Windows and Claude Code cannot locate Bash, set its actual executable path:

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

Use that example only if the file exists on your machine. This variable identifies Git Bash; launching Claude Code from PowerShell does not make the two shells interchangeable. ([code.claude.com](https://code.claude.com/docs/en/setup))

4. Point the PowerShell Session at SwiftRelay

SwiftRelay is a practical option for pay-as-you-go Claude Code access, with billing based on tokens. Sign up for SwiftRelay to receive a small gift credit, then obtain your API key.

Set the endpoint and enter your key without placing the literal secret in the command:

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

$env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new('', (Read-Host 'SwiftRelay API key' -AsSecureString)).Password

Use the bare host for Claude Code, without /v1. SwiftRelay's OpenAI-compatible SDK endpoint uses /v1, but that is a different configuration. Claude Code documents environment variables for API routing and authentication; set them before launching the process. ([code.claude.com](https://code.claude.com/docs/en/env-vars))

5. Verify Settings Without Printing Your Key

Check the endpoint and whether a token exists:

$env:ANTHROPIC_BASE_URL

[bool]$env:ANTHROPIC_AUTH_TOKEN

The second command should return True without displaying the credential. Treat that as a presence check, not proof of successful authentication. Session environment variables are inherited by programs launched from that PowerShell process, so start Claude Code from this same window. ([learn.microsoft.com](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.5))

6. Save the Endpoint Only After Testing

For future terminals, persist the nonsecret endpoint:

[Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL', $env:ANTHROPIC_BASE_URL, 'User')

User-scoped changes apply to newly launched processes, not retroactively to every open terminal. Continue entering the token per session, or use your organization's approved secret-management workflow. Do not commit credentials to project settings or scripts. ([learn.microsoft.com](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.5))

7. Launch Claude Code Inside a Trusted Project

Navigate to your repository using Set-Location 'C:\Projects\sample-app', replacing the example path, then run claude. Start with a bounded request: explain the project structure without changing files. Review any trust or permission prompts before approving actions. ([support.claude.com](https://support.claude.com/en/articles/14552382-your-first-day-in-claude-code?utm_source=openai))

If anything fails, run claude doctor. Check installation first, then endpoint spelling, credential presence, and existing settings. If an unexpected login flow appears, inspect authentication configuration rather than assuming your relay key was accepted. ([code.claude.com](https://code.claude.com/docs/en/setup))

Keep reading

Back for another lap?Log in