HERMES + GPT

在 Hermes Agent 中使用 GPT。

GPT-5.5 是 OpenAI 的旗舰大模型,通过 RunAPI 可以官方每 token 价格的一半使用。Hermes Agent 通过 custom:runapi 提供商以 chat_completions 模式连接——一个配置块即可解锁每个 GPT 版本(5.5、5.4、5.4-mini、5.3-codex),并支持流式传输、函数调用和结构化输出。

一个 API 密钥 · OpenAI 兼容 · 流式响应
使用 RunAPI 通过 OpenAI 兼容的 Chat Completions 端点调用 GPT-5.5。

要求:
- 从 RUNAPI_API_KEY 读取 API 密钥。
- 使用 custom:runapi 提供商,base_url 为 https://runapi.ai/v1。
- 调用 POST https://runapi.ai/v1/chat/completions
- 将 model 设置为 "gpt-5.5"。
- 包含一个至少有一条 user 消息的 messages 数组。
- 响应是同步的——补全结果在同一个 HTTP 响应中返回。
- 如需流式传输,设置 "stream": true 以接收 server-sent events。
- 如需使用 Responses API,改为调用 POST https://runapi.ai/v1/responses。
curl -X POST https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {"role": "system", "content": "You are a concise coding assistant."},
      {"role": "user", "content": "Write a Python function that merges two sorted lists in O(n) time."}
    ],
    "temperature": 0.3,
    "max_tokens": 1024
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "gpt-5.5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "def merge_sorted(a, b):\n    result = []\n    i = j = 0\n    while i < len(a) and j < len(b):\n        if a[i] <= b[j]:\n            result.append(a[i]); i += 1\n        else:\n            result.append(b[j]); j += 1\n    result.extend(a[i:])\n    result.extend(b[j:])\n    return result"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 38,
    "completion_tokens": 95,
    "total_tokens": 133
  }
}
复制 curl 命令进行测试 gpt
工作原理

三步在 Hermes Agent 中使用 GPT

1

Add RunAPI as a custom provider

If the custom:runapi provider is already configured in Hermes Agent, the same key works for GPT. Otherwise, add a custom provider with base_url https://runapi.ai/v1, key_env set to RUNAPI_API_KEY, and api_mode set to chat_completions.

export RUNAPI_API_KEY=runapi_xxx
2

Select a GPT model

Set the default model to gpt-5.5 for the flagship, gpt-5.4 or gpt-5.4-mini for lower cost, or gpt-5.3-codex for code-heavy tasks. The /v1/chat/completions endpoint returns a standard OpenAI response with usage counts and finish_reason.

default: gpt-5.5
3

Use streaming or function calling

Hermes Agent forwards stream, tools, and response_format parameters through the custom:runapi provider. All standard OpenAI Chat Completions parameters work through RunAPI without modification.

"stream": true
参数

GPT Chat Completions 参数

参数 类型 说明
model string Required. gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.3-codex, or gpt-5.2.
messages array Required. Array of message objects with role (system, user, assistant) and content fields.
temperature number Optional. Sampling temperature between 0 and 2. Lower values produce more deterministic output. Defaults to 1.
max_tokens integer Optional. Maximum number of tokens to generate in the completion.
stream boolean Optional. When true, returns server-sent events with incremental token deltas. Defaults to false.
tools array Optional. Array of tool definitions for function calling. Each tool has a type, function name, description, and parameters schema.
response_format object Optional. Set type to "json_object" or "json_schema" for structured JSON output.
reasoning_effort string Optional. Controls thinking depth for supported models. Accepted values are low, medium, high.

Hermes Agent 上的 GPT 是什么?

GPT 是 OpenAI 的 LLM 系列,通过 RunAPI 的 custom:runapi provider 以官方单 token 价格的一半提供。Hermes Agent 使用标准 chat_completions API 模式连接,因此 GPT-5.5、5.4、5.4-mini 和 5.3-codex 均支持流式输出、函数调用、结构化 JSON 输出和视觉输入——全部通过与 Claude 或 Gemini 相同的 provider 配置。

GPT 使用场景

使用 Codex 模型进行 agent 编程

通过 Hermes Agent 使用 GPT-5.3-codex 完成代码生成、重构和自动化 PR 工作流,成本低于旗舰模型。

结构化输出批量处理

通过 GPT 的 json_schema 响应格式处理大量文档,为 RAG 流水线、发票解析或内容分类在规模上提取结构化数据。

按任务复杂度动态路由

将简单查询路由到 GPT-5.4-mini 以节省成本,将复杂推理任务路由到 GPT-5.5 以保证质量——全部通过同一个 custom:runapi provider 和 API key。

常见问题

GPT + Hermes Agent 常见问题

Hermes Agent 通用配置

尚未配置?请从 Hermes Agent 的 RunAPI 配置指南开始。

Hermes Agent 配置指南 →

GPT 模型目录

查看所有 GPT 版本、每 token 定价和 API 文档。

GPT on RunAPI →

立即在 Hermes Agent 中试用 GPT-5.5。

免费获取 RunAPI 密钥,配置 custom:runapi 提供商,以官方 OpenAI token 价格的一半调用 GPT-5.5——含流式传输、函数调用和结构化输出。