Claude Code Configuration Tutorial
Claude Code Configuration Guide
Section titled “Claude Code Configuration Guide”Claude Code is the official command-line tool released by Anthropic, providing developers with a powerful AI-assisted coding experience. It supports intelligent code generation, code analysis, debugging assistance, and more.
:rocket: Key Features
Section titled “:rocket: Key Features”- Intelligent code generation - Quickly generate high-quality code
- Code analysis - Deeply understand and analyze code structure
- Debugging assistant - Smartly detect and fix code issues
- Documentation generation - Automatically generate code documentation
- CLI integration - Seamlessly integrate into your development workflow
:star: Exclusive Features on This Site
Section titled “:star: Exclusive Features on This Site”All LLM models on this site can be used in Claude Code If Claude Code cannot change the calling model, refer to the Token tutorial and set up model forwarding
:package: Installation Steps
Section titled “:package: Installation Steps”Configuration Notes (Core Section — Must Read)
Section titled “Configuration Notes (Core Section — Must Read)”This must be configured. If you do not set it, requests will be sent to Anthropic’s official Claude service endpoint, resulting in a 401 error.
ANTHROPIC_AUTH_TOKEN- Your API token, starting withsk-ANTHROPIC_BASE_URL- API endpoint URL, important: do not includev1in the URL! Do not includev1! Do not includev1!https://api.4allapi.comfor general use
The following variables usually do not need to be configured and can be left at their defaults, but you may also set them manually if needed:
ANTHROPIC_MODEL- Custom modelANTHROPIC_SMALL_FAST_MODEL- Fast model for background tasksANTHROPIC_DEFAULT_OPUS_MODEL- Default Opus modelANTHROPIC_DEFAULT_SONNET_MODEL- Default Sonnet modelANTHROPIC_DEFAULT_HAIKU_MODEL- Default Haiku modelANTHROPIC_MAX_THINKING_TOKENS- Maximum thinking token limit (optional)API_TIMEOUT_MS- API timeout in milliseconds (optional)CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC- Flag to disable non-essential traffic (optional)
Mac & Liunx Configuration
Section titled “Mac & Liunx Configuration”1. Install Node.js
Section titled “1. Install Node.js”Make sure Node.js 18+ is installed on your system.
Install Homebrew (recommended for Mac)
Section titled “Install Homebrew (recommended for Mac)”If Homebrew is not installed yet:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Using Homebrew:
brew install node2. Install Claude Code
Section titled “2. Install Claude Code”npm install -g @anthropic-ai/claude-code3. Configure API Key
Section titled “3. Configure API Key”Get the Auth Token (refer to the Add Token documentation)
Section titled “Get the Auth Token (refer to the Add Token documentation)”Method 1: Using Bash (recommended)
Section titled “Method 1: Using Bash (recommended)”echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.bash_profileecho 'export ANTHROPIC_BASE_URL="https://api.4allapi.com"' >> ~/.bash_profileecho 'export ANTHROPIC_MODEL="claude-opus-4-6"' >> ~/.bash_profileecho 'export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4-5-20251001"' >> ~/.bash_profilesource ~/.bash_profileMethod 2: Using Zsh (if you use Oh My Zsh)
Section titled “Method 2: Using Zsh (if you use Oh My Zsh)”echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.zshrcecho 'export ANTHROPIC_BASE_URL="https://api.4allapi.com"' >> ~/.zshrcecho 'export ANTHROPIC_MODEL="claude-opus-4-6"' >> ~/.bash_profileecho 'export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4-5-20251001"' >> ~/.bash_profilesource ~/.zshrcNote: After setting environment variables permanently, you need to restart the terminal for the changes to take effect.
4. Start Using Claude Code
Section titled “4. Start Using Claude Code”# Go to the project directorycd your-project-folder
# Start Claude CodeclaudeAfter the first launch, you need to complete the initial setup such as theme selection:
- • Choose your preferred theme (press Enter)
- • Confirm the security notice (press Enter)
- • Use the default Terminal configuration (press Enter)
- • Trust the working directory (press Enter)
- • Start coding! :rocket:
Windows Configuration
Section titled “Windows Configuration”1. Install Node.js
Section titled “1. Install Node.js”Visit https://nodejs.cn/download/current,进入 the Node.js official website, click the latest version, and download the installer for your operating system and architecture.
After downloading, double-click the installer and keep clicking Next. Once installation is complete, open a CMD window and run the following command to verify the installation:
node -v2. Set npm configuration
Section titled “2. Set npm configuration”Tell npm to ignore scripts inside packages when installing packages, such as preinstall and postinstall. After setting this, restart CMD.
setx NPM_CONFIG_IGNORE_SCRIPTS true3. Install Claude Code
Section titled “3. Install Claude Code”npm install -g @anthropic-ai/claude-code4. Configure SHELL environment variables
Section titled “4. Configure SHELL environment variables”Method 1: GUI configuration (recommended, permanent) a. Right-click “This PC” → select “Properties” b. Click “Advanced system settings” c. In the “System Properties” window, click “Environment Variables” Important: in the “System variables” section, click “New” (for shared computers, you may choose “User variables”) d. Add the following two variables: Variable name: ANTHROPIC_AUTH_TOKEN, variable value: sk-xxx Variable name: ANTHROPIC_BASE_URL, variable value: https://api.4allapi.com e. Click “OK” to save
Method 2: PowerShell (permanent)
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-xxx", "User")[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.4allapi.com", "User")[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "claude-opus-4-6", "User")[Environment]::SetEnvironmentVariable("ANTHROPIC_SMALL_FAST_MODEL", "claude-haiku-4-5-20251001", "User")Method 3: Command Prompt (permanent)
setx ANTHROPIC_AUTH_TOKEN "sk-xxx"setx ANTHROPIC_BASE_URL "https://api.4allapi.com"setx ANTHROPIC_MODEL "claude-opus-4-6"setx ANTHROPIC_SMALL_FAST_MODEL "claude-haiku-4-5-20251001"Note: After setting environment variables permanently, you need to restart the terminal for the changes to take effect. Permanent configuration is recommended.
Method 4: Configure via settings.json Find the settings.json file, or create it if it does not exist:
C:\Users\{user}\.claude\settings.jsonSet the API information and save:
{ "env": { "ANTHROPIC_MODEL": "claude-opus-4-6", // or claude-sonnet-4-6, etc. "ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5-20251001", "ANTHROPIC_BASE_URL": "https://api.4allapi.com", "ANTHROPIC_AUTH_TOKEN": "sk-xxx" }}setx SHELL "C:\Program Files\Git\bin\bash.exe" # replace this with your own path# If you are not sure, run where git to find it5. Restart the development environment
Section titled “5. Restart the development environment”Restart your terminal, or even restart your desktop or your computer (especially on Windows). Some operating systems require a restart before environment variable changes take effect. If you still cannot connect or requests are still going to the official URL after completing the configuration above, try restarting.
6. Enjoy!!
Section titled “6. Enjoy!!”# Go to the project directorycd your-project-folder
# Start Claude Codeclaudeccswitch simplified setup and quick switching
Section titled “ccswitch simplified setup and quick switching”ccswitch only takes over configuration. If Claude is not installed locally, you still need to install Claude first according to your operating system’s installation method.
- Quick import configuration
{ "env": { "ANTHROPIC_AUTH_TOKEN": "the key you redeemed on 4All API", "ANTHROPIC_BASE_URL": "https://api.4allapi.com", "ANTHROPIC_MODEL": "claude-opus-4-6", "ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5-20251001" }}- Fill in the form to configure

Using the Plugin UI
Section titled “Using the Plugin UI”After configuring the CLI, no additional setup is needed, and the plugin’s previous requirement to log in with an official account is automatically removed.

:bullseye: Common Commands
Section titled “:bullseye: Common Commands”claude- Start interactive modeclaude "task"- Run a one-off taskclaude commit- Create a Git commit/help- Show available commands/clear- Clear conversation history/review- Request a code review
:bulb: Usage Examples
Section titled “:bulb: Usage Examples”# Code generation> Please help me write a Python function to calculate the Fibonacci sequence
# Code reviewclaude "review this code for potential bugs"
# Auto commitclaude commitSwitching Models
Section titled “Switching Models”Use the Claude Code command:
[model id]The default model is Sonnet 4. You can switch to the better-performing Opus 4:
opus
/model opusOr switch to another Claude model: sonnet 3.7 sonnet 3.5
/model claude-3-7-sonnet-20250219 Kimi K2 Support
Section titled “ Kimi K2 Support”After starting Claude Code, just run:
/model moonshotai/kimi-k2-instructOther LLM models are also supported, such as OpenAI, Gemini, Qwen, and Doubao
4All API Footer
Section titled “4All API Footer”4All API · One-stop AI large model API aggregation platform | Pricing | Contact Us
© 2025 4All API. All rights reserved.