HERMES + IMAGEN 4

在 Hermes Agent 中使用 Imagen 4。

Imagen 4 是 Google DeepMind 的圖像生成模型,具備準確的文字渲染和高 prompt 保真度。Hermes Agent 透過與聊天相同的 RunAPI 自訂 provider 端點呼叫它——無需 ComfyUI 或 GPU 設定。

一個 API key · 文字轉圖片端點 · 非同步任務輪詢
Use RunAPI to generate an image with Google Imagen 4 from Hermes Agent.

Requirements:
- Read the API key from RUNAPI_API_KEY. Do not hardcode the key.
- Use the custom:runapi provider already configured in Hermes Agent.
- Send a POST request to https://runapi.ai/v1/text_to_image.
- Set the model to imagen-4.
- Write a descriptive prompt for the image you want.
- The response returns a task_id. Poll the task status endpoint until the task completes.
- When the task is complete, retrieve the image URL from the response.
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "imagen-4",
    "prompt": "A ceramic coffee mug on a wooden table with morning light, the text HELLO printed on the side in serif font, photorealistic"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "imagen-4"
}
複製 curl 指令測試 imagen-4
操作步驟

三步驟在 Hermes Agent 中使用 Imagen 4

1

設定 RunAPI

設定 RUNAPI_API_KEY 環境變數。如果你已在 Hermes Agent 中將 RunAPI 設定為 custom:runapi provider 用於聊天,同一個 key 和 base_url 亦適用於圖像生成。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Imagen 4

向 text_to_image 端點發送 POST 請求,將 model 設為 imagen-4,並附上描述性 prompt。如有需要,可加入 aspect_ratio 或 negative_prompt。

POST /v1/text_to_image
3

取得結果

回應包含 task_id。輪詢 task status 端點直到狀態變為 completed。完成的回應包含生成的圖像 URL。

task_id: tsk_abc123
參數

Imagen 4 API 參數

參數 類型 說明
model string 必填。imagen-4、imagen-4-fast 或 imagen-4-ultra。
prompt string 描述所需圖像的文字。
aspect_ratio string 可選。例如 1:1、16:9、9:16。
negative_prompt string 可選。在生成圖像中需要避免的內容。

Hermes Agent 上的 Imagen 4 是什麼?

Google DeepMind 的 Imagen 4 在橫向比較中排名靠前,文字渲染更清晰,提示詞遵循度優於多數競品。其三檔系統(Fast、Standard、Ultra)讓你可以按圖像選擇成本與質量的權衡。Hermes Agent 通過 RunAPI custom provider 呼叫它——無需 Vertex AI 項目或 GCP 賬户。

Imagen 4 使用場景

團隊友好的圖像生成

非技術團隊成員可通過 Imagen 4 出色的提示詞遵從性調整提示詞並生成可用圖像,無需提示詞工程專業知識。

冒險與編輯風攝影

生成編輯質量的攝影作品——風景、美食、建築、生活方式——光線、景深和自然色調調色精準。

成本優化的批量生成

在單一工作流中混合使用不同檔位——起草階段用 Fast(每張 $0.02),最終精選用 Ultra——在不犧牲最終輸出質量的前提下控制批量成本。

FAQ

Imagen 4 + Hermes Agent 常見問題

Hermes Agent 一般設定

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

Hermes Agent 設定指南 →

Imagen 4 模型目錄

查看所有 Imagen 4 版本、收費及 API 文件。

Imagen 4 模型 →

立即在 Hermes Agent 中試用 Imagen 4。

取得免費 RunAPI key,設定 custom:runapi provider,開始使用 Google Imagen 4 生成圖像。