Files
odyssey/wiki/entities/Hermes API Server.md

68 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
tags: [实体]
created: 2026-09-14
updated: 2026-09-14
sources: [raw/notes/2026-09-14-n8n调用hermes-agents工作流架构.md]
---
# Hermes API Server
> [[Hermes Agent]] 的内置组件,把 Agent 暴露成 OpenAI 兼容的 HTTP 端点,默认端口 8642。
## 简介
Hermes API Server 是 [[Hermes Agent]] 自带的 HTTP 服务层,遵循 OpenAI 的 `chat/completions` 协议。任何能调用 OpenAI 接口的客户端——[[n8n]]、脚本、其他 Agent——都能不加改造地调用它。这是 Hermes 接入外部编排系统的关键,也是「不需要中间件」这个结论的来源。
## 关键信息
- **类型**:概念 / 组件
- **领域**:AI Agent 服务化
- **相关概念**:[[Hermes Agent]]、[[Hermes Profile]]、[[n8n]]
- **默认端口**:`8642`
- **协议**:OpenAI 兼容(`/v1/chat/completions`、`/v1/health`)
## 详细内容
### 开启与配置
```bash
hermes config set API_SERVER_ENABLED true
hermes config set API_SERVER_KEY <your-secret-key>
hermes gateway restart
```
`API_SERVER_KEY` 是必填项,客户端通过 `Authorization: Bearer <key>` 携带。若要跨机器访问,还需把 `API_SERVER_HOST` 设为 `0.0.0.0`(默认只监听本机)。
### 调用格式
```json
{
"model": "hermes-agent",
"messages": [{ "role": "user", "content": "Hello!" }]
}
```
`model` 字段填实例 / profile 名,返回体是标准 OpenAI 响应结构,带 `usage` 的 token 统计。
### 多轮会话连续性
v0.7.0 起支持 `X-Hermes-Session-Id` 请求头:
```
X-Hermes-Session-Id: my-workflow-session-001
```
同一个 id 的多次请求共享同一个 session,因此 chat-completions 客户端也能跨请求保留上下文。这让 [[n8n]] 里用多个 HTTP Request 节点串起来的流程可以具备记忆,适合多步推理任务链。
<!-- confidence: EXTRACTED -->
## 不同素材中的观点
- [[wiki/sources/2026-09-14-n8n调用hermes-agents工作流架构]]:API Server 是「完全原生支持」的核心,架构中位于 n8n 与各 Agent 实例之间。
## 相关页面
- [[Hermes Agent]]
- [[Hermes Profile]]
- [[n8n]]
- [[多 Agent 工作流编排]]