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

# Claude Code

> Anthropic 官方命令行 AI 编程工具，支持代码生成、代码审查、自动提交等功能，通过 Anthropic 兼容协议接入 ePhone AI。

[Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) 是 Anthropic 官方推出的命令行 AI 编程工具，支持自然语言与代码库直接交互，可完成代码生成、重构、调试、提交等任务。

## 安装与配置

**1. 安装 Node.js**

确保系统已安装 Node.js **18+** 版本：

```bash theme={null}
node -v
```

**2. 安装 Claude Code**

```bash theme={null}
npm install -g @anthropic-ai/claude-code
```

**3. 配置环境变量**

> [accordion] Mac / Linux (zsh)
>
> ```bash theme={null}
> echo 'export ANTHROPIC_API_KEY="sk-your-api-key"' >> ~/.zshrc
> echo 'export ANTHROPIC_BASE_URL="https://api.ephone.ai/anthropic"' >> ~/.zshrc
> source ~/.zshrc
> ```

> [accordion] Mac / Linux (bash)
>
> ```bash theme={null}
> echo 'export ANTHROPIC_API_KEY="sk-your-api-key"' >> ~/.bashrc
> echo 'export ANTHROPIC_BASE_URL="https://api.ephone.ai/anthropic"' >> ~/.bashrc
> source ~/.bashrc
> ```

> [accordion] Windows (PowerShell)
>
> ```powershell theme={null}
> [Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "sk-your-api-key", "User")
> [Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.ephone.ai/anthropic", "User")
> ```

**4. 进入项目目录并启动**

```bash theme={null}
cd your-project-folder
claude
```

## 常用命令

| 命令 | 说明 |
| - | - |
| `claude` | 启动交互模式 |
| `claude "任务描述"` | 运行一次性任务 |
| `claude commit` | 自动生成 Git 提交信息并提交 |
| `/help` | 查看所有可用命令 |
| `/clear` | 清除当前对话历史 |
| `/model` | 切换使用的模型 |

## 推荐模型

| 场景 | 推荐模型 |
| - | - |
| 日常编程辅助 | `claude-opus-4-5-20251101` |
| 复杂代码重构 | `claude-opus-4-5-20251101-thinking` |

## 高级用法

**通过 CLAUDE.md 定义项目规范**

在项目根目录创建 `CLAUDE.md` 文件，Claude Code 会自动读取并遵循其中的指令：

```markdown theme={null}
# 项目规范
- 使用 TypeScript，不使用 any 类型
- 提交信息遵循 Conventional Commits 规范
- 每次修改后运行 npm test
```

**MCP 服务器扩展**

Claude Code 支持通过 [MCP（Model Context Protocol）](https://docs.anthropic.com/en/docs/claude-code/mcp) 连接外部工具，如数据库、文件系统、浏览器等，显著增强 Agent 能力。

> [!NOTE]
>
> Claude Code 的 Agent 模式会频繁调用模型，token 消耗远高于普通对话，建议在 Tier 2 下使用以避免触发速率限制。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.