难度:⭐⭐ 基础 | 预计时间:15 分钟 | 适配版本:v0.13.0

配置文件架构
~/.hermes/config.yaml
model
默认模型/Provider
agent
Agent 行为参数
terminal
终端后端配置
display
显示/主题配置
memory
记忆系统配置
tools
工具集开关
gateway
网关配置
checkpoints
快照回滚配置
auxiliary
辅助任务路由
redaction
敏感信息脱敏
hermes auth 凭证池
通过 CLI 管理,替代手动编辑 .env
主要配置项
model --- 模型配置
yaml
model:
default: anthropic/claude-sonnet-4 # 默认模型
provider: openrouter # 默认 Provider
context_length: 200000 # 上下文长度
支持的 Providers(200+):
| Provider | 认证方式 | CLI 添加命令 |
|---|---|---|
| OpenRouter | API Key | hermes auth add openrouter --api-key <key> |
| Anthropic | API Key | hermes auth add anthropic --api-key <key> |
| DeepSeek | API Key | hermes auth add deepseek --api-key <key> |
| xAI / Grok | API Key | hermes auth add xai --api-key <key> |
| Google Gemini | API Key | hermes auth add google --api-key <key> |
| Hugging Face | Token | hermes auth add huggingface --api-key <token> |
| MiniMax | API Key | hermes auth add minimax --api-key <key> |
| MiniMax CN | API Key | hermes auth add minimax-cn --api-key <key> |
| Nous Portal | OAuth | hermes auth add nous --type oauth |
| OpenAI Codex | OAuth | hermes auth add codex --type oauth |
| ... | ... | ... |
v0.13.0 新增 :Provider 插件化架构,第三方可通过
plugins/model-providers/目录即插即用,无需修改核心代码。
agent --- Agent 行为
yaml
agent:
max_turns: 90 # 最大对话轮次
tool_use_enforcement: false # 强制使用工具
terminal --- 终端后端
yaml
terminal:
backend: local # local / docker / ssh / modal / daytona / singularity / vercel
cwd: ~/ # 默认工作目录
timeout: 180 # 命令超时(秒)
7 种后端对比:
| 后端 | 适用场景 | 成本特点 |
|---|---|---|
| Local | 本地开发测试 | 零成本 |
| Docker | 容器化部署 | 基础设施成本 |
| SSH | 现有云主机托管 | 利用现有资源 |
| Singularity | HPC 环境 | 视集群而定 |
| Modal | Serverless,低频使用 | 空闲休眠,月成本个位数美元 |
| Daytona | Serverless,持久化 | 同上 |
| Vercel Sandbox | 边缘部署 | 按量计费 |
Serverless 成本优势:日均消息 < 100 条时,相比常驻 VPS($5-10/月)成本下降 70% 以上。
memory --- 记忆系统
yaml
memory:
memory_enabled: true # 启用持久记忆
user_profile_enabled: true # 用户画像
provider: builtin # builtin / honcho / mem0
memory_char_limit: 3000 # 单条记忆上限
user_char_limit: 2000 # 用户画像上限
checkpoints --- 快照回滚
yaml
checkpoints:
enabled: true # 启用文件系统快照
auto_prune: true # 自动清理旧快照(v0.13.0 Checkpoints v2 真正剪枝)
max_snapshots: 3 # 最多保留快照数
v0.13.0 重要更新:Checkpoints v2 重写状态持久化,真正的剪枝机制,磁盘防护,消除孤立影子仓库。旧 checkpoint 可能需要重建。
auxiliary --- 辅助任务路由
yaml
auxiliary:
compression:
provider: minimax-cn # 上下文压缩 Provider
model: abab6.5s-chat
vision:
provider: minimax-cn # 图像分析 Provider
model: auto
curator: # v0.13.0 新增:Curator 模型配置
provider: minimax-cn
model: auto
redaction --- 敏感信息脱敏(v0.13.0 安全强化)
yaml
redaction:
enabled: true # 默认开启!敏感信息自动脱敏
⚠️ 破坏性变更 :v0.13.0 将
redaction.enabled默认改为true。升级后如需关闭,显式设置redaction.enabled: false。
gateway --- 网关平台白名单(v0.13.0 新增)
yaml
gateway:
platforms:
telegram:
enabled: true
bot_token: "123456:ABC-DEF..."
allowed_chats: # 白名单:仅响应指定聊天
- "-1001234567890"
- "123456789"
slack:
enabled: true
bot_token: "xoxb-..."
signing_secret: "abc..."
allowed_channels: # 白名单:仅响应指定频道
- "#general"
- "#dev"
matrix:
enabled: true
allowed_rooms: # 白名单:仅响应指定房间
- "#hermes:example.com"
v0.13.0 新增平台白名单配置:
allowed_channels(Slack)、allowed_chats(Telegram)、allowed_rooms(Matrix/Mattermost 等),增强安全性。
认证管理(v0.13.0 推荐方式)
bash
# 添加 API Key
hermes auth add openrouter --api-key sk-or-xxxxx
hermes auth add anthropic --api-key sk-ant-xxxxx
# 添加 OAuth(交互式)
hermes auth add nous --type oauth
# 查看所有认证
hermes auth list
hermes auth status openrouter
# 移除认证
hermes auth remove openrouter 0
# 重置冷却时间
hermes auth reset openrouter
# 登出 OAuth
hermes auth logout nous
虽然
.env文件仍兼容,但 v0.13.0 强烈推荐使用hermes auth管理凭证,支持多 key 轮询和自动故障切换。
.env 文件示例(legacy 兼容)
bash
# 模型 API Keys
ANTHROPIC_API_KEY=sk-ant-xxxxx
OPENROUTER_API_KEY=sk-or-xxxxx
DEEPSEEK_API_KEY=sk-xxxxx
MINIMAX_API_KEY=xxxxx
MINIMAX_CN_API_KEY=xxxxx
# TTS / STT(可选)
ELEVENLABS_API_KEY=xxxxx
# 其他
GITHUB_TOKEN=ghp_xxxxx # Skills Hub rate limit 优化
Profiles --- 独立配置集
Profiles 让你运行多个独立的 Hermes 实例,环境完全隔离。
bash
# 创建 Profile
hermes profile create work # 创建名为 work 的 Profile
hermes profile create dev --clone # 从当前配置克隆
# 切换 Profile
hermes profile use work # 切换到 work
hermes -p work # 或用命令行参数
# 查看所有 Profile
hermes profile list
hermes profile show work # 显示详情
# 导入导出
hermes profile export work # 导出为 tar.gz
hermes profile import work.tar.gz # 从 tar.gz 导入
每个 Profile 的目录结构:
~/.hermes/profiles/<name>/
├── config.yaml
├── .env
├── skills/
├── sessions/
└── ...
配置命令速查
bash
hermes config show # 显示当前配置
hermes config edit # 在 $EDITOR 中打开 config.yaml
hermes config set model.default anthropic/claude-sonnet-4
hermes config path # 查看配置文件路径
hermes config env-path # 查看 .env 路径
hermes config check # 检查配置完整性
hermes config migrate # 更新配置(添加新选项)
hermes auth list # 查看所有认证池
hermes auth status <provider> # 查看特定提供商认证状态
推荐配置组合
入门推荐(免费优先)
yaml
model:
default: openrouter/anthropic/claude-sonnet-4
provider: openrouter
使用 hermes auth add openrouter --api-key <key> 配置。
OpenRouter 有免费额度,适合入门。
进阶推荐(国内用户)
yaml
model:
default: minimax-cn/MiniMax-Text-01
provider: minimax-cn
auxiliary:
compression:
provider: minimax-cn
vision:
provider: minimax-cn
curator:
provider: minimax-cn