HERMES + GPT IMAGE

在 Hermes Agent 中使用 GPT Image。

GPT Image 2 是 OpenAI 專用的圖片生成模型 — 文生圖和基於指令的圖片編輯,支援最高 4K 輸出解析度和透明背景。Hermes Agent 透過與聊天相同的 RunAPI custom provider 和 API key 呼叫,無需 ComfyUI 或 GPU 設定。

一個 API key · 文生圖 + 圖片編輯 · 最高 4K 輸出
Use RunAPI to generate an image with OpenAI GPT Image 2 from Hermes Agent.

Requirements:
- Use the RunAPI API at https://runapi.ai/v1/text_to_image.
- Read the API key from RUNAPI_API_KEY environment variable.
- Use the custom:runapi provider already configured in Hermes Agent.
- Set the model to "gpt-image-2-text-to-image".
- Write a descriptive prompt. GPT Image 2 follows natural language instructions closely — describe layout, style, text overlays, and transparency needs.
- Optionally set output_resolution to 1k, 2k, or 4k. Default is 1k.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the output 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

設定 RunAPI

在 shell 設定檔中設定 RUNAPI_API_KEY 環境變數。如果 custom:runapi provider 已在 Hermes Agent 中設定用於聊天,同一個 key 和 base_url 也適用於 GPT Image — 無需額外設定。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 GPT Image 2

向 text_to_image 端點發送 POST 請求,model 設為 gpt-image-2-text-to-image。加入帶有版面和風格指示的描述性 prompt。將 output_resolution 設為 2k 或 4k 以獲得更高細節。若要編輯現有圖片,使用 edit_image 端點搭配 gpt-image-2-image-to-image 並提供 source_image_urls。

POST /v1/text_to_image
3

取得結果

API 會立即回傳 task_id。輪詢任務狀態端點,直到狀態變為 completed,然後從回應中取得輸出圖片 URL。GPT Image 2 通常在 10–30 秒內完成,視解析度而定。

task_id: tsk_abc123
參數

GPT Image API 參數

參數 類型 說明
model string 必填。gpt-image-2-text-to-image 用於生成,gpt-image-2-image-to-image 用於編輯。
prompt string 必填。期望圖片的自然語言描述。支援版面、文字疊加和風格的詳細指示。
output_resolution string 選填。輸出解析度 — 1k(預設)、2k 或 4k。較高解析度的每張圖片費用較高。
aspect_ratio string 選填。預設為 auto。支援 1:1、3:2、2:3、4:3、3:4、16:9、9:16 等。
source_image_urls array edit_image 端點必填。一個或多個要編輯的來源圖片 URL。

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 的下游步驟中直接複合使用。

FAQ

GPT Image + Hermes Agent 常見問題

Hermes Agent 通用設定

尚未設定?請從 Hermes Agent 的 RunAPI 設定指南開始。

Hermes Agent 設定指南 →

GPT Image 模型目錄

查看所有 GPT Image 變體、定價與 API 文件。

GPT Image 模型 →

立即在 Hermes Agent 中試用 GPT Image。

取得免費的 RunAPI key,設定 custom:runapi provider,即可開始使用 OpenAI GPT Image 2 生成和編輯圖片。