
Claude Code Installation and Usage Guide - AI Programming Assistant Setup
Claude Code is a powerful AI programming assistant that allows you to collaborate with AI directly in your terminal. This guide will walk you through the installation and configuration process.
System Requirements#
Before installing Claude Code, ensure your system meets these requirements:
- Node.js: Version 18.0 or higher
- Operating System: macOS, Linux, or Windows (WSL recommended)
Quick Start#
Step 1: Install Node.js#
If you already have Node.js 18.0 or higher installed, you can skip this step.
Ubuntu / Debian#
# Install Node.js LTS version
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
sudo apt-get install -y nodejs
# Verify installation
node --version
macOS#
# Install Xcode command line tools
sudo xcode-select --install
# Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js via Homebrew
brew install node
# Verify installation
node --version
Step 2: Install Claude Code#
Install Claude Code globally using npm:
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
Step 3: Configure API Access#
You need two configuration items to use Claude Code with Crazyrouter API:
| Configuration | Description | How to Obtain |
|---|---|---|
| ANTHROPIC_AUTH_TOKEN | API authentication token | Create a token on the API Tokens page (starts with sk-) |
| ANTHROPIC_BASE_URL | API service address | Use https://crazyrouter.com/ |
Recommended token settings:
- Name: Any descriptive name
- Quota: Set to unlimited for development
- Group: Select "Claude Code" or "Official Claude 3+"
- Other options: Keep default settings
Step 4: Launch Claude Code#
Linux / macOS#
# Navigate to your project directory
cd your-project-folder
# Set environment variables
export ANTHROPIC_AUTH_TOKEN=sk-your-token-here
export ANTHROPIC_BASE_URL=https://crazyrouter.com/
export API_TIMEOUT_MS=300000
# Launch Claude Code
claude
Windows PowerShell#
# Navigate to your project directory
cd your-project-folder
# Set environment variables
$env:ANTHROPIC_BASE_URL = "https://crazyrouter.com/"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-token-here"
$env:API_TIMEOUT_MS = "300000"
# Launch Claude Code
claude
Windows CMD#
# Navigate to your project directory
cd your-project-folder
# Set environment variables
set ANTHROPIC_BASE_URL=https://crazyrouter.com/
set ANTHROPIC_AUTH_TOKEN=sk-your-token-here
set API_TIMEOUT_MS=300000
# Launch Claude Code
claude
Step 5: First Run Configuration#
After launching Claude Code for the first time, you'll see these configuration steps:
- Select Theme - Choose your preferred color theme and press Enter
- Safety Notice - Review and confirm the safety notice
- Terminal Configuration - Use default configuration or customize
- Working Directory Trust - Trust the current directory to allow file access
Congratulations! You're now ready to start coding with your AI programming partner.
Permanent Configuration (Optional)#
To avoid setting environment variables every time, add them to your shell profile:
Bash (~/.bashrc or ~/.bash_profile)#
export ANTHROPIC_AUTH_TOKEN=sk-your-token-here
export ANTHROPIC_BASE_URL=https://crazyrouter.com/
export API_TIMEOUT_MS=300000
Zsh (~/.zshrc)#
export ANTHROPIC_AUTH_TOKEN=sk-your-token-here
export ANTHROPIC_BASE_URL=https://crazyrouter.com/
export API_TIMEOUT_MS=300000
After adding, reload your shell:
source ~/.bashrc # or source ~/.zshrc
Frequently Asked Questions#
"Invalid API Key" Error#
If you see "Invalid API Key - Please run /login", check:
ANTHROPIC_AUTH_TOKENis set correctly (starts withsk-)ANTHROPIC_BASE_URLis set tohttps://crazyrouter.com/- Restart your terminal after setting environment variables
"Offline" Status#
Claude Code checks network status by connecting to Google. Showing "offline" doesn't affect normal usage - it just indicates inability to connect to Google's servers.
Web Fetch Failures#
Claude Code performs security checks before accessing web pages. Ensure:
- Stable internet connection
- Use a global proxy if necessary
Persistent "Fetch Failed" Errors#
This may be caused by network issues. Try:
- Exit Claude Code (Ctrl+C)
- Re-run the
claudecommand - If the problem persists, try again later
API Errors#
If you encounter API errors:
- Exit Claude Code (Ctrl+C)
- Wait a moment and restart
- Check your token quota on the dashboard
Important Notes#
- Crazyrouter provides direct forwarding to official Claude Code services
- Keep your API token secure and never share it publicly
- Monitor your usage on the dashboard to avoid unexpected charges
Pricing#
Claude Code uses Claude models with the following pricing on Crazyrouter:
| Model | Input Price | Output Price |
|---|---|---|
| claude-opus-4-5 | $2.50/1M tokens | $12.50/1M tokens |
| claude-sonnet-4-5 | $1.50/1M tokens | $7.50/1M tokens |
| claude-haiku-4-5 | $0.40/1M tokens | $2.00/1M tokens |
All prices include a 45% discount compared to official rates.
Related Resources#
Need help? Contact support or check the Crazyrouter documentation for more information.


