HERMES + QWEN 2 IMAGE

在 Hermes Agent 中使用 Qwen 2 Image。

Qwen 2 Image 是阿里巴巴的圖像生成和編輯模型。Hermes Agent 透過 RunAPI custom provider 端點呼叫它——發送提示詞,取得圖像 URL。透過三種模型變體支援文生圖、圖像編輯和圖像重混。

一個 API key · 文生圖端點 · 非同步任務輪詢
Use RunAPI to generate an image with Qwen 2 Image.

Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/api/v1/task/text_to_image.
- Set the model to "qwen-2-text-to-image".
- Read the API key from the RUNAPI_API_KEY environment variable.
- Use the custom:runapi provider configured in Hermes Agent.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the image URL from the output.
- For image editing, use model "qwen-2-edit-image" and include an image_url field.
- For remixing, use model "qwen-2-remix-image" and include an image_url field.
curl -X POST https://runapi.ai/api/v1/task/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-2-text-to-image",
    "prompt": "A traditional Chinese ink painting of misty mountains at dawn, elegant brushwork"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "qwen-2-text-to-image"
}
複製 curl 指令進行測試 qwen-2
運作原理

三步在 Hermes Agent 中使用 Qwen 2 Image

1

設定 RunAPI

設定 RunAPI API key 為環境變數。若尚未在 Hermes Agent 中新增 RunAPI 作為 custom provider,請參考 Hermes Agent 設定指南,使用 base_url https://runapi.ai/v1 新增 custom:runapi。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Qwen 2 Image

將提示詞貼到 Hermes Agent,或直接呼叫 text_to_image 端點。將 model 欄位設為 qwen-2-text-to-image(生成)、qwen-2-edit-image(編輯)或 qwen-2-remix-image(重混)。

text_to_image
3

取得結果

端點傳回任務 ID。輪詢任務狀態端點,直到狀態變為 completed,然後從輸出中讀取圖像 URL。RunAPI SDK 會自動處理輪詢。

task_id: tsk_abc123
參數

Qwen 2 Image API 參數

參數 類型 說明
model string 必填。qwen-2-text-to-image、qwen-2-edit-image 或 qwen-2-remix-image。
prompt string 文字描述或編輯指令。
image_url string 編輯或重混模式的來源圖像。
size string 選填。輸出尺寸。

Hermes Agent 上的 Qwen 2 Image 是什麼?

Qwen 2 Image 是阿里巴巴的圖像模型,透過單一 API 提供三種模式——生成、編輯和混音。Hermes Agent 透過 custom:runapi provider 呼叫它。它能處理複雜的多物件場景,原生理解中文、英文和混合語言文字的提示詞,特別適合多語言內容流程。

Qwen 2 Image 使用情境

代理工作流程中的迭代圖像編輯

在單次 Hermes Agent 執行中串接多個 Qwen 2 編輯步驟——生成初始圖像,再依序套用一系列文字引導的更改,如替換背景、調整顏色或添加元素。

新創公司的低成本圖像生成

將 Qwen 2 Image 作為高量圖像生成任務(如商品模擬稿、社群媒體內容或開發期間的佔位圖片)的高性價比替代方案。

雙語內容製作

無需翻譯即可從中英文提示詞生成圖像,在單一工作流程中為雙語行銷活動或本地化商品頁面製作視覺素材。

FAQ

Qwen 2 Image + Hermes Agent 常見問題

Hermes Agent 通用設定

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

Hermes Agent 設定指南 →

Qwen 2 Image 模型目錄

查看所有 Qwen 2 Image 變體、價格和 API 文件。

Qwen 2 Image 模型 →

立即在 Hermes Agent 中試用 Qwen 2 Image。

取得免費 RunAPI key,將提示詞貼到 Hermes Agent,開始生成。