Appearance
在 Hermes Agent 中使用 AgentRouter
Hermes Agent 通过自定义 provider extension 接入 AgentRouter,支持 Anthropic Messages(Claude Opus 系列)与 OpenAI Compatible(gpt-5.5 / glm-5.2)两类。
安装与配置步骤
1. 打开终端
macOS / Linux 使用 Terminal;Windows 使用 PowerShell。
2. 安装 Hermes
bash
# macOS / Linux
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
# 如果已安装 pipx,也可以
pipx install hermes-agentpowershell
# Windows PowerShell
iex (irm https://hermes-agent.nousresearch.com/install.ps1)3. 检查安装结果
bash
hermes --version
hermes --help4. 运行模型配置向导
按向导填写 AgentRouter Provider。
bash
hermes setup model5. 创建自定义 provider extension
下面两段二选一。
Anthropic(claude-opus 系列):
typescript
export default function (pi: ExtensionAPI) {
pi.registerProvider("agentrouter-claude", {
name: "AgentRouter Claude",
baseUrl: "https://agentrouter.org",
apiKey: process.env.AGENTROUTER_API_KEY || "<AGENTROUTER_API_KEY>",
api: "anthropic-messages",
models: [
{
id: "claude-opus-4-6",
name: "Claude Opus 4.6 via AgentRouter",
reasoning: false,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000000,
maxTokens: 8192
}
]
});
}OpenAI Compatible(gpt-5.5 / glm-5.2):
typescript
export default function (pi: ExtensionAPI) {
pi.registerProvider("agentrouter-openai", {
name: "AgentRouter openai",
baseUrl: "https://agentrouter.org/v1",
apiKey: process.env.AGENTROUTER_API_KEY || "<AGENTROUTER_API_KEY>",
api: "OpenAI Compatible",
models: [
{
id: "gpt-5.5/glm-5.2",
name: "GPT-5.5/GLM-5.2",
reasoning: false,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000000,
maxTokens: 8192
}
]
});
}6. 启动并测试
bash
hermes chat
# 输入:只回复 OK
# 再输入:列出当前目录下的文件,并说明是否存在 README 文件