One-shot config script that wires llmapi — a Claude-compatible relay — into Hermes Agent as a custom_providers backend.
- Appends a
custom_providersentry namedllmapito~/.hermes/config.yaml, withapi_mode: anthropic_messagesso Hermes speaks the Claude Messages protocol upstream. - Writes
LLMAPI_KEY=...into~/.hermes/.env(idempotent — replaces an existing line, never duplicates). - Belt-and-suspenders: explicitly sets
api_modeafter the named-custom switch (runshermes config set model.api_mode anthropic_messagesif the CLI is onPATH). No-op on Hermes ≥ v0.5; safety net for older versions. - Backs up your existing
config.yamland.envbefore touching them.
# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/llmapi-pro/hermes-setup/main/setup.sh | bash
# or, recommended: download and review first
curl -fsSL https://raw.githubusercontent.com/llmapi-pro/hermes-setup/main/setup.sh -o setup.sh
less setup.sh
bash setup.sh# Windows PowerShell
iwr -useb https://raw.githubusercontent.com/llmapi-pro/hermes-setup/main/setup.ps1 | iex
# or, recommended: download and review first
iwr -useb https://raw.githubusercontent.com/llmapi-pro/hermes-setup/main/setup.ps1 -OutFile setup.ps1
notepad setup.ps1
.\setup.ps1You can pass the API key via the LLMAPI_KEY environment variable; otherwise the script will prompt for it.
LLMAPI_KEY=sk-cp-XXXXXXXXXX bash setup.shIf you prefer not to run the script, do this by hand:
-
Append to
~/.hermes/config.yaml:custom_providers: - name: llmapi base_url: https://llmapi.pro api_key_env: LLMAPI_KEY api_mode: anthropic_messages
-
Add your key to
~/.hermes/.env:LLMAPI_KEY=sk-cp-XXXXXXXXXX
-
Belt-and-suspenders
api_modeset (no-op on Hermes ≥ v0.5; safety net for older versions):hermes config set model.api_mode anthropic_messages
Then in Hermes:
/model custom:llmapi:claude-sonnet-4-6
Belt-and-suspenders: after the named-custom switch we explicitly pin model.api_mode to anthropic_messages. On Hermes ≥ v0.5 the named-custom switch already sets the right mode, so this is a no-op. On older Hermes versions it is a safety net that ensures the active provider talks Claude Messages. Remove that line if you ever switch back to a non-Claude-compatible provider.
- Hermes Agent installed and run at least once (so
~/.hermes/config.yamlexists). bash(Linux/macOS) orPowerShell 5.1+(Windows).- An
llmapiAPI key.
一键把 llmapi(Claude-compatible relay)配成 Hermes Agent 的 custom_providers 后端。
- 在
~/.hermes/config.yaml追加一条名为llmapi的custom_providers条目,api_mode: anthropic_messages(让 Hermes 用 Claude Messages 协议和上游通信)。 - 把
LLMAPI_KEY=...写进~/.hermes/.env(幂等,已存在则替换,不重复追加)。 - 保险设置:命名 custom provider 切换后显式设一次
api_mode(如果hermes在PATH里,脚本会执行hermes config set model.api_mode anthropic_messages)。Hermes ≥ v0.5 是 no-op;老版本作为安全兜底。 - 改动前自动备份
config.yaml和.env。
# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/llmapi-pro/hermes-setup/main/setup.sh | bash# Windows PowerShell
iwr -useb https://raw.githubusercontent.com/llmapi-pro/hermes-setup/main/setup.ps1 | iex也可以先下载、审计、再跑。
key 走环境变量,没有就交互输入:
LLMAPI_KEY=sk-cp-XXXXXXXXXX bash setup.sh-
~/.hermes/config.yaml追加:custom_providers: - name: llmapi base_url: https://llmapi.pro api_key_env: LLMAPI_KEY api_mode: anthropic_messages
-
~/.hermes/.env写入:LLMAPI_KEY=sk-cp-XXXXXXXXXX
-
保险设置
api_mode(Hermes ≥ v0.5 是 no-op;老版本作为安全兜底):hermes config set model.api_mode anthropic_messages
进 Hermes 后:
/model custom:llmapi:claude-sonnet-4-6
保险设置:命名 custom provider 切换后,脚本会把 model.api_mode 显式钉成 anthropic_messages。Hermes ≥ v0.5 命名切换本身就会设对,所以这步是 no-op;老版本作为安全兜底,保证当前 provider 走 Claude Messages 协议。如果你以后切回非 Claude-compatible provider,记得改回去。
- 已装 Hermes Agent 且至少跑过一次(
~/.hermes/config.yaml存在)。 bash(Linux/macOS)或PowerShell 5.1+(Windows)。- 一把
llmapiAPI key。