Claude Code Deployment Guide
Prerequisite
Complete Node.js installation first and make sure Node.js 18+ is installed correctly.
Configure Quickly with CC-Switch (Recommended)
Prerequisite
Before configuring Claude Code with CC-Switch, make sure Claude Code is installed globally with npm:
npm install -g @anthropic-ai/claude-codeVerify installation with claude --version.
If CC-Switch is installed, you can manage Claude Code configuration through a graphical interface without manually editing config files or environment variables.
CC-Switch Advantages
- Graphical interface that is easy to use
- One-click provider switching
- Automatic environment-variable and config-file management
- Configuration backup and restore
- Provider switching without restarting the terminal
Configuration Steps
1. Start CC-Switch and add a Claude Code configuration
- Open CC-Switch
- Click the Claude tab
- Click the orange + button in the upper-right corner
2. Fill in provider information
- Provider name: custom name, such as
Xiaomai API - API Base URL:
https://xiaomai.win - API Key: paste your Claude-specific token from Xiaomai API
- Model: choose an available Claude model as needed
- Click Save
Tip
- You can add multiple provider configurations, such as official and Xiaomai API
- CC-Switch automatically updates
~/.claude/settings.json - After switching configuration, close and restart Claude Code for it to take effect
3. Enable the configuration
- Find the new Xiaomai API configuration in the list
- Click Use Current on the right side, or click the configuration card directly
- The configuration is marked as current with a green label
- Restart Claude Code and the new configuration takes effect
4. Quick switching from the system tray
CC-Switch supports tray-based quick switching:
- Right-click the CC-Switch system-tray icon
- Choose the Claude category
- Select the target configuration
- The configuration is applied without opening the main window
Notes
- Make sure the token created on Xiaomai API is a Claude Code token
- Restart Claude Code after switching configuration
- You can test endpoint speed in CC-Switch and choose the best configuration
Manual Command-Line Configuration
If you do not use CC-Switch, configure Claude Code manually from the command line.
Windows
System Requirements
Windows 10 or 11.
Installation Steps
Method 1: Native Install (Recommended)
PowerShell:
irm https://claude.ai/install.ps1 | iexCMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdMethod 2: npm Install
- Open Command Prompt or PowerShell and run:
npm install -g @anthropic-ai/claude-code- Verify installation:
claude --version- Configure environment variables.
PowerShell:
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-xxx", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://xiaomai.win", "User")CMD:
setx ANTHROPIC_AUTH_TOKEN "sk-xxx"
setx ANTHROPIC_BASE_URL "https://xiaomai.win"Tip
Replace sk-xxx with your own dedicated key. Restart the terminal after setting environment variables.
- Start Claude.
In a terminal, cd into a project directory or any working directory, then run claude.
macOS
System Requirements
macOS 10.15 Catalina or later.
Installation Steps
Method 1: Homebrew (Recommended)
brew install --cask claude-codeMethod 2: Curl Script
curl -fsSL https://claude.ai/install.sh | bashMethod 3: npm Install
npm install -g @anthropic-ai/claude-codeVerify Installation
claude -vNormally it outputs something similar to 1.0.108 (Claude Code).
Configure Environment Variables
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.bash_profile
echo 'export ANTHROPIC_BASE_URL="https://xiaomai.win"' >> ~/.bash_profile
source ~/.bash_profileTip
Replace sk-xxx with your own dedicated key.
Restart Terminal and Start Claude
After restarting the terminal, cd into a project directory or any working directory, then run claude.
Linux
System Requirements
Linux distributions such as Ubuntu 18.04+, CentOS 7+, or Debian 9+.
Installation Steps
Method 1: Curl Script (Recommended)
curl -fsSL https://claude.ai/install.sh | bashMethod 2: npm Install
npm install -g @anthropic-ai/claude-codeVerify Installation
claude -vConfigure Environment Variables
Ubuntu/Debian with Bash
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.bash_profile
echo 'export ANTHROPIC_BASE_URL="https://xiaomai.win"' >> ~/.bash_profile
source ~/.bash_profileFedora/CentOS with Zsh
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="https://xiaomai.win"' >> ~/.zshrc
source ~/.zshrcTip
Replace sk-xxx with your own dedicated key.
Restart Terminal and Start Claude
After restarting the terminal, cd into a project directory or any working directory, then run claude.
FAQ
Command Not Found
- Confirm Claude Code is installed correctly
- Check the PATH environment variable
- Restart the terminal
Connection Failed
- Check network connectivity
- Confirm the API key is correct
- Check whether your balance is sufficient