---
title: &quot;通过 RunAPI 在爱马仕 (Hermes Agent) 中使用 GPT — 大模型API 指南&quot;
url: &quot;https://runapi.ai/zh-CN/hermes-gpt.md&quot;
canonical: &quot;https://runapi.ai/zh-CN/hermes-gpt&quot;
locale: &quot;zh-CN&quot;
model: &quot;gpt&quot;
---

# 在 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 example

```bash
curl -X POST https://runapi.ai/v1/chat/completions \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;gpt-5.5&quot;,
    &quot;messages&quot;: [
      {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a concise coding assistant.&quot;},
      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Write a Python function that merges two sorted lists in O(n) time.&quot;}
    ],
    &quot;temperature&quot;: 0.3,
    &quot;max_tokens&quot;: 1024
  }&#39;

```

### Response

```json
{
  &quot;id&quot;: &quot;chatcmpl-abc123&quot;,
  &quot;object&quot;: &quot;chat.completion&quot;,
  &quot;model&quot;: &quot;gpt-5.5&quot;,
  &quot;choices&quot;: [
    {
      &quot;index&quot;: 0,
      &quot;message&quot;: {
        &quot;role&quot;: &quot;assistant&quot;,
        &quot;content&quot;: &quot;def merge_sorted(a, b):\n    result = []\n    i = j = 0\n    while i &lt; len(a) and j &lt; len(b):\n        if a[i] &lt;= 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&quot;
      },
      &quot;finish_reason&quot;: &quot;stop&quot;
    }
  ],
  &quot;usage&quot;: {
    &quot;prompt_tokens&quot;: 38,
    &quot;completion_tokens&quot;: 95,
    &quot;total_tokens&quot;: 133
  }
}

```

## How it works

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.
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.
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.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `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 &quot;json_object&quot; or &quot;json_schema&quot; for structured JSON output. |
| `reasoning_effort` | `string` | Optional. Controls thinking depth for supported models. Accepted values are low, medium, high. |

## FAQ

### Can I use GPT-5.5 in Hermes Agent through RunAPI?

Yes. Hermes Agent supports custom OpenAI-compatible providers. Add RunAPI as custom:runapi with base_url https://runapi.ai/v1, key_env set to RUNAPI_API_KEY, and api_mode set to chat_completions. Set the default model to gpt-5.5.

### How does RunAPI GPT pricing compare to official OpenAI pricing?

RunAPI charges 50% of the official OpenAI per-token rate for all GPT models. The discount applies to both input and output tokens. Check the RunAPI pricing page for exact per-million-token rates.

### Which GPT model should I use -- 5.5 vs 5.4 vs mini vs codex?

GPT-5.5 for complex reasoning and hard problems. GPT-5.4 for everyday tasks at lower cost. GPT-5.4-mini for high-volume cheap work like classification. GPT-5.3-codex for code generation and editing. Switch between them by changing only the model field -- no provider reconfiguration needed.

### Does the Responses API work through RunAPI in Hermes Agent?

Yes. RunAPI also proxies the OpenAI Responses API at /v1/responses. If Hermes Agent supports the Responses API surface, set the endpoint to https://runapi.ai/v1/responses. The same API key and custom provider work for both endpoints.

### How do I use structured outputs to guarantee valid JSON from GPT?

Set response_format to json_schema with a schema definition in your request. GPT will constrain its output to match your schema exactly. RunAPI forwards the schema parameter unchanged. This works for data extraction, form parsing, and any task where you need predictable JSON structure.

### Can Hermes Agent switch between GPT models dynamically per request?

Yes. Set the model parameter per request. Hermes Agent can route simple tasks to GPT-5.4-mini for cost efficiency and complex reasoning to GPT-5.5 for quality, all through the same RunAPI provider.


## Links

- [Hermes Agent 配置指南 →](https://runapi.ai/zh-CN/hermes-agent)
- [GPT on RunAPI →](https://runapi.ai/zh-CN/models/gpt)
- [Model catalog](https://runapi.ai/zh-CN/models)
- [API docs](https://runapi.ai/zh-CN/docs)
