Login
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 / 498 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 Posts

AI Palm Reading with GPT-image-2 — Generate Professional Palmistry Analysis from a Single PhotoTutorial

AI Palm Reading with GPT-image-2 — Generate Professional Palmistry Analysis from a Single Photo

Use GPT-image-2 via Crazyrouter API to generate stunning palm reading infographics. Complete code in Python, curl, and Node.js.

May 1
Character AI API Guide: Build Conversational AI Characters ProgrammaticallyTutorial

Character AI API Guide: Build Conversational AI Characters Programmatically

Complete guide to building conversational AI characters using APIs. Covers Character.AI alternatives, custom character creation with GPT and Claude

Feb 22
Unstable Diffusion API Guide: Access Advanced Image Generation ModelsTutorial

Unstable Diffusion API Guide: Access Advanced Image Generation Models

Complete guide to using Unstable Diffusion and open-source image generation models via API. Learn about model options, API integration, and how to generate uncensored AI images.

Feb 22
OpenClaw Applications: 10+ Real-World Use Cases in 2026Tutorial

OpenClaw Applications: 10+ Real-World Use Cases in 2026

Discover 10+ OpenClaw applications from customer support automation to content creation. Learn how businesses use OpenClaw for AI-powered workflows across WhatsApp, Telegram, Discord, and more platforms.

Mar 7
OpenAI-Compatible API Base URL Explained: How to Configure Any AI ToolTutorial

OpenAI-Compatible API Base URL Explained: How to Configure Any AI Tool

Learn what an OpenAI-compatible API Base URL is, how to configure it in Python, Node.js, curl, Cursor, LiteLLM, FastGPT, Codex-style tools, and how to avoid common mistakes like missing /v1 or using the wrong endpoint.

Jun 4
Kimi K2 Thinking Model: Complete Developer Guide for Reasoning WorkflowsTutorial

Kimi K2 Thinking Model: Complete Developer Guide for Reasoning Workflows

"Complete guide to Moonshot's Kimi K2 Thinking model. Learn chain-of-thought reasoning, benchmark comparisons, API integration, and cost optimization for production."

May 5