VOOZH about

URL: https://crazyrouter.com/en/blog/claude-code-installation-guide

⇱ Claude Code Installation and Usage Guide - AI Programming Assistant Setup - Crazyrouter


Back to Blog

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.

Related Resources#


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

Implementation Guides

Related Posts

OpenAI Realtime API Complete Guide: Build Voice AI Apps in 2026

"Learn how to use OpenAI's Realtime API for building voice AI applications with WebSocket streaming, audio input/output, and function calling. Complete tutorial with code examples."

Mar 2

Error Handling for AI APIs: A Developer's Complete Guide

Master error handling for AI APIs including rate limits, timeouts, token limits, and provider outages. Production-ready patterns with Python and Node.

Feb 20

Seedream 4.0 API Tutorial: ByteDance's Image Generation Model for Developers

"Step-by-step tutorial for using Seedream 4.0 API — ByteDance's advanced image generation model. Includes setup, code examples, pricing, and comparison with DALL-E 3 and Midjourney."

Feb 19

OpenClaw Architecture: How OpenClaw Works Under the Hood in 2026

A technical deep dive into OpenClaw architecture exploring the Gateway layer, Agent Runtime, Markdown-based memory system, plugin slots, and complete message lifecycle. Learn how OpenClaw processes AI assistant requests from send to reply.

Mar 7

How to Get a Claude API Key in 2026: Official Setup, Alternatives, and Tested Examples

"Learn how to get a Claude API key in 2026 from Anthropic or through Crazyrouter. Includes official setup steps, tested API examples, common problems, and a direct-vs-gateway comparison."

Mar 15

Suno Music API Tutorial: Generate AI Music Programmatically in 2026

"Learn how to use the Suno Music API to generate songs, lyrics, and instrumentals with code. Includes Python examples, pricing, and integration tips."

Feb 21