Claude Code Deployment Guide
Covers installation, initialization, proxy access, common errors, and the complete deployment process.
Start with the official documentation: docs.claude.com
📋 Prerequisite
Complete the Node.js installation first and make sure Node.js 18+ is installed correctly.
⚡ Read Before Your First Install: Skip the Initialization Error
When you use a third-party API gateway, Claude Code displays the following error on its first launch:
Welcome to Claude Code Unable to connect to Anthropic services Failed to connect to api.anthropic.com: ERR_BAD_REQUEST
This happens because Claude Code tries to connect to the official API for an initialization check the first time it starts. A third-party gateway cannot complete this step. After installation and before the first launch, use either method below to skip the check:
Method One: Skip It with CC-Switch (Recommended)
Download the latest installer for macOS or Windows from the CC-Switch download page. Open the CC-Switch configuration tool, go to Settings → General, and enable "Skip Claude Code initial installation confirmation."
Method Two: Edit the Configuration File Manually
Find the ~/.claude.json file in your home directory and add the "hasCompletedOnboarding": true field at the end:
{
"installMethod": "unknown",
"autoUpdates": true,
"firstStartTime": "2025-07-14T06:11:03.877Z",
"userID": "xxxx",
"projects": {
"/home/your-user": {
"allowedTools": [],
"history": [],
"mcpContextUris": [],
"mcpServers": {},
"enabledMcpjsonServers": [],
"disabledMcpjsonServers": [],
"hasTrustDialogAccepted": false,
"projectOnboardingSeenCount": 0,
"hasClaudeMdExternalIncludesApproved": false,
"hasClaudeMdExternalIncludesWarningShown": false
}
},
"hasCompletedOnboarding": true
}Save the file, then run claude again to start using it normally.
🚀 Quick Setup with CC-Switch (Recommended)
If you have installed the CC-Switch quick configuration tool, you can manage Claude Code through a graphical interface without manually editing configuration files or environment variables.
Why Use CC-Switch
- Simple, intuitive graphical interface
- Switch between provider configurations with one click
- Automatically manages environment variables and configuration files
- Supports configuration backup and restore
- Switch configurations without restarting your terminal
Configuration Steps
- Open the CC-Switch application
- Click the "Claude" tab at the top
- Click the orange "+" button in the upper-right corner to add a configuration
- Enter the provider information:
- Provider name: Enter a custom name
- API Base URL:
http://137.184.200.132:3001/api/v1 - API Key: Paste your API key from the dashboard
- Model: Select an available Claude model
- Click "Save"
~/.claude/settings.json configuration file. After switching configurations, close and restart Claude Code for the change to take effect.- Find the configuration you just created in the configuration list
- Click "In Use" on the right side of the configuration, or click the configuration card itself
- The configuration will be marked "In Use" with a green label
- Restart Claude Code to apply the new configuration
⌨️ Manual Command-Line Setup
If you do not use CC-Switch, you can configure Claude Code manually from the command line.
🖥️ Windows
Requirements: Windows 10 or 11
Installation — Method One: Native (Recommended)
PowerShell:
irm https://claude.ai/install.ps1 | iex
CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Verify: claude --version
Configure Environment Variables
PowerShell:
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-your-key-here", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "http://137.184.200.132:3001/api/v1", "User")CMD:
setx ANTHROPIC_AUTH_TOKEN "sk-your-key-here" setx ANTHROPIC_BASE_URL "http://137.184.200.132:3001/api/v1"
Restart your terminal, then run claude to start.
🍏 macOS
Requirements: macOS 10.15 (Catalina) or later
Installation — Method One: Homebrew (Recommended)
brew install --cask claude-code
Method Two: Curl Script
curl -fsSL https://claude.ai/install.sh | bash
Verify: claude -v → should output something like 1.0.108 (Claude Code)
Configure Environment Variables
echo 'export ANTHROPIC_AUTH_TOKEN="sk-your-key-here"' >> ~/.zshrc echo 'export ANTHROPIC_BASE_URL="http://137.184.200.132:3001/api/v1"' >> ~/.zshrc source ~/.zshrc
Restart your terminal, then run claude to start.
🐧 Linux
Requirements: Ubuntu 18.04+, CentOS 7+, Debian 9+, etc.
Installation — Curl Script (Recommended)
curl -fsSL https://claude.ai/install.sh | bash
Verify: claude -v
Configure Environment Variables
Ubuntu/Debian (Bash):
echo 'export ANTHROPIC_AUTH_TOKEN="sk-your-key-here"' >> ~/.bashrc echo 'export ANTHROPIC_BASE_URL="http://137.184.200.132:3001/api/v1"' >> ~/.bashrc source ~/.bashrc
Fedora/CentOS (Zsh):
echo 'export ANTHROPIC_AUTH_TOKEN="sk-your-key-here"' >> ~/.zshrc echo 'export ANTHROPIC_BASE_URL="http://137.184.200.132:3001/api/v1"' >> ~/.zshrc source ~/.zshrc
sk-your-key-here with your own dedicated key. Restart your terminal after setup so the environment variables take effect.Troubleshooting
- Command Not Found? — Confirm Claude Code is installed correctly, check the PATH environment variable, restart the terminal window.
- Connection Failed? — Check your network connection, confirm the API Key is correct, check that your balance is sufficient.
- ERR_BAD_REQUEST on first launch? — See the "Skip the Initialization Error" section above. You need to set
hasCompletedOnboardingbefore first launch. - 401 Unauthorized? — Verify your API key is active in the dashboard. Make sure you're using
ANTHROPIC_AUTH_TOKEN(not ANTHROPIC_API_KEY). - 403 Model not supported? — Check that your key type matches the model. Aggregated keys only support claude-sonnet-4-6.