最后核验: 2026年7月31日 · Hermes 0.16.0 · OpenClaw 2026.7.1-2
自托管的 agent 接不上模型就没用。Hermes 和 OpenClaw 都能交互式选 inference provider,存进本地配置文件——密钥放环境变量,绝不进文件。本指南覆盖官方命令 + 配置结构(2026-07-31 核验);不显示任何真实 key。
Hermes —— hermes model
Hermes 自带交互式 provider 选择器:
hermes model
它列出 provider,拉每个的 /v1/models 列表,让你选默认。Nous 托管的 provider 能走 OAuth 登录(无头机器用 --no-browser / --manual-paste)。重新拉 provider 列表:hermes model --refresh。
结果落在 ~/.hermes/config.yaml,结构(只列键名)是:
model: # 默认
provider: <名字>
api_mode: <模式>
providers: # 命名的 provider
<名字>:
base_url: <https://...>
api_mode: <模式>
models: [...]
这是 OpenAI 兼容的形状(base_url + api_mode + models),所以任何 OpenAI 兼容端点——包括 CPA、NewAPI 这类自建代理——都能当 provider:把 base_url 指向代理,key 放环境变量。
OpenClaw —— openclaw configure
OpenClaw 的交互式配置一次性走完凭据、渠道、网关、agent、model:
openclaw configure
非交互式编辑,OpenClaw 有类型化的配置助手:
openclaw config file # 打印当前配置文件路径
openclaw config schema # 打印 openclaw.json 的 JSON schema
openclaw config get providers.models # 按 dot path 取值
openclaw config set <path> <value> # 按 path 设值(值模式,或 ref/provider)
openclaw config patch --file ./patch.json5 # 一次校验过的 JSON5 写入
配置在 ~/.openclaw/openclaw.json;密钥放 ~/.openclaw/.env,从配置里引用。受管的环境 key(比如 NEWAPI_KEY、CPAMC_KEY)就是 OpenClaw 从环境读的那些——所以接自建 NewAPI 或 CPA 代理,就是把 provider 的 base URL 指向代理,再设对应的 *_KEY 环境变量。
接自建代理(CPA / NewAPI)
两边都说 OpenAI 兼容 provider,所以一个提供 OpenAI 风格 /v1/chat/completions 的自建代理,两边都能接:
- 起代理(比如 CPA 在
:8317,NewAPI 在它自己的端口)。 - 在 harness 配置里加个 provider,
base_url指向代理 URL。 - 把代理的 API key 放进 harness 读的环境变量(Hermes:配置里的 key 字段;OpenClaw:从
openclaw.json引用的对应*_KEY环境变量)。 - 选成默认模型(
hermes model/openclaw configure)。
好处:一个本地代理前面挂多个上游模型/key,harness 指向它——换上游不用动 harness 配置。
来源 + 时效
命令(hermes model --help、openclaw configure --help、openclaw config --help)和配置结构(Hermes config.yaml 键名、OpenClaw config 子命令)于 2026-07-31 核验。没有读取或显示任何真实凭据。两个项目迭代快——部署前重新核对 CLI。