Skip to content

Claude Code Deployment Guide

Prerequisite

Complete Node.js installation first and make sure Node.js 18+ is installed correctly.

Prerequisite

Before configuring Claude Code with CC-Switch, make sure Claude Code is installed globally with npm:

bash
npm install -g @anthropic-ai/claude-code

Verify 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

  1. Open CC-Switch
  2. Click the Claude tab
  3. Click the orange + button in the upper-right corner

2. Fill in provider information

  1. Provider name: custom name, such as Xiaomai API
  2. API Base URL: https://xiaomai.win
  3. API Key: paste your Claude-specific token from Xiaomai API
  4. Model: choose an available Claude model as needed
  5. 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

  1. Find the new Xiaomai API configuration in the list
  2. Click Use Current on the right side, or click the configuration card directly
  3. The configuration is marked as current with a green label
  4. 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:

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

CMD:

cmd
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Method 2: npm Install

  1. Open Command Prompt or PowerShell and run:
powershell
npm install -g @anthropic-ai/claude-code
  1. Verify installation:
powershell
claude --version
  1. Configure environment variables.

PowerShell:

powershell
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-xxx", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://xiaomai.win", "User")

CMD:

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.

  1. 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)

bash
brew install --cask claude-code

Method 2: Curl Script

bash
curl -fsSL https://claude.ai/install.sh | bash

Method 3: npm Install

bash
npm install -g @anthropic-ai/claude-code

Verify Installation

bash
claude -v

Normally it outputs something similar to 1.0.108 (Claude Code).

Configure Environment Variables

bash
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.bash_profile
echo 'export ANTHROPIC_BASE_URL="https://xiaomai.win"' >> ~/.bash_profile
source ~/.bash_profile

Tip

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)

bash
curl -fsSL https://claude.ai/install.sh | bash

Method 2: npm Install

bash
npm install -g @anthropic-ai/claude-code

Verify Installation

bash
claude -v

Configure Environment Variables

Ubuntu/Debian with Bash

bash
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.bash_profile
echo 'export ANTHROPIC_BASE_URL="https://xiaomai.win"' >> ~/.bash_profile
source ~/.bash_profile

Fedora/CentOS with Zsh

bash
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="https://xiaomai.win"' >> ~/.zshrc
source ~/.zshrc

Tip

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

More Questions

Read the FAQ or contact support.

Friendly, practical, and reliable AI coding support