词元之母TOK.MOM - 平台充值汇率 1:1 即 1 人民币充值到账 1 美元,支持一个 Key 调用近 600+ 海内外模型,限时特价模型低至 1 折,欢迎上岸!
hermes setup --portal,Open WebUI 或 LobeChat 等前端即可获得一个完整配备工具的后端。~/.hermes/.env 中添加:[API Server] API server listening on http://127.0.0.1:8642http://localhost:8642/v1:messages 数组传入。{
"model": "hermes-agent",
"messages": [
{"role": "system", "content": "You are a Python expert."},
{"role": "user", "content": "Write a fibonacci function"}
],
"stream": false
}{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1710000000,
"model": "hermes-agent",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Here's a fibonacci function..."},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 50, "completion_tokens": 200, "total_tokens": 250}
}content 作为 text 和 image_url 部分的数组发送。支持远程 http(s) URL 和 data:image/... URL:{
"model": "hermes-agent",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/cat.png", "detail": "high"}}
]
}
]
}file / input_file / file_id)和非图像 data: URL 将返回 400 unsupported_content_type。"stream": true):返回逐 token 响应块的 Server-Sent Events(SSE)。对于 Chat Completions,流使用标准 chat.completion.chunk 事件,以及 Hermes 自定义的 hermes.tool.progress 事件用于工具启动的 UX 展示。对于 Responses,流使用 OpenAI Responses 事件类型,如 response.created、response.output_text.delta、response.output_item.added、response.output_item.done 和 response.completed。event: hermes.tool.progress 以提供工具启动可见性,同时不污染持久化的 assistant 文本。function_call 和 function_call_output 输出项,让客户端能够实时渲染结构化工具 UI。previous_response_id 支持服务端对话状态——服务器存储完整的对话历史(包括工具调用和结果),因此多轮上下文无需客户端自行管理。{
"model": "hermes-agent",
"input": "What files are in my project?",
"instructions": "You are a helpful coding assistant.",
"store": true
}{
"id": "resp_abc123",
"object": "response",
"status": "completed",
"model": "hermes-agent",
"output": [
{"type": "function_call", "name": "terminal", "arguments": "{\"command\": \"ls\"}", "call_id": "call_1"},
{"type": "function_call_output", "call_id": "call_1", "output": "README.md src/ tests/"},
{"type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "Your project has..."}]}
],
"usage": {"input_tokens": 50, "output_tokens": 200, "total_tokens": 250}
}input[].content 可以包含 input_text 和 input_image 部分。支持远程 URL 和 data:image/... URL:{
"model": "hermes-agent",
"input": [
{
"role": "user",
"content": [
{"type": "input_text", "text": "Describe this screenshot."},
{"type": "input_image", "image_url": "data:image/png;base64,iVBORw0K..."}
]
}
]
}input_file / file_id)和非图像 data: URL 将返回 400 unsupported_content_type。{
"input": "Now show me the README",
"previous_response_id": "resp_abc123"
}conversation 参数代替追踪响应 ID:{"input": "Hello", "conversation": "my-project"}
{"input": "What's in src/?", "conversation": "my-project"}
{"input": "Run the tests", "conversation": "my-project"}/title 命令。hermes-agent)。大多数前端进行模型发现时需要此端点。{
"object": "hermes.api_server.capabilities",
"platform": "hermes-agent",
"model": "hermes-agent",
"auth": {"type": "bearer", "required": true},
"features": {
"chat_completions": true,
"responses_api": true,
"run_submission": true,
"run_status": true,
"run_events_sse": true,
"run_stop": true
}
}{"status": "ok"}。也可通过 GET /v1/health 访问,供期望 /v1/ 前缀的 OpenAI 兼容客户端使用。/v1/chat/completions 和 /v1/responses 外,服务器还暴露了一个 runs API,适用于客户端希望订阅进度事件而非自行管理流式传输的长时 session。run_id。{
"run_id": "run_abc123",
"status": "started"
}input 字符串,以及可选的 session_id、instructions、conversation_history 或 previous_response_id。当提供 session_id 时,Hermes 会在 run 状态中暴露它,以便外部 UI 将 run 与自己的对话 ID 关联。{
"object": "hermes.run",
"run_id": "run_abc123",
"status": "completed",
"session_id": "space-session",
"model": "hermes-agent",
"output": "Done.",
"usage": {"input_tokens": 50, "output_tokens": 200, "total_tokens": 250}
}completed、failed 或 cancelled)之后会短暂保留,以供轮询和 UI 对账使用。{"status": "stopping"},同时 Hermes 要求活跃 agent 在下一个安全中断点停止。hermes cron 相同的结构——prompt(提示词)、schedule(计划)、skills(技能)、provider 覆盖、投递目标。system 消息(Chat Completions)或 instructions 字段(Responses API)时,hermes-agent 会将其叠加在核心系统 prompt 之上。你的 agent 保留所有工具、记忆和技能——前端的系统 prompt 只是添加额外指令。Authorization 请求头进行 Bearer token 认证:Authorization: Bearer ***API_SERVER_KEY 环境变量配置密钥。如果需要浏览器直接调用 Hermes,还需将 API_SERVER_CORS_ORIGINS 设置为明确的允许列表。0.0.0.0)时,必须设置 API_SERVER_KEY。同时保持 API_SERVER_CORS_ORIGINS 范围尽量小,以控制浏览器访问。127.0.0.1)仅供本地使用。浏览器访问默认禁用;仅为明确的可信来源启用。| 变量 | 默认值 | 描述 |
|---|---|---|
API_SERVER_ENABLED | false | 启用 API 服务器 |
API_SERVER_PORT | 8642 | HTTP 服务器端口 |
API_SERVER_HOST | 127.0.0.1 | 绑定地址(默认仅限本地) |
API_SERVER_KEY | (无) | 认证用 Bearer token |
API_SERVER_CORS_ORIGINS | (无) | 逗号分隔的允许浏览器来源 |
API_SERVER_MODEL_NAME | (profile 名称) | /v1/models 上的模型名称。默认为 profile 名称,默认 profile 则为 hermes-agent。 |
X-Content-Type-Options: nosniff — 防止 MIME 类型嗅探Referrer-Policy: no-referrer — 防止 referrer 泄露Access-Control-Max-Age: 600(10 分钟缓存)Idempotency-Key 是允许的请求头——客户端可发送它用于去重(响应按 key 缓存 5 分钟)| 前端 | Stars | 连接方式 |
|---|---|---|
| Open WebUI | 126k | 提供完整指南 |
| LobeChat | 73k | 自定义 provider 端点 |
| LibreChat | 34k | librechat.yaml 中的自定义端点 |
| AnythingLLM | 56k | 通用 OpenAI provider |
| NextChat | 87k | BASE_URL 环境变量 |
| ChatBox | 39k | API Host 设置 |
| Jan | 26k | 远程模型配置 |
| HF Chat-UI | 8k | OPENAI_BASE_URL |
| big-AGI | 7k | 自定义端点 |
| OpenAI Python SDK | — | OpenAI(base_url="http://localhost:8642/v1") |
| curl | — | 直接 HTTP 请求 |
http://localhost:8643/v1/models → 模型 alicehttp://localhost:8644/v1/models → 模型 bobalice 和 bob 作为不同模型,每个均由完全隔离的 Hermes 实例支持。详见 Open WebUI 指南。previous_response_id)持久化在 SQLite 中,gateway 重启后仍然存在。最多存储 100 个响应(LRU 淘汰)。/v1/chat/completions 和 /v1/responses)均支持内联图像,但不支持通过 API 上传文件(file、input_file、file_id)和非图像文档输入。model 字段会被接受,但实际使用的 LLM 模型在服务端的 config.yaml 中配置。GATEWAY_PROXY_URL 时,它会将所有消息转发到这里,而不是运行自己的 agent。这支持分离部署——例如,一个处理 Matrix E2EE 的 Docker 容器将请求中继到宿主机侧的 agent。