# 接入 Agent 工具总览

BeeRoute 同时兼容 **OpenAI**（Chat Completions / Responses）、**Anthropic**（Messages）和 **Google Gemini** 三种官方接口格式。大部分 AI 编程工具和 Agent 工具，只需要填写三项就能接入：**接口地址**、**API Key**、**模型名**。

本栏目的每篇教程都已对照各工具 2026 年 11 月的官方文档核对过。工具更新很快，如果界面和教程不一致，请以工具官方文档为准，或联系我们更新。

## 一、准备 API Key

1. 登录 [BeeRoute](https://beeroute.ai)，确认账户余额大于 0。
2. 打开「[API 密钥](https://beeroute.ai/keys)」页面，点击 **创建 API 密钥**，按下表选择 **分组**，然后复制生成的密钥（以 `sk-` 开头）。

| 使用的工具 | 选择的分组 | 说明 |
| :--- | :--- | :--- |
| Claude Code（终端 / VS Code / JetBrains） | `ClaudeCode` | Claude Code 专用，价格更低，只包含 Claude 系列模型 |
| Codex（CLI / IDE 扩展 / ChatGPT 桌面端） | `CodeX` | Codex 专用，价格更低，包含 `gpt-6.2-sol` 等 GPT 模型 |
| 其他所有工具 | `default` | 支持全部模型 |

!> `ClaudeCode` 和 `CodeX` 是专用分组，只能在对应的客户端里使用。在 OpenCode、Cline、OpenClaw 等其他工具里使用这两个分组的密钥，请求可能会被拒绝（403）。其他工具请使用 `default` 分组的密钥。

## 二、接口地址速查

不同工具对「接口地址」的叫法不同（Base URL、API 地址、Endpoint、接口地址……），按工具使用的接口格式填写即可：

| 接口格式 | 填写的地址 | 典型工具 |
| :--- | :--- | :--- |
| OpenAI Chat Completions（「OpenAI 兼容」） | `https://beeroute.ai/v1` | OpenCode、Cline、Kilo Code、OpenClaw、Hermes、Pi、Trae、Qoder、DeepSeek Harness 等 |
| OpenAI Responses | `https://beeroute.ai/v1` | Codex（只支持这种格式） |
| Anthropic Messages | `https://beeroute.ai` | Claude Code |
| Google Gemini | `https://beeroute.ai` | Google 官方 SDK（google-genai），见 [Gemini 原生格式](zh/coding/gemini.md) |

- 工具会在地址后面自动拼接 `/chat/completions`、`/responses`、`/v1/messages` 等路径，所以一般**不要**填完整路径。
- 少数工具可以选择填写完整地址（例如 Trae 打开「完整 URL」开关、WorkBuddy 打开「自定义协议」开关时），这时 Chat Completions 的完整地址是 `https://beeroute.ai/v1/chat/completions`。
- 个别工具的「Anthropic 兼容」模式要求地址带 `/v1`，请以对应教程为准。

## 三、模型名

模型名必须和 BeeRoute 上的模型 ID **完全一致**（区分大小写）。可以在「[模型定价](https://beeroute.ai/modellist/?lang=zh)」页面查看和复制全部模型 ID。常用的编程模型：

| 系列 | 模型 ID 示例 |
| :--- | :--- |
| Claude | `claude-opus-5-5`、`claude-sonnet-5-5`、`claude-haiku-5-5` |
| GPT | `gpt-6.2-sol` |
| Gemini | `gemini-4-neon`、`gemini-4-hydrogen` |
| 国产模型 | `deepseek-flash`、`kimi-k3.1-pro`、`glm-5.3`、`qwen4-max` |

?> 一个 `default` 分组的密钥可以调用上表中的所有模型。在「OpenAI 兼容」类工具里，Claude、Gemini 等模型同样可以通过 Chat Completions 格式调用，BeeRoute 会自动转换。

## 四、工具一览

| 工具 | 类型 | 使用的接口格式 | 教程 |
| :--- | :--- | :--- | :--- |
| Claude Code | 终端 / IDE 编程 Agent | Anthropic Messages | [查看](zh/agent/claude-code.md) |
| Codex | 终端 / IDE / 桌面编程 Agent | OpenAI Responses | [查看](zh/agent/codex.md) |
| OpenCode | 终端编程 Agent | Chat Completions / Responses / Anthropic | [查看](zh/agent/opencode.md) |
| OpenClaw | 个人 AI 助手网关 | Chat Completions / Responses / Anthropic | [查看](zh/agent/openclaw.md) |
| Hermes Agent | 终端 / 聊天应用 Agent | Chat Completions / Responses / Anthropic | [查看](zh/agent/hermes.md) |
| Pi | 极简可扩展编程 Agent | Chat Completions / Responses / Anthropic / Gemini | [查看](zh/agent/pi.md) |
| Cline | VS Code / JetBrains 扩展、CLI | Chat Completions | [查看](zh/agent/cline.md) |
| Kilo Code | VS Code 扩展、CLI | Chat Completions / Responses / Anthropic | [查看](zh/agent/kilo-code.md) |
| Cursor | AI 编辑器 | Chat Completions（受限） | [查看](zh/agent/cursor.md) |
| Trae | AI 编辑器 | Chat Completions / Anthropic | [查看](zh/agent/trae.md) |
| Qoder | 桌面应用 | Chat Completions / Responses | [查看](zh/agent/qoder.md) |
| WorkBuddy | 桌面 Agent | Chat Completions | [查看](zh/agent/workbuddy.md) |
| DeepSeek Harness | Web / 桌面 Agent | Chat Completions / Responses / Anthropic / Gemini | [查看](zh/agent/deepseek-harness.md) |
| Reasonix | 终端编程 Agent | Chat Completions / Anthropic | [查看](zh/agent/reasonix.md) |

## 五、先用 curl 测通

配置工具前，可以先用下面的命令确认密钥和网络都没问题（请使用 `default` 分组的密钥，把 `sk-xxx` 换成你的密钥）：

```bash
curl https://beeroute.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-xxx" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6.2-sol", "messages": [{"role": "user", "content": "Hello"}]}'
```

返回 JSON 且包含 `choices` 字段，说明接口可用。

## 六、常见错误

| 现象 | 原因 | 处理 |
| :--- | :--- | :--- |
| `401` / `无效的令牌`（`Invalid token`） | 密钥填错、多了空格，或密钥已删除 | 重新复制密钥；检查是否被旧的环境变量覆盖 |
| `403`，或请求被拒绝 | 密钥分组与工具不匹配 | Claude Code 用 `ClaudeCode` 分组，Codex 用 `CodeX` 分组，其他工具用 `default` 分组 |
| `分组 xxx 下模型 xxx 无可用渠道` | 模型名写错，或该分组没有这个模型 | 到[模型定价](https://beeroute.ai/modellist/?lang=zh)页面核对模型 ID 和可用分组 |
| `预扣费额度失败` | 余额不足 | 到[钱包](https://beeroute.ai/wallet)充值 |
| `404` | 接口地址填错（多了或少了 `/v1`） | 对照上面的地址速查表 |
| 连接超时 | 网络或代理问题 | 关闭代理后重试，或检查工具的代理设置 |
