Skip to content

Claude Code Installation and Usage Tutorial

Claude Code is a powerful AI programming assistant that allows you to collaborate with AI directly in your terminal. This tutorial will guide you through the installation and configuration process.

📋 System Requirements

Node.js version ≥ 18.0

Supported operating systems: macOS, Linux, Windows (WSL)

🚀 Quick Start

1. Install Node.js

💡 Tip: If you already have Node.js 18.0 or higher installed, you can skip this step.

Ubuntu / Debian Users

# Install the Node.js LTS version
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
sudo apt-get install -y nodejs

# Verify the installation
node --version

macOS Users

# Install Xcode Command Line Tools
sudo xcode-select --install

# Install Homebrew if it is 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 the installation
node --version

2. Install Claude Code

Install Claude Code globally using npm:

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

# Verify the installation
claude --version

3. Configure and Get Started

Obtain Required Configuration Information

You need to prepare two important configuration items:

Configuration ItemDescriptionHow to Obtain
ANTHROPIC_AUTH_TOKENAPI authentication tokenAfter registration, click Add Token on the API Token page (starts with sk-)
ANTHROPIC_BASE_URLAPI service addressUse https://www.kkiai.com (same as the main site address)

📝 Recommended settings when creating a token:

Name: Any name you prefer

Quota: Set to unlimited

Group: Select Claude code exclusive or official Claude 3 and above

Other options: Keep default settings

Launch Claude Code

Run the following in your project directory:

# Go to your project directory
cd your-project-folder

# Set environment variables on Linux/Unix
export ANTHROPIC_AUTH_TOKEN=sk-...  # Replace with your actual token
export ANTHROPIC_BASE_URL=https://www.kkiai.com
export API_TIMEOUT_MS=300000  # Set timeout to 300 seconds

# Start Claude Code
claude
powershell
# Go to your project directory
cd your-project-folder

# Set environment variables in Windows PowerShell
$env:ANTHROPIC_BASE_URL = "https://www.kkiai.com"
$env:ANTHROPIC_AUTH_TOKEN = "sk-..."
$env:API_TIMEOUT_MS = "300000"  # Set timeout to 300 seconds

# Start Claude Code
claude
cmd
# Go to your project directory
cd your-project-folder

# Set environment variables in Windows Command Prompt
set ANTHROPIC_BASE_URL=https://www.kkiai.com
set ANTHROPIC_AUTH_TOKEN=sk-...
set API_TIMEOUT_MS=300000

# Start Claude Code
claude

Initial Configuration

After launching, you will see the following configuration steps:

  1. Select Theme → Choose your preferred theme + Press Enter

  2. Security Notice → Confirm the security notice + Press Enter

  3. Terminal Configuration → Use default configuration + Press Enter

  4. Working Directory Trust → Trust the current directory + Press Enter

Congratulations! You can now start writing code with your AI programming partner!

❓ Frequently Asked Questions

Q: Encountering "Invalid API Key · Please run /login" error?

A: This indicates that Claude Code did not detect the environment variables. Please check:

  • Whether ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL are correctly set
  • Whether the environment variable values are correct (token starts with sk-)
  • Whether you restarted the terminal if using permanent configuration

Q: Why does it show "offline" status?

A: Claude Code determines network status by connecting to Google. Showing "offline" does not affect normal usage; it only indicates that Google cannot be reached.

Q: Why does web browsing Fetch fail?

A: Claude Code needs to call the Claude service for security checks before accessing web pages. You need to:

  • Maintain a stable international internet connection
  • Use a global proxy if necessary

Q: Requests always show "fetch failed"?

A: This may be caused by network environment issues. Solutions:

  1. Try using a proxy tool

Q: How to handle API errors?

A: This may be caused by unstable forwarding proxies. Recommendations:

  • Exit Claude Code (Ctrl+C)
  • Run the claude command again
  • If the issue persists, try again later

Q: Web login error?

A: Try clearing cookies for this site and then log in again.

📌 Important Notes

  • This site directly connects to the official Claude Code forwarding service
  • Only supports Claude Code API traffic; other API calls are not supported
  • Please keep your API token safe and avoid leaking it

Claude Code Official Documentation

Node.js Official Website


💡 Tip: If you encounter other issues, please refer to the official documentation or contact technical support.