> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code CLI 配置指南

> Claude Code 集成指南 - Ace Data Cloud

## 1. 获取 API Key

打开 [Ace Data Cloud 应用列表](https://platform.acedata.cloud/console/applications)，进入可用的应用并复制 API Key。

![获取 Ace Data Cloud API Key](https://cdn.acedata.cloud/dvc3cg.jpg)

## 2. 安装 Claude Code

macOS / Linux / WSL：

```bash theme={null}
curl -fsSL https://claude.ai/install.sh | bash
```

Windows PowerShell：

```powershell theme={null}
irm https://claude.ai/install.ps1 | iex
```

安装后检查：

```bash theme={null}
claude --version
```

## 3. 配置 Ace Data Cloud

全局使用时，将以下变量加入 `~/.zshrc` 或 `~/.bashrc`：

```bash theme={null}
export ANTHROPIC_BASE_URL="https://api.acedata.cloud"
export ANTHROPIC_AUTH_TOKEN="你的 API Key"
unset ANTHROPIC_API_KEY
```

重新打开终端，或 `source` 对应配置文件。

只对当前项目生效时，可创建已加入 `.gitignore` 的 `.claude/settings.local.json`：

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.acedata.cloud",
    "ANTHROPIC_AUTH_TOKEN": "你的 API Key"
  }
}
```

两种方式任选一种。不要把真实 Key 写入团队共享的 `.claude/settings.json`；如果环境中已有 `ANTHROPIC_API_KEY`，应真正取消它，而不是设为空字符串。

## 4. 启动并验证

```bash theme={null}
cd /path/to/your/project
claude
```

进入后发送一个只读任务，例如“读取 README.md 并用一句话总结”。调用记录和余额可在 [使用历史](https://platform.acedata.cloud/console/usages) 与 [应用列表](https://platform.acedata.cloud/console/applications) 查看。

如果返回 401，检查 Key 是否完整、旧 `ANTHROPIC_API_KEY` 是否已取消，并完全重启 Claude Code。模型无需在接入配置中固定，可在 Claude Code 中选择当前可用模型。

## 官方参考

* [Claude Code 快速开始](https://code.claude.com/docs/en/quickstart)
* [Claude Code 设置](https://code.claude.com/docs/en/settings)
