Claude Code Install & Usage
Claude Code is a powerful AI coding assistant for the terminal. This guide covers install and configuration.
System requirements
- Node.js ≥ 18.0
- macOS, Linux, or Windows (WSL)
Quick start
1. Install Node.js
Tip: Skip if you already have Node.js 18+.
Ubuntu / Debian
# Install Node.js LTS
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
sudo apt-get install -y nodejs
# Verify
node --version
macOS
# Xcode Command Line Tools
sudo xcode-select --install
# Homebrew (if needed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js
brew install node
# Verify
node --version
2. Install Claude Code
# Official install macOS/Linux
curl -fsSL https://claude.ai/install.sh | bash
# Official install Windows
irm https://claude.ai/install.ps1 | iex
# Official install Homebrew
brew install --cask claude-code
# Official install Winget
winget install Anthropic.ClaudeCode
## After install, Claude may ask you to configure PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
3. Get a token
| Setting | Description | How to get |
|---|---|---|
| ANTHROPIC_AUTH_TOKEN | API auth token | Console → API Tokens → Add token (starts with sk-) |
| ANTHROPIC_BASE_URL | API base URL | Same as the main site URL |
Recommended token settings:
- Name: anything
- Quota: unlimited
- Group: Claude Code exclusive, promo Claude Code, or Official-relay Claude 1+. Do not use default or reverse-engineered groups (no tool calling).
- Other options: defaults
4. settings.json
# Full settings.json example
{
"env": {
"ANTHROPIC_BASE_URL": "https://4zapi.com",
# Your API token
"ANTHROPIC_AUTH_TOKEN": "sk-*********",
# Primary interactive model
"ANTHROPIC_MODEL": "claude-opus-4-6",
# Explore subagent / light background tasks
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-opus-4-6",
# opusplan execution stage
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-opus-4-6",
# opusplan planning stage
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
# 300s timeout
"API_TIMEOUT_MS": "300000",
# Claude Code experimental beta flags
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
}
}
Linux / Unix / macOS / Windows WSL settings.json:
cd your-project-folder
# Step 1
cat > ~/.claude/settings.json << 'EOF'
# Step 2 — replace token/models, remove comments, then continue
{
"env": {
"ANTHROPIC_BASE_URL": "https://4zapi.com",
"ANTHROPIC_AUTH_TOKEN": "sk-*********",
"ANTHROPIC_MODEL": "claude-opus-4-6",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-opus-4-6",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-opus-4-6",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
"API_TIMEOUT_MS": "300000",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
}
}
# Step 3
EOF
# Step 4 — verify
cat ~/.claude/settings.json
# Step 5 — start
claude
First-run setup
- Theme → pick one + Enter
- Safety → accept + Enter
- Terminal → keep defaults + Enter
- Trust directory → trust current dir + Enter
You can start coding with your AI partner.
FAQ
Q: "Invalid API Key · Please run /login"?
A: Env vars were not detected. Check:
ANTHROPIC_AUTH_TOKENandANTHROPIC_BASE_URLare set- Token starts with
sk- - If using persistent config, restart the terminal
Q: Why does it show "offline"?
A: Claude Code probes Google for online status. "offline" does not block usage; it only means Google is unreachable.
Q: Why does web Fetch fail?
A: Claude Code calls Claude for a safety check before fetching pages. You need:
- Stable international internet
- A global proxy when required
Q: Requests always show "fetch failed"?
A: Likely network. Try a proxy tool.
Q: How to handle API errors?
A: Relay instability is possible:
- Exit Claude Code (Ctrl+C)
- Rerun
claude - Retry later if it persists
Q: Web login errors?
A: Clear this site's cookies and sign in again.
Notes
- This site relays official Claude Code traffic
- Only Claude Code API traffic is supported
- Keep your API token private
Related links
Tip: For other issues, see the official docs or contact support.