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

# Claude Code

> 使用 Anthropic Messages 协议配置模型网关。

## 准备

选择支持 `anthropic-messages` 的模型，复制模型 ID 和区域地址。Claude Code 使用网关根地址，去掉 Base URL 尾部的 `/v1`。

## 配置与运行

```bash Bash / Zsh theme={null}
export ANTHROPIC_BASE_URL="https://YOUR-REGION.example"
export ANTHROPIC_AUTH_TOKEN="YOUR_CODEFLARE_KEY"
export ANTHROPIC_MODEL="MODEL_ID"
claude
```

将 `YOUR_CODEFLARE_KEY` 替换为自己的 Codeflare 密钥。环境变量示例适用于 Bash / Zsh；请勿把密钥提交到仓库。Claude Code 安装方式见[官方安装文档](https://code.claude.com/docs/en/setup)。

## 验证连接

运行 `/status` 检查实际地址与模型，再进行一次短请求。既有客户端登录和其他配置可能影响连接；如果 `/status` 不显示预期配置，先解决配置冲突。

<Warning>Messages、Responses 与 Chat Completions 不是同一协议。不要把仅支持其他协议的模型用于 Claude Code；工具调用也需要单独验证。</Warning>

需要分别控制 Claude Code 的不同模型选择时，请按[官方网关说明](https://code.claude.com/docs/en/llm-gateway-connect)核对客户端当前支持的配置。费用以平台实际用量和模型价格为准。


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