Hermes 教程 02:配置详解

难度:⭐⭐ 基础 | 预计时间: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

相关推荐
向宇it21 小时前
【AI视频】生成AI短剧、漫剧
人工智能·ai·音视频·动画·ai视频·短剧
金融RPA机器人丨实在智能21 小时前
选择Agent平台如何避免“厂商锁定”?深度解析企业级AI智能体架构解耦与落地实践
人工智能·ai·架构
dinl_vin21 小时前
Python 并发编程实战:多线程、协程与多进程全解析
开发语言·人工智能·python
码农小白AI21 小时前
代餐食品营养管控升级,报告数据差错或阻断上市 ——IACheck 助力 AI 报告审核精准锁定成分核算问题
人工智能
searchforAI21 小时前
CC-Switch教程:统一管理Skills、MCP、模型供应商、系统提示词等多项配置
人工智能·gpt·ai·大模型·agent·claudecode
tedcloud12321 小时前
codegraph部署教程:构建代码库语义分析环境
服务器·人工智能·word·excel
城事漫游Molly21 小时前
AI赋能质性研究(四):AI辅助写分析备忘录
人工智能·prompt·ai for science·定性研究
北京软秦科技有限公司21 小时前
AI报告审核加持,IACheck助力企业数智化转型与检测报告质量再造
人工智能
道可云21 小时前
智造有道:深度解读《山东省“人工智能+制造”行动方案(2026—2028年)》
人工智能·制造
长空任鸟飞_阿康21 小时前
驾驭 AI 这匹野马:深入解析智能体 Harness 工程
人工智能·python·ai