Update provider and agent configuration guides

This commit is contained in:
musi 2026-08-04 09:19:14 +08:00
parent 454daec31c
commit d09dd7b6cb
10 changed files with 203 additions and 120 deletions

View file

@ -48,6 +48,18 @@ After import:
If CCR detects ZCode login state but no usable provider API key, the import entry remains unavailable. Configure a usable model provider in ZCode first, then return to CCR and add the provider.
### Kimi CLI
Kimi CLI import reads a managed OAuth login or API key from local Kimi config (default `~/.kimi-code/config.toml`). When a usable credential is available, CCR can import it as a `Kimi CLI API` provider.
After import:
1. The protocol is `openai_chat_completions`.
2. Models come from the Kimi config first; if none are configured, CCR falls back to the default model `kimi-for-coding`.
3. CCR creates an OAuth or API-key provider plugin based on the credential type, reusing the Kimi login to access the upstream service.
If CCR detects login traces but no usable OAuth token, the import entry shows why. Run `/login` in Kimi CLI, then return to CCR and rescan.
## Main fields
| Field | Capability |

View file

@ -24,34 +24,38 @@ A provider is the upstream model service CCR forwards requests to, such as OpenR
### Add the provider
1. Open **Providers** and click **Add Provider**.
2. Choose a built-in preset under **Preset providers**. Presets fill common Base URLs, protocols, and icons automatically.
3. If the service is not listed, choose **Other / custom API endpoint**.
4. Fill in **Name**, **Base URL**, **Protocol**, **API Key**, and **Models**.
2. Choose a built-in preset under **Select preset provider**. Presets fill common API endpoints, protocols, and icons automatically.
3. If the service is not listed, choose **Other / custom API endpoint** and enter a **Name** and **API endpoint**.
4. In the **Add credentials** step, enter the **API key**.
### Choose a protocol
After you enter the API endpoint and key, CCR automatically detects the protocols and models the endpoint supports.
### Protocols
| Protocol | Best for |
| --- | --- |
| OpenAI Chat Completions | Most OpenAI-compatible services |
| OpenAI Chat | Most OpenAI-compatible services |
| OpenAI Responses | Services that support the Responses API |
| Anthropic Messages | Anthropic official or Anthropic-compatible services |
| Gemini Generate Content | Gemini official or Gemini-compatible services |
| Gemini Generate | Gemini official or Gemini-compatible services |
If you are unsure, run protocol probing in the app first, then use the model connectivity check to confirm.
If auto-detection misses the mark, turn it off in Advanced settings, choose a protocol manually, and confirm with a connectivity check.
### Run these checks before saving
### Verify connectivity
1. **Protocol probing**: confirm which protocols the Base URL supports.
2. **Model connectivity check**: send test requests to one or two models.
3. **Account usage test**: if you want balance or quota display, confirm the usage API and field mapping.
Once credentials and models are in place, click **Check Connection** to send a real request that confirms the API endpoint, key, protocol, and models all work. Select only the models you need to confirm to avoid unnecessary usage.
Save the provider after these checks pass.
### Multiple keys and usage
### Multiple keys and the usage panel
For teams or high-frequency usage, switch to the **Credential pool** tab, add multiple upstream keys, and configure priority, weight, and limits. After saving, filter request logs by credential to verify rotation.
For teams or high-frequency usage, add multiple credentials in the provider form and configure priority, weight, and limits. After saving, filter request logs by credential to verify rotation.
If you want the overview to show balance or remaining quota, turn on **Fetch usage** in the form, choose a usage mode, and test the field mapping.
If you want the overview to show balance or remaining quota, open the provider's **Account / Usage** section, configure the usage integration, and test field mapping.
### Reuse a locally logged-in agent
If Claude Code, Codex, OpenCode, Grok CLI, Kimi CLI, or ZCode is already logged in on this machine, import it as a **Local Agent Provider** from **Providers** to reuse the existing authorization without applying for another key.
For the full walkthrough and field reference, see [Add a provider](provider/).
## Connect Agent Config
@ -77,11 +81,7 @@ Choose Grok CLI and select a default model, then run the copied `ccr-app <profil
### ZCode
ZCode mainly uses model, Provider ID, Provider Name, and whether it is launched from CCR. It launches as an app rather than a CLI and does not need Codex CLI path fields.
### Reuse a locally logged-in agent
If Claude Code, Codex, OpenCode, Grok CLI, Kimi CLI, or ZCode is already logged in on this machine, import it as a **Local Agent Provider** from **Providers** to reuse the existing authorization without applying for another key.
Choose ZCode and set the **ZCode model**, **Provider ID**, and **Provider Name**. ZCode is a desktop-app agent (entry fixed to **App only**): CCR writes its CLI config and model cache, then launches the app with this profile's model, provider, and an isolated user-data directory; open it from the play button on the profile card.
## Logs and observability

View file

@ -2,39 +2,67 @@
title: Connect Agent Config
pageTitle: Connect Agent Config
eyebrow: Quick start
lead: After connecting a provider, use this page to point Claude Code, Codex, Grok CLI, Kimi CLI, ZCode, and other agents at CCR's providers, routing, and model selection.
lead: "After connecting a provider, use this page to connect your agent to CCR: add a profile in Agent Config, pick a model, then open the agent from CCR and verify it in request logs. Covers Claude Code, Codex, Grok CLI, Kimi CLI, ZCode, and more."
---
## General guidance
- During trial, prefer **Only opened from CCR** so only agents launched from CCR are affected.
- After it is stable, consider **System default** if you want the agent's default config changed.
- After applying, launch the agent from CCR's **Open Agent** action when possible.
- In **Agent Config**, click **Add Profile**, choose your agent, and enter a **Profile name**.
- During trial, prefer **Only opened from CCR** (the default) so only agents launched from CCR are affected; switch to **System default** once it is stable.
- Claude Code and Codex let you choose an **Entry mode** (CLI & APP / CLI only / App only); Grok CLI and Kimi CLI are CLI-only, and ZCode is App-only.
- After saving, launch the agent from the buttons on its profile card (the terminal button opens the CLI, the play button opens the app), then verify with one request in **Request logs**.
## Claude Code
In **Agent Config**, choose Claude Code, set the model, small fast model, and settings file, then click Apply.
Supports both CLI and App.
Open Claude Code from CCR and send one request to verify it in request logs.
1. **Add Profile** → choose **Claude Code**, enter a **Profile name**, and pick a **Scope** and **Entry mode**.
2. Choose a **Model** (leave blank to keep Claude Code's default).
3. **Save**, then open the CLI with the terminal button or the Claude App with the play button.
4. Send a message to confirm it replies, and check **Request logs** to verify the request went through the gateway; use `/model` in the CLI to list and switch CCR-exposed models.
For tier models, the settings file, and environment variables, see [Claude Code setup and configuration](../../configuration/agents/claude-code/).
## Codex
In **Agent Config**, choose Codex and confirm Provider ID, Provider Name, model, and config file.
Supports both Codex CLI and the ChatGPT desktop app.
Only fill Codex CLI path and Codex home when you need a specific CLI or home directory.
1. **Add Profile** → choose **Codex**, enter a **Profile name**, and pick a **Scope** and **Entry mode**.
2. Confirm the **Provider ID**, **Provider Name**, and **Codex model**.
3. **Save**, then open the CLI with the terminal button or ChatGPT with the play button.
4. Send a message to confirm it replies, and check **Request logs** to verify the request went through the gateway.
For `config.toml` fields, the CLI path, and ChatGPT login sharing, see [Codex setup and configuration](../../configuration/agents/codex/).
## Grok CLI
Choose Grok CLI, select a model, and run the copied `ccr-app <profile-name>` command. When the CCR Desktop gateway is not running, the command starts a shared temporary gateway service that remains available until the last concurrent Grok session exits. Use `/model` inside Grok to switch among models exposed by CCR.
CLI-only, always scoped to **Only opened from CCR** — your global Grok config is left untouched.
1. **Add Profile** → choose **Grok CLI**, enter a **Profile name**.
2. Choose a **Model**.
3. **Save**, then copy and run the card's `ccr-app "<profile-name>"` command.
4. Send a message in Grok to confirm it replies, and check **Request logs** to verify the request went through the gateway; use `/model` to switch CCR-exposed models.
When the CCR Desktop gateway is not running, the command starts a shared temporary gateway that stops after the last session exits. For all fields, see [Grok CLI setup and configuration](../../configuration/agents/grok/).
## Kimi CLI
Choose Kimi CLI, select a default model and one or more available CCR models, then run the copied `ccr-app <profile-name>` command. CCR launches Kimi with a profile-specific `KIMI_CODE_HOME` whose generated `config.toml` registers every selected model against the local CCR gateway. Use `/model` inside Kimi to switch among them. The original `~/.kimi-code/config.toml` is not changed, while sessions, skills, plugins, MCP configuration, and credentials are reused from the source Kimi home when available. The wrapper can also start the same managed temporary gateway when CCR Desktop is not running.
CLI-only, always scoped to **Only opened from CCR** — your existing `~/.kimi-code/config.toml` is never overwritten.
1. **Add Profile** → choose **Kimi CLI**, enter a **Profile name**.
2. Choose a **Kimi model** (the default) and one or more **Available models**.
3. **Save**, then copy and run the card's `ccr-app "<profile-name>"` command.
4. Send a message in Kimi to confirm it replies, and check **Request logs** to verify the request went through the gateway; use `/model` to switch between the default and available models.
CCR launches Kimi with a profile-specific `KIMI_CODE_HOME` and reuses sessions, skills, plugins, and credentials from the source home. For all fields, see [Kimi CLI setup and configuration](../../configuration/agents/kimi/).
## ZCode
ZCode mainly uses model, Provider ID, Provider Name, and whether it is launched from CCR. It launches as an app rather than a CLI and does not need Codex CLI path fields.
App-only (entry fixed to **App only**).
## Reuse a locally logged-in agent
1. **Add Profile** → choose **ZCode**, enter a **Profile name**.
2. Confirm the **ZCode model**, **Provider ID**, and **Provider Name**.
3. **Save**, then open ZCode with the play button (opening again activates the existing window).
4. Send a message to confirm it replies, and check **Request logs** to verify the request went through the gateway.
If Claude Code, Codex, Grok CLI, Kimi CLI, or ZCode is already logged in on this machine, import it as a **Local Agent Provider** from **Providers** to reuse the existing authorization without applying for another key. Kimi CLI imports both managed OAuth logins and API-key providers from `~/.kimi-code/config.toml`.
For a field-by-field reference and advanced topics like multiple instances and bot binding, see [ZCode setup and configuration](../../configuration/agents/zcode/).

View file

@ -2,37 +2,49 @@
title: Add a provider
pageTitle: Add a provider
eyebrow: Quick start
lead: "Add an upstream model provider to CCR: choose a protocol, enter credentials and models, and run protocol probing, model connectivity, and account usage checks before saving."
lead: "Add an upstream model provider to CCR: pick a preset or custom endpoint, enter the API endpoint and credentials, let CCR auto-detect protocols and models, then verify the full path with a connectivity check."
---
## Add the provider
1. Open **Providers** and click **Add Provider**.
2. Choose a built-in preset under **Preset providers**. Presets fill common Base URLs, protocols, and icons automatically.
3. If the service is not listed, choose **Other / custom API endpoint**.
4. Fill in **Name**, **Base URL**, **Protocol**, **API Key**, and **Models**.
2. Choose a built-in preset under **Select preset provider**. Presets fill common API endpoints, protocols, and icons automatically.
3. If the service is not listed, choose **Other / custom API endpoint** and enter a **Name** and **API endpoint**.
4. In the **Add credentials** step, enter the **API key**.
## Choose a protocol
After you enter the API endpoint and key, CCR automatically detects the protocols and models the endpoint supports. Preset providers hide the API endpoint field by default; override it in **Advanced settings** if needed.
## Protocols
The protocol decides which request format CCR uses to talk to the upstream. It is chosen by auto-detection by default; use the table below when you need to pick manually.
| Protocol | Best for |
| --- | --- |
| OpenAI Chat Completions | Most OpenAI-compatible services |
| OpenAI Chat | Most OpenAI-compatible services |
| OpenAI Responses | Services that support the Responses API |
| Anthropic Messages | Anthropic official or Anthropic-compatible services |
| Gemini Generate Content | Gemini official or Gemini-compatible services |
| Gemini Generate | Gemini official or Gemini-compatible services |
| Gemini Interactions | Services that support the Gemini Interactions protocol |
If you are unsure, run protocol probing in the app first, then use the model connectivity check to confirm.
If auto-detection misses the mark, turn it off in **Advanced settings**, choose a protocol manually, and confirm with a connectivity check.
## Run these checks before saving
## Verify connectivity
1. **Protocol probing**: confirm which protocols the Base URL supports.
2. **Model connectivity check**: send test requests to one or two models.
3. **Account usage test**: if you want balance or quota display, confirm the usage API and field mapping.
Once credentials and models are in place, click **Check Connection**: CCR sends a real request with the current API endpoint, key, protocol, and selected models to confirm the full path works. Output is length-limited, but it may still consume a few tokens or count toward provider-side request limits, so select only the models you need to confirm.
Save the provider after these checks pass.
Save the provider once the check passes.
## Multiple keys and the usage panel
## Multiple keys and usage
For teams or high-frequency usage, add multiple credentials in the provider form and configure priority, weight, and limits.
For teams or high-frequency usage, switch to the **Credential pool** tab in the credentials step, add multiple upstream keys, and configure priority, weight, and limits. CCR rotates between them according to your rules.
If you want the overview to show balance or remaining quota, open the provider's **Account / Usage** section, configure the usage integration, and test field mapping.
To show balance or remaining quota in the provider list, tray, or overview, turn on **Fetch usage** in the form, choose a usage mode, and test the field mapping.
For full details on credential limits and usage field mapping, see [Provider config](../../configuration/providers/).
## Related pages
- [Install and start CCR](../install/)
- [Connect Agent Config](../agent-profile/)
- [Provider config](../../configuration/providers/)
- [Routing](../../configuration/routing/)

View file

@ -48,6 +48,18 @@ ZCode 导入会读取本机 ZCode 配置中的供应商 API Key、API 地址和
如果只检测到 ZCode 登录态,但没有检测到可用供应商 API Key导入入口会显示不可导入。此时需要先在 ZCode 中配置可用模型供应商,再回到 CCR 添加供应商。
### Kimi CLI
Kimi CLI 导入会读取本机 Kimi 配置(默认 `~/.kimi-code/config.toml`)中的受管 OAuth 登录态或 API Key。检测到可用凭据时可以导入为 `Kimi CLI API` 供应商。
导入后:
1. 协议使用 `openai_chat_completions`
2. 模型优先来自 Kimi 配置中的模型列表,没有时回退到默认模型 `kimi-for-coding`
3. CCR 会按凭据类型创建 OAuth 或 API Key provider plugin复用 Kimi 登录态访问上游服务。
如果只检测到登录痕迹但没有可用的 OAuth token导入入口会显示原因。此时先在 Kimi CLI 中运行 `/login`,再回到 CCR 重新扫描。
## 主字段
| 字段 | 代表的能力 |

View file

@ -24,34 +24,38 @@ CCR 提供三种发行方式桌面应用、Node.js 22+ 的 npm CLI以及 D
### 添加供应商
1. 进入 **供应商** 页面,点击 **添加供应商**
2. 在 **预设供应商** 中选择内置预设。预设会自动填入常见的基础 URL、协议和图标。
3. 如果服务不在预设里,选择 **其他 / 自定义 API 端点**。
4. 填写 **名称**、**基础 URL**、**协议**、**API Key** 和 **模型**。
2. 在 **选择 预设供应商** 中选择内置预设。预设会自动填入常见的 API 地址、协议和图标。
3. 如果服务不在预设里,选择 **其他 / 自定义 API 地址**,并填写 **名称****API 地址**。
4. **添加凭据** 步骤填写 **API 密钥**。
### 协议怎么选
填写 API 地址和密钥后CCR 会自动探测该端点支持的协议与可用模型。
### 协议
| 协议 | 适用场景 |
| --- | --- |
| OpenAI Chat Completions | 绝大多数 OpenAI 兼容服务 |
| OpenAI Chat | 绝大多数 OpenAI 兼容服务 |
| OpenAI Responses | 支持 Responses API 的服务 |
| Anthropic Messages | Anthropic 官方或兼容 Anthropic 协议的服务 |
| Gemini Generate Content | Gemini 官方或兼容 Gemini 协议的服务 |
| Gemini 生成 | Gemini 官方或兼容 Gemini 协议的服务 |
拿不准时,先使用 App 里的协议探测,再用模型连通性检查确认。
自动探测结果不理想时,可在高级设置中关闭自动探测并手动选择,再用连通性检查确认。
### 保存前做这三项检查
### 验证连通性
1. **协议探测**:确认基础 URL 支持哪些协议。
2. **模型连通性检查**:选一两个模型实际发测试请求。
3. **账户用量测试**:如果要展示余额或配额,确认用量接口能读到数据。
填好凭据和模型后,点击 **检测连通性**,用一次真实请求确认 API 地址、密钥、协议和模型是否可用。建议只勾选需要确认的模型,避免不必要的消耗。
这些检查通过后再保存供应商。
### 多 Key 与用量读取
### 多 Key 与用量面板
团队或高频调用场景,可在凭据步骤切换到 **凭据池**,添加多条上游 Key 并设置优先级、权重和限额,保存后到请求日志里按凭据筛选,确认轮换符合预期。
如果是团队或高频调用,可以在供应商表单里添加多条凭据,并设置优先级、权重和限额。保存后到请求日志里按凭据筛选,确认轮换符合预期
如果希望概览显示余额或剩余配额,在表单中打开 **获取用量**,选择用量读取方式并测试字段映射
如果希望概览显示余额或剩余配额,打开供应商的 **账户 / 用量**,配置用量接入方式并测试字段映射。
### 复用本机已登录的 Agent
如果本机已经登录过 Claude Code、Codex、OpenCode、Grok CLI、Kimi CLI 或 ZCode可以在 **供应商** 中导入为 **本机 Agent 供应商**,复用已有授权,不必额外申请 Key。
完整步骤与字段说明见 [接入供应商](provider/)。
## 接入 Agent 配置
@ -77,11 +81,7 @@ Agent 配置让 Claude Code、Codex、OpenCode、Grok CLI、Kimi CLI、ZCode 等
### ZCode
ZCode 主要关注模型、供应商 ID、供应商名称以及是否从 CCR 启动。它以 App 形态运行,不需要 Codex CLI 的路径字段。
### 复用本机已登录的 Agent
如果本机已经登录过 Claude Code、Codex、OpenCode、Grok CLI、Kimi CLI 或 ZCode可以在 **供应商** 中导入为 **本机 Agent 供应商**,复用已有授权,不必额外申请 Key。
选择 ZCode 并设置 **ZCode 模型**、**供应商 ID** 和 **供应商名称**。ZCode 是以桌面应用形态运行的 Agent入口固定为 **仅 App**CCR 写入它的 CLI 配置和模型缓存后,用该配置的模型、供应商和独立的用户数据目录启动 App从配置卡片上的播放按钮打开。
## 日志与观测

View file

@ -2,39 +2,67 @@
title: 接入 Agent 配置
pageTitle: 接入 Agent 配置
eyebrow: 快速开始
lead: 供应商配置完成后,用本页把 Claude Code、Codex、Grok CLI、Kimi CLI、ZCode 等 Agent 接入 CCR 的供应商、路由和模型选择
lead: "供应商配置完成后,用本页把你的 Agent 接入 CCR在 Agent 配置里添加配置、选择模型,再从 CCR 打开并在请求日志中验证。覆盖 Claude Code、Codex、Grok CLI、Kimi CLI、ZCode 等。"
---
## 通用建议
- 试用阶段优先选择“仅从 CCR 打开时生效”,只影响从 CCR 打开的 Agent。
- 稳定后再考虑系统默认配置。
- 应用后尽量使用 CCR 里的“打开 Agent”启动 Agent。
- 在 **Agent 配置** 点击 **添加配置**,选择你的 Agent填写 **配置名称**
- 试用阶段优先选择 **仅从 CCR 打开时生效**(默认),只影响从 CCR 打开的 Agent确认稳定后再考虑 **系统默认**
- Claude Code、Codex 可选择 **入口模式**CLI 与 APP / 仅 CLI / 仅 AppGrok CLI、Kimi CLI 固定为仅 CLIZCode 固定为仅 App。
- 保存后尽量用配置卡片上的按钮启动 Agent终端按钮打开 CLI播放按钮打开 App再发一条请求到 **请求日志** 验证。
## Claude Code
**Agent 配置** 中选择 Claude Code设置模型、小型快速模型和设置文件然后点击应用
支持 CLI 和 App 两种形态
从 CCR 打开 Claude Code 后,发一次请求到请求日志里验证。
1. **添加配置** → 选择 **Claude Code**,填写 **配置名称**,选择 **生效范围****入口模式**
2. 选择 **模型**(留空则保留 Claude Code 默认模型)。
3. **保存**,然后用终端按钮打开 CLI或播放按钮打开 Claude App。
4. 发一条消息确认能正常回复,到 **请求日志** 核对请求是否经过网关CLI 中可用 `/model` 查看、切换 CCR 暴露的模型。
各档位模型、设置文件和环境变量见 [Claude Code 接入与配置](../../configuration/agents/claude-code/)。
## Codex
**Agent 配置** 中选择 Codex确认供应商 ID、供应商名称、模型和配置文件。
支持 Codex CLI 和 ChatGPT 桌面应用两种形态
需要特定 CLI 时再填写 Codex CLI path 和 Codex home。
1. **添加配置** → 选择 **Codex**,填写 **配置名称**,选择 **生效范围****入口模式**
2. 确认 **供应商 ID**、**供应商名称** 和 **Codex 模型**
3. **保存**,然后用终端按钮打开 CLI或播放按钮打开 ChatGPT。
4. 发一条消息确认能正常回复,到 **请求日志** 核对请求是否经过网关。
`config.toml` 字段、CLI 路径和 ChatGPT 登录共享见 [Codex 接入与配置](../../configuration/agents/codex/)。
## Grok CLI
选择 Grok CLI、设置模型然后运行复制出的 `ccr-app <配置名称>` 命令。CCR Desktop 网关尚未运行时,该命令会启动一个可共享的临时网关服务,并保持运行到最后一个并发 Grok 会话退出。进入 Grok 后可以使用 `/model` 切换 CCR 暴露的模型。
仅支持 CLI且固定为 **仅从 CCR 打开时生效**,不会改动你的全局 Grok 配置。
1. **添加配置** → 选择 **Grok CLI**,填写 **配置名称**
2. 选择 **模型**
3. **保存**,复制卡片上的 `ccr-app "<配置名称>"` 命令并运行。
4. 在 Grok 中发一条消息确认能正常回复,到 **请求日志** 核对请求是否经过网关;用 `/model` 切换 CCR 暴露的模型。
CCR Desktop 未运行时,该命令会启动一个可共享的临时网关,并在最后一个会话退出后停止。完整字段见 [Grok CLI 接入与配置](../../configuration/agents/grok/)。
## Kimi CLI
选择 Kimi CLI、设置默认模型和一个或多个可用 CCR 模型,然后运行复制出的 `ccr-app <配置名称>` 命令。CCR 会通过配置专属 `KIMI_CODE_HOME` 启动 Kimi并在其中生成 `config.toml`,把所有选中模型注册到本地 CCR 网关。进入 Kimi 后可使用 `/model` 在这些模型之间切换。用户原有的 `~/.kimi-code/config.toml` 不会被改写;可用时,会继续复用来源 Kimi home 中的会话、技能、插件、MCP 配置和凭据。CCR Desktop 未运行时,该包装器同样可以启动受管的临时网关。
仅支持 CLI且固定为 **仅从 CCR 打开时生效**,不会改写原有的 `~/.kimi-code/config.toml`
1. **添加配置** → 选择 **Kimi CLI**,填写 **配置名称**
2. 选择 **Kimi 模型**(默认模型)以及一个或多个 **可用模型**
3. **保存**,复制卡片上的 `ccr-app "<配置名称>"` 命令并运行。
4. 在 Kimi 中发一条消息确认能正常回复,到 **请求日志** 核对请求是否经过网关;用 `/model` 在默认模型与可用模型之间切换。
CCR 会用配置专属的 `KIMI_CODE_HOME` 启动 Kimi并复用源 home 中的会话、技能、插件和凭据。完整字段见 [Kimi CLI 接入与配置](../../configuration/agents/kimi/)。
## ZCode
ZCode 主要关注模型、供应商 ID、供应商名称以及是否从 CCR 启动。它以 App 形态运行,不需要 Codex CLI 的路径字段。
仅支持 App入口固定为 **仅 App**
## 复用本机已登录的 Agent
1. **添加配置** → 选择 **ZCode**,填写 **配置名称**
2. 确认 **ZCode 模型**、**供应商 ID** 和 **供应商名称**
3. **保存**,点击播放按钮打开 ZCode再次打开会激活已有窗口
4. 发一条消息确认能正常回复,到 **请求日志** 核对请求是否经过网关。
如果本机已经登录过 Claude Code、Codex、Grok CLI、Kimi CLI 或 ZCode可以在 **供应商** 中导入为 **本机 Agent 供应商**,复用已有授权,不必额外申请 Key。Kimi CLI 支持从 `~/.kimi-code/config.toml` 导入受管 OAuth 登录态和 API Key 供应商。
字段逐项说明和多实例、机器人绑定等进阶用法见 [ZCode 接入与配置](../../configuration/agents/zcode/)

View file

@ -2,37 +2,49 @@
title: 接入供应商
pageTitle: 接入供应商
eyebrow: 快速开始
lead: 在 CCR 中添加上游模型供应商:选择协议、填写凭据和模型,并在保存前完成协议探测、模型连通性和账户用量检查
lead: 在 CCR 中添加上游模型供应商:选择预设或自定义端点,填写 API 地址和凭据CCR 会自动探测协议与模型,最后用连通性检查确认整条链路可用
---
## 添加供应商
1. 进入 **供应商** 页面,点击 **添加供应商**
2. 在 **预设供应商** 中选择内置预设。预设会自动填入常见的基础 URL、协议和图标。
3. 如果服务不在预设里,选择 **其他 / 自定义 API 端点**。
4. 填写 **名称**、**基础 URL**、**协议**、**API Key** 和 **模型**。
2. 在 **选择 预设供应商** 中选择内置预设。预设会自动填入常见的 API 地址、协议和图标。
3. 如果服务不在预设里,选择 **其他 / 自定义 API 地址**,并填写 **名称****API 地址**。
4. **添加凭据** 步骤填写 **API 密钥**。
## 协议怎么选
填写 API 地址和密钥后CCR 会自动探测该端点支持的协议与可用模型。预设供应商默认隐藏 API 地址输入,需要时可在 **高级设置** 中覆盖。
## 协议
协议决定 CCR 以哪种格式与上游通信,默认由自动探测选择。需要手动指定时参考下表。
| 协议 | 适用场景 |
| --- | --- |
| OpenAI Chat Completions | 绝大多数 OpenAI 兼容服务 |
| OpenAI Chat | 绝大多数 OpenAI 兼容服务 |
| OpenAI Responses | 支持 Responses API 的服务 |
| Anthropic Messages | Anthropic 官方或兼容 Anthropic 协议的服务 |
| Gemini Generate Content | Gemini 官方或兼容 Gemini 协议的服务 |
| Gemini 生成 | Gemini 官方或兼容 Gemini 协议的服务 |
| Gemini Interactions | 支持 Gemini Interactions 协议的服务 |
拿不准时,先使用 App 里的协议探测,再用模型连通性检查确认。
自动探测结果不理想时,可在 **高级设置** 中关闭自动探测并手动选择协议,再用连通性检查确认。
## 保存前做这三项检查
## 验证连通性
1. **协议探测**:确认基础 URL 支持哪些协议。
2. **模型连通性检查**:选一两个模型实际发测试请求。
3. **账户用量测试**:如果要展示余额或配额,确认用量接口能读到数据。
填好凭据和模型后,点击 **检测连通性**CCR 会用当前的 API 地址、密钥、协议和所选模型发送一次真实请求,确认整条链路可用。检测会限制输出长度,但仍可能产生少量 token 消耗或计入供应商侧请求次数,因此建议只勾选需要确认的模型。
这些检查通过后再保存供应商。
检测结果通过后再保存供应商。
## 多 Key 与用量面板
## 多 Key 与用量读取
如果是团队或高频调用,可以在供应商表单里添加多条凭据,并设置优先级、权重和限额
团队或高频调用场景,可在凭据步骤切换到 **凭据池**,添加多条上游 Key 并设置优先级、权重和限额CCR 会按规则在 Key 之间轮换
如果希望概览显示余额或剩余配额,打开供应商的 **账户 / 用量**,配置用量接入方式并测试字段映射。
如果希望供应商列表、托盘或概览展示余额或剩余配额,在表单中打开 **获取用量**,选择用量读取方式并测试字段映射。
凭据池的限额规则和用量字段映射的完整说明见 [供应商配置](../../configuration/providers/)。
## 相关页面
- [安装并启动 CCR](../install/)
- [接入 Agent 配置](../agent-profile/)
- [供应商配置](../../configuration/providers/)
- [智能路由](../../configuration/routing/)

View file

@ -3,17 +3,14 @@ import "../styles/global.css";
import {
ArrowLeft,
ArrowRight,
BookOpen,
ChevronDown,
Download,
Github,
List,
Moon,
PenLine,
Rocket,
Search,
Sun,
WandSparkles,
} from "lucide-astro";
import { enToZhPath, zhToEnPath } from "../docs-structure";
@ -123,12 +120,6 @@ const resolvedNavItems = navItems.map((item, index) => {
const homeHref = withBase(locale === "en" ? "/en/" : "/");
const faviconHref = withBase("/ccr-icon.png");
const logoSrc = withBase("/logo.png");
const sidebarIcons = {
rocket: Rocket,
book: BookOpen,
wand: WandSparkles,
pen: PenLine,
};
const pageDescription =
description ??
(locale === "zh"
@ -385,14 +376,9 @@ const featuredNavLabel = locale === "zh" ? "主要入口" : "Primary navigation"
</nav>
) : (
sidebarGroups.map((group) => {
const GroupIcon = sidebarIcons[group.icon] ?? BookOpen;
return (
<section class="sidebar-group">
<h2>
<GroupIcon class="group-icon" size={16} aria-hidden="true" />
{group.label}
</h2>
<h2>{group.label}</h2>
<ul>
{group.items.map((item) => (
<li>

View file

@ -858,13 +858,6 @@ pre {
color: var(--sidebar-heading);
}
.group-icon {
width: 16px;
height: 16px;
color: var(--sidebar-icon);
flex: 0 0 auto;
}
.sidebar-group ul {
display: grid;
gap: 1px;