HERMES + GPT IMAGE

在 Hermes Agent 中使用 GPT Image。

GPT Image 2 是 OpenAI 专用的图像生成模型——支持文生图和基于指令的图像编辑,输出分辨率最高可达 4K,并支持透明背景。Hermes Agent 通过与聊天相同的 RunAPI custom 提供商和 API 密钥调用它,无需 ComfyUI 或 GPU 设置。

一个 API 密钥 · 文生图 + 图像编辑 · 最高 4K 输出
使用 RunAPI 通过 Hermes Agent 用 OpenAI GPT Image 2 生成图像。

要求:
- 使用位于 https://runapi.ai/v1/text_to_image 的 RunAPI API。
- 从 RUNAPI_API_KEY 环境变量读取 API 密钥。
- 使用 Hermes Agent 中已配置的 custom:runapi 提供商。
- 将 model 设置为 "gpt-image-2-text-to-image"。
- 编写一个描述性的 prompt。GPT Image 2 会紧密遵循自然语言指令——描述布局、风格、文字叠加和透明度需求。
- 可选地将 output_resolution 设为 1k、2k 或 4k。默认为 1k。
- 响应会返回一个 task_id。轮询任务状态端点直到任务完成,然后获取输出 URL。
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-text-to-image",
    "prompt": "A product photo of a glass perfume bottle on a marble surface, transparent background, studio lighting, the label reads AURORA in gold serif font",
    "output_resolution": "2k",
    "aspect_ratio": "3:4"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "gpt-image-2-text-to-image"
}
复制 curl 命令进行测试 gpt-image
工作原理

三步在 Hermes Agent 中使用 GPT Image

1

Configure RunAPI

Set the RUNAPI_API_KEY environment variable in your shell profile. If the custom:runapi provider is already configured in Hermes Agent for chat, the same key and base_url work for GPT Image — no additional setup needed.

export RUNAPI_API_KEY=runapi_xxx
2

Call GPT Image 2

Send a POST request to the text_to_image endpoint with model set to gpt-image-2-text-to-image. Include a descriptive prompt with layout and style instructions. Set output_resolution to 2k or 4k for higher detail. For editing existing images, use the edit_image endpoint with gpt-image-2-image-to-image and provide source_image_urls.

POST /v1/text_to_image
3

Get the result

The API returns a task_id immediately. Poll the task status endpoint until the status changes to completed, then retrieve the output image URL from the response. GPT Image 2 typically completes within 10–30 seconds depending on resolution.

task_id: tsk_abc123
参数

GPT Image API 参数

参数 类型 说明
model string Required. gpt-image-2-text-to-image for generation, gpt-image-2-image-to-image for editing.
prompt string Required. Natural language description of the desired image. Supports detailed instructions for layout, text overlays, and style.
output_resolution string Optional. Output resolution — 1k (default), 2k, or 4k. Higher resolution costs more per image.
aspect_ratio string Optional. Defaults to auto. Supports 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, and more.
source_image_urls array Required for edit_image endpoint. One or more URLs of source images to edit.

Hermes Agent 上的 GPT Image 是什么?

GPT Image 2 将提示词视为制作简报而非关键词列表。它在生成前包含一个推理步骤,有助于遵循排版、文字位置和构图的结构化指令。Hermes Agent 通过 RunAPI custom provider 调用它。

GPT Image 使用场景

结构化提示词的批量图像生成

通过 Hermes Agent 批量处理结构化设计简报,为产品目录、营销活动或内容系列生成图像,GPT Image 2 对每个简报都严格遵循排版和风格规范。

多模态内容流水线

将 GPT Image 2 与 GPT 文本模型串联——先用 GPT 生成详细的设计简报,再用 GPT Image 2 执行生成,确保视觉输出与内容策略紧密对齐。

透明资产的品牌套件生成

生成带透明背景的品牌资产——图标、徽章、UI 元素——可在设计工作流或 Hermes Agent 的下游步骤中直接复合使用。

常见问题

GPT Image + Hermes Agent 常见问题

Hermes Agent 通用配置

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

Hermes Agent 配置指南 →

GPT Image 模型目录

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

GPT Image 模型 →

立即在 Hermes Agent 中试用 GPT Image。

免费获取 RunAPI 密钥,配置 custom:runapi 提供商,开始使用 OpenAI GPT Image 2 生成和编辑图像。