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

# 配置 Hermes Agent

> 配置 Hermes Agent 以与 Crazyrouter 协作，并通过 OpenAI 兼容的端点使用兼容的 AI 模型

> 内容更新: 2026-10-12

借助 [crazyrouter-hermes](https://github.com/xujfcn/crazyrouter-hermes)，您可以将 [Hermes Agent](https://github.com/NousResearch/Hermes-Agent) 切换为以 Crazyrouter 作为模型提供商。配置完成后，Hermes 就会使用 `https://api.crazyrouter.com/v1` 作为 OpenAI 兼容端点，通过一个 Crazyrouter API Key 调用 Claude、GPT、DeepSeek、Gemini、Qwen 和 627+ 其他模型。

## 适用对象

* Hermes Agent 用户，想要将 Crazyrouter 作为模型提供商
* 本地 agent 场景，需要通过 Crazyrouter 管理模型和额度
* 需要一条命令设置 `OPENAI_API_KEY`、`OPENAI_BASE_URL` 和默认模型的用户

## 要求

| 条目 | 说明 |
| - | - |
| Hermes Agent | 在本地安装 Hermes 并确保其可以正常启动 |
| Crazyrouter 账号 | 在 [crazyrouter.com](https://crazyrouter.com) 注册账号 |
| Crazyrouter API Key | 建议为 Hermes 单独创建一个 `sk-...` token |
| 模型访问权限 | 在 token 中允许您计划使用的模型 |

> [!TIP]
>
> Hermes 通过 OpenAI 兼容设置接入 Crazyrouter。Base URL 应设置为 `https://api.crazyrouter.com/v1`。

## 一键配置

> [tab] Linux / macOS / WSL2
>
> ```bash theme={null}
> curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-hermes/main/setup.sh | bash
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={null}
> irm https://raw.githubusercontent.com/xujfcn/crazyrouter-hermes/main/setup.ps1 | iex
> ```

> [tab] Windows CMD
>
> ```bat theme={null}
> curl -o setup.bat https://raw.githubusercontent.com/xujfcn/crazyrouter-hermes/main/setup.bat
> setup.bat
> ```

脚本会提示输入 Crazyrouter API Key，选择默认模型，并在需要时测试连接。

> [!WARNING]
>
> 脚本会写入本地 Hermes 配置。如已有自定义设置，建议先备份 `~/.hermes/.env` 和 `~/.hermes/config.yaml`。

## 手动配置

如不想运行脚本，可手动配置 Hermes。

### 环境变量

编辑 `~/.hermes/.env`：

```bash theme={null}
OPENAI_API_KEY=sk-your-crazyrouter-key
OPENAI_BASE_URL=https://api.crazyrouter.com/v1
```

### 默认模型

编辑 `~/.hermes/config.yaml`：

```yaml theme={null}
model:
  provider: "custom"
  default: "claude-opus-4-8"
  base_url: "https://api.crazyrouter.com/v1"
```

将 `default` 改成您的 Crazyrouter token 已允许的任一模型。

## 切换模型

配置后，可通过 `/model` 在 Hermes 内切换模型：

```text theme={null}
/model claude-opus-4-8
/model gpt-5.5
/model claude-sonnet-4-6
/model gemini-3.1-pro
/model deepseek-v4-pro
/model qwen-max
/model gpt-4o
```

如切换时出现 `model not allowed` 或 `403`，通常是所选模型未在当前 Crazyrouter token 中启用。

## 检查清单

* [ ] `OPENAI_API_KEY` 于 `~/.hermes/.env` 是有效 Crazyrouter token
* [ ] `OPENAI_BASE_URL` 等于 `https://api.crazyrouter.com/v1`
* [ ] `provider` 于 `~/.hermes/config.yaml` 等于 `custom`
* [ ] 默认模型在 Crazyrouter token 中被允许
* [ ] Hermes 对测试消息作出响应
* [ ] `/model gpt-5.5` 或其他已授权模型可成功切换

## 常见问题

| 症状 | 可能原因 | 解决方案 |
| - | - | - |
| `401 unauthorized` | API Key 错误、过期或已被替换 | 创建新的 Crazyrouter token 并更新 `~/.hermes/.env` |
| `403` 或 `model not allowed` | token 未授权所选模型 | 在 Crazyrouter token 设置中授权相关模型 |
| Hermes 仍然使用旧的模型提供商 | Hermes 未重新读取配置或修改了错误文件 | 重启 Hermes 并检查 `~/.hermes/.env` 与 `~/.hermes/config.yaml` |
| 连接超时 | 本地网络无法连接 Crazyrouter | 检查 proxy、防火墙与 DNS |

> [card] [打开仓库 crazyrouter-hermes](https://github.com/xujfcn/crazyrouter-hermes)
>
> 查看配置脚本、手动配置示例及最新说明。


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