Skip to content

Claude Code ​ ​

Agentic coding tool officially launched by Anthropic, runs in the command line, supports code generation, refactoring, debugging, and other tasks.

Installation ​ ​

Mac / Linux ​ ​

bash

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

Windows ​ ​

cmd

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

Requires Node.js 18+

Configuration ​ ​

Mac / Linux ​ ​

Add the following content to ~/.bash_profile or ~/.zshrc:

bash

echo 'export ANTHROPIC_API_KEY="sk-xxx"' >> ~/.bash_profile
echo 'export ANTHROPIC_BASE_URL="https://www.fast-api.org"' >> ~/.bash_profile
source ~/.bash_profile

Replace sk-xxx with the API Key you obtained from Fast-API.

Windows ​ ​

Method 1: Environment Variables

cmd

setx ANTHROPIC_API_KEY "sk-xxx"
setx ANTHROPIC_BASE_URL "https://www.fast-api.org"

Method 2: settings.json (Recommended)

Edit ~/.claude/settings.json:

json

{
  "env": {
    "ANTHROPIC_MODEL": "claude-sonnet-4-20250514",
    "ANTHROPIC_BASE_URL": "https://www.fast-api.org",
    "ANTHROPIC_API_KEY": "sk-xxx"
  }
}

Usage Example ​ ​

bash

# Start Claude Code
claude

# Switch model
/model claude-sonnet-4-20250514

After starting, you can enter task descriptions in the interactive terminal, and Claude Code will automatically read project files and perform coding operations.

Frequently Asked Questions ​ ​

Shows "unauthorized" or 401 error ​ ​

Check whether ANTHROPIC_API_KEY is set correctly and confirm the API Key is valid.

Connection timeout ​ ​

Make sure ANTHROPIC_BASE_URL is set to https://www.fast-api.org (do not add /v1 at the end).

Model unavailable ​ ​

Use the /model command to switch to a currently available model, such as claude-sonnet-4-20250514.

Notes ​ ​

  • The base URL is https://www.fast-api.org, do not add /v1 suffix
  • After modifying environment variables, you need to restart the terminal or execute source to activate
  • Windows users are recommended to use the settings.json method to configure, to avoid environment variable conflicts