Claude Code is Anthropic's coding CLI. This guide shows how to install it on each supported platform, connect it to ApiPass, and check the credits deducted for each request.
Make sure you have:
Windows users can run Claude Code natively in PowerShell or inside WSL2. If you are working on Windows projects directly, native PowerShell is the simpler path. If your project already lives in WSL2, keep both installation and configuration inside WSL2.
Anthropic's current native installer is the simplest option:
1curl -fsSL https://claude.ai/install.sh | bashHomebrew is also supported:
1brew install --cask claude-codeIf you prefer npm in an existing Node.js environment, you can still use:
1npm install -g @anthropic-ai/claude-codeVerify the installation:
1claude --version
2claude doctorInstall Claude Code with the native Windows installer:
1irm https://claude.ai/install.ps1 | iexWinGet is also supported:
1winget install Anthropic.ClaudeCodeAnthropic recommends Git for Windows on native Windows so Claude Code can use Bash tooling when available. If Git for Windows is not installed, Claude Code falls back to PowerShell.
Verify the installation:
1claude --version
2claude doctorOpen your WSL2 distribution and run the Linux install command from this section inside the WSL shell.
1curl -fsSL https://claude.ai/install.sh | bashDo not use WSL1. If your codebase already lives in WSL2, keep the whole Claude Code setup there.
Native installs update automatically in the background. Homebrew and WinGet installs update when you run their package manager upgrade commands.
Claude Code reads its API routing from environment variables. For ApiPass, point the base URL at the ApiPass gateway and set your ApiPass API key as the auth token.
1export ANTHROPIC_BASE_URL="https://api.apipass.dev"
2export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"To persist the settings:
1echo 'export ANTHROPIC_BASE_URL="https://api.apipass.dev"' >> ~/.zshrc
2echo 'export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"' >> ~/.zshrc
3source ~/.zshrcIf you use bash, write the same lines to ~/.bashrc instead.
For the current session:
1$env:ANTHROPIC_BASE_URL = "https://api.apipass.dev"
2$env:ANTHROPIC_AUTH_TOKEN = "YOUR_API_KEY"For a persistent user-level setting:
1[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.apipass.dev", [System.EnvironmentVariableTarget]::User)
2[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "YOUR_API_KEY", [System.EnvironmentVariableTarget]::User)Set the same variables inside the WSL shell:
1export ANTHROPIC_BASE_URL="https://api.apipass.dev"
2export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"Keep the WSL2 config separate from native Windows PowerShell. Files, environment variables, and auth state are different between the two shells.
Start Claude Code in the project you want to work on:
1claudeYou can also use one-off prompts after the interactive session opens. Claude Code will keep the conversation in the same terminal session.
ApiPass deducts credits when Claude Code requests are processed. The exact amount depends on the model, token usage, and the active pricing rule for your key or account.
Use these pages to inspect what was charged:
In the logs table, the Credits column shows the deduction for each request. Opening a row's details shows the request payload and token counts. In the usage page, the Claude Code section shows totals, model mix, and trend charts.
If your API key has Claude Code enabled, you can manage that setting on the API Keys page. The concurrent_limit setting controls how many Claude Code sessions can run at once for that key.
claude: command not foundReopen your terminal after installation and run:
1claude --versionIf the command is still missing on Windows, check whether Claude Code installed into the expected PATH and confirm that Git for Windows or the native installer completed successfully.
Check that ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are both set in the same shell where you launch claude.
If you are on Windows, make sure you set the variables in either PowerShell or WSL2, not both, unless you deliberately use both shells.
If Claude Code shows a connection or 404 error, confirm that the base URL is exactly:
1https://api.apipass.devDo not point Claude Code at a subpath unless your deployment specifically routes Claude Code traffic there.
If you also want to set up Codex, open the related guide in the sidebar or go directly to Codex CLI Tutorial.