Skip to content

Claude Code 使用教程

Anthropic官方的Claude命令行工具。

安装

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

环境变量配置

macOS 和 Linux

将以下内容添加到 ~/.zshrc(macOS)或 ~/.bashrc(Linux):

bash
export ANTHROPIC_BASE_URL="https://api.leagsoft.ai/"
export ANTHROPIC_AUTH_TOKEN="你的API密钥"

配置后重新加载配置文件:

bash
# macOS
source ~/.zshrc

# Linux
source ~/.bashrc

Windows

使用 PowerShell 设置用户级环境变量(永久生效):

powershell
# 设置环境变量
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.leagsoft.ai/", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "你的API密钥", [System.EnvironmentVariableTarget]::User)

使用

配置完成后,在终端中运行 claude 即可启动 Claude Code。

aicodex 文档网站