Back to Blog
EnglishTutorial

Claude Code Installation and Usage Guide - AI Programming Assistant Setup

Complete guide to install and configure Claude Code, the AI programming assistant. Learn how to set up Node.js, configure API tokens, and start coding with AI in your terminal.

C
Crazyrouter Team
January 24, 2026 / 1296 views
Share:
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#

bash
# 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#

bash
# 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:

bash
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:

ConfigurationDescriptionHow to Obtain
ANTHROPIC_AUTH_TOKENAPI authentication tokenCreate a token on the API Tokens page (starts with sk-)
ANTHROPIC_BASE_URLAPI service addressUse 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#

bash
# 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#

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#

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:

  1. Select Theme - Choose your preferred color theme and press Enter
  2. Safety Notice - Review and confirm the safety notice
  3. Terminal Configuration - Use default configuration or customize
  4. 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)#

bash
export ANTHROPIC_AUTH_TOKEN=sk-your-token-here
export ANTHROPIC_BASE_URL=https://crazyrouter.com/
export API_TIMEOUT_MS=300000

Zsh (~/.zshrc)#

bash
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:

bash
source ~/.bashrc  # or source ~/.zshrc

Frequently Asked Questions#

"Invalid API Key" Error#

If you see "Invalid API Key - Please run /login", check:

  • ANTHROPIC_AUTH_TOKEN is set correctly (starts with sk-)
  • ANTHROPIC_BASE_URL is set to https://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:

  1. Exit Claude Code (Ctrl+C)
  2. Re-run the claude command
  3. 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:

ModelInput PriceOutput 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.


Need help? Contact support or check the Crazyrouter documentation for more information.

Implementation Guides

Related Articles

Luma Dream Machine API Guide: Build AI Video Apps with Ray 2 in 2026Tutorial

Luma Dream Machine API Guide: Build AI Video Apps with Ray 2 in 2026

"Complete guide to Luma's Dream Machine API powered by Ray 2. Covers text-to-video, image-to-video, camera controls, pricing, and production integration with code examples."

Apr 13
AI Batch Processing API Guide 2026: Process Millions of Requests EfficientlyTutorial

AI Batch Processing API Guide 2026: Process Millions of Requests Efficiently

"Complete guide to AI batch processing APIs in 2026. Learn how to process millions of AI requests efficiently using OpenAI Batch API, async patterns, and cost optimization."

Mar 1
How to Reduce AI API Costs by 80% - Complete Developer Guide 2026Tutorial

How to Reduce AI API Costs by 80% - Complete Developer Guide 2026

Learn proven strategies to reduce AI API costs by up to 80%. Includes model selection, caching, prompt optimization, and batch processing techniques.

Jan 22
How to Deploy Clawdbot: Build Your Free 24/7 AI Assistant in 5 MinutesTutorial

How to Deploy Clawdbot: Build Your Free 24/7 AI Assistant in 5 Minutes

Want a personal AI assistant that runs 24/7, connects to WhatsApp, Telegram, and Discord, and costs almost nothing to host? Meet Clawdbot - an open-source project that makes this surprisingly easy.

Jan 26
How to Get a Claude API Key in 2026: Secure Setup for Teams and AppsTutorial

How to Get a Claude API Key in 2026: Secure Setup for Teams and Apps

A developer-focused how to get claude api key article covering what it is, alternatives, API examples, pricing, FAQs, and when to use Crazyrouter for unified routing.

Jun 6
Claude Code Base URL, API Key, and Native Tool Calls: Tested SetupTutorial

Claude Code Base URL, API Key, and Native Tool Calls: Tested Setup

Configure Claude Code with a native Messages gateway, verify API authentication and a real file-read tool loop, and diagnose base URL and model errors.

Jul 5