Claude Code Terminal User Guide

Claude Code is a programming agent launched by Anthropic. In addition to the VS Code extension, it also provides a terminal CLI, allowing you to run claude in any project directory to read code, modify files, run commands, explain errors, and assist in completing development tasks.

This article explains how to install, configure, and use the Claude Code CLI in the local terminal through the Claude Code proxy service of 胖狐中转. Once configured, Claude Code will send requests to https://api.ace.324567.xyz, without needing a separate subscription to the official Anthropic account.

Application Process

To use Claude Code, you can first go to the 胖狐中转 Console to obtain your API Token for backup.

If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page.

There is a free quota available for first-time applicants, allowing you to experience Claude Code services for free.

Installing Claude Code

Claude Code supports macOS, Linux, Windows, and WSL. You can use the official native installation method or install it via npm.

Native Installation (Recommended)

The official native installation method will install the claude command and automatically handle subsequent updates.

macOS, Linux, WSL can run:

curl -fsSL https://claude.ai/install.sh | bash

Windows PowerShell can run:

irm https://claude.ai/install.ps1 | iex

Windows CMD can run:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

npm Installation

If you have already installed Node.js, you can also install Claude Code via npm. This method requires Node.js version 18 or higher.

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

Check Installation

After installation, reopen the terminal and check if the command is available:

claude --version

If you see command not found, it usually means the current terminal has not loaded the new PATH yet. Please close and reopen the terminal, or check the PATH configuration indicated in the installation script output.

Configuration

After installation, Claude Code will attempt to connect to the official Anthropic service by default. To switch to 胖狐中转, you need to configure Claude Code to use our proxy address and the API Token you just obtained.

Method 1: Shell Configuration File

It is recommended to write the configuration into a Shell configuration file, such as ~/.zshrc, ~/.bashrc, or ~/.bash_profile:

export ACEDATACLOUD_API_TOKEN="{token}"
export ANTHROPIC_BASE_URL="https://api.ace.324567.xyz"
export ANTHROPIC_AUTH_TOKEN="$ACEDATACLOUD_API_TOKEN"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="850000"

Replace {token} with the API Token you copied from the 胖狐中转 Console. CLAUDE_CODE_AUTO_COMPACT_WINDOW sets the trigger window for automatic compression to about 850,000 tokens, reserving space for tool results and final answers; it will not modify the model's context limit.

After configuring, reopen the terminal or execute the corresponding source command to make the configuration take effect immediately:

source ~/.zshrc

This method is suitable for scenarios where you want all projects to default to using 胖狐中转.

Method 2: Project Settings File

If you only want a specific project to use 胖狐中转, you can create a .claude/settings.local.json file in the project root directory:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "{token}",
    "ANTHROPIC_BASE_URL": "https://api.ace.324567.xyz",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "850000"
  }
}

If the current Shell or system environment has an old ANTHROPIC_API_KEY set, please unset it in the same environment where you start Claude Code / VS Code:

unset ANTHROPIC_API_KEY

Do not place the real Token in the team-shared .claude/settings.json; personal credentials should only be in the ignored .claude/settings.local.json or local environment variables.

This method only takes effect for the current project. It is also applicable to both the terminal CLI and the Claude Code VS Code extension: when you open the same project in VS Code, the extension will also read this project-level configuration.

It is recommended to add .claude/settings.local.json to .gitignore to avoid committing personal Tokens to the remote repository. After configuration, please reopen the terminal; if using in VS Code, please restart or reload VS Code.

Note: If there is an old ANTHROPIC_API_KEY, it should be truly unset, rather than writing an empty string in the configuration. After cleaning, you need to restart Claude Code; the VS Code extension also needs to fully reload the window.

Clear Cached Anthropic Login

If you have previously logged into Claude Code with an official Anthropic account, the local system may have cached the official login status. It is recommended to clear the old login before switching to the 胖狐中转 proxy.

Start Claude Code:

claude

In the Claude Code interactive interface, enter:

/logout

After logging out of Claude Code, reopen the terminal and run claude again. If you have never logged into the official Anthropic account, you can skip this step.

Start Session

Navigate to your project directory and then start Claude Code:

cd /path/to/your/project
claude

Once you see the Claude Code interactive interface, you can directly input requests, such as:

Explain the directory structure of this project

You can also use a one-time command to have Claude Code complete a single task:

claude "Help me check the recent git diff for possible bugs"

If you want Claude Code to output results and then exit directly, you can use -p:

claude -p "Summarize the purpose of README.md"

Verify Configuration

Once in Claude Code, you can enter /status to check the current connection configuration:

/status

You should see information similar to:

Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://api.ace.324567.xyz

As shown in the image:

If the Anthropic base URL is not https://api.ace.324567.xyz, it indicates that the current terminal has not read the correct configuration. Please check if the Shell configuration file has been saved successfully and reopen the terminal.

You can also check the request records and billing details through the 胖狐中转 Console - Usage History and view the remaining quota through the 胖狐中转 Console - Application List.

How It Works

Claude Code natively uses the Anthropic Messages API protocol. 胖狐中转 provides a proxy service compatible with the Anthropic API at https://api.ace.324567.xyz, so Claude Code does not require a local proxy program or additional plugins.

The workflow is as follows:

  1. Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from environment variables or .claude/settings.local.json.
  2. When ANTHROPIC_BASE_URL points to https://api.ace.324567.xyz, requests are sent directly to 胖狐中转.
  3. 胖狐中转 uses your API Token for authentication, checks the quota, and forwards the request to an available Claude Code service channel.
  4. After the request is completed, the platform records usage based on actual consumption and deducts from the quota.

This means you still use the original claude command and the native interaction experience of Claude Code, just switching the underlying API service to 胖狐中转.

Configure Models

Claude Code selects different levels of models based on the task type. You can also specify the default model through environment variables.

For example, you can add the following to your Shell configuration file:

export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-8"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"
export CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-6"

Common variable descriptions are as follows:

Variable Purpose
ANTHROPIC_DEFAULT_OPUS_MODEL Model for complex reasoning, planning, and high-difficulty coding tasks
ANTHROPIC_DEFAULT_SONNET_MODEL Model for everyday coding, reading code, and routine modification tasks
ANTHROPIC_DEFAULT_HAIKU_MODEL Model for faster, lighter tasks
CLAUDE_CODE_SUBAGENT_MODEL Model used by Claude Code when creating sub Agents

If you are unsure how to choose, you can skip configuring these model variables and use the default selection by Claude Code. If you later wish to consistently use a specific model, configure it according to the model names supported in the 胖狐中转 Claude service documentation.

Note: Claude Code has the best compatibility with the Claude series models. It is recommended to prioritize using the Claude models provided by 胖狐中转 and not to switch to non-Claude models arbitrarily.

Learn More