OPENCLAW + QWEN 2 IMAGE

在 OpenClaw 中使用 Qwen 2 Image。

Qwen 2 Image 是 Alibaba 的圖像生成和編輯模型。OpenClaw agent 透過與聊天相同的 RunAPI 端點呼叫它——發送 prompt,取回圖像 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.
- 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
操作步驟

三步驟在 OpenClaw 中使用 Qwen 2 Image

1

設定 RunAPI

將 RunAPI API key 設定為環境變數。如果你尚未將 RunAPI 新增為 OpenClaw provider,請先參照 OpenClaw 設定指南。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Qwen 2 Image

將 prompt 貼入 OpenClaw 或直接呼叫 text_to_image 端點。將 model 欄位設為 qwen-2-text-to-image(生成)、qwen-2-edit-image(編輯)或 qwen-2-remix-image(混合)。

text_to_image
3

取得結果

端點返回 task ID。輪詢 task status 端點直到狀態變為 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 可選。輸出尺寸。

OpenClaw 上的 Qwen 2 Image 是什麼?

Qwen 2 Image 是阿里巴巴的圖像模型,通過單一 API 涵蓋生成、編輯和混合創作三種模式。它在多語言提示詞理解方面表現出色(尤其是中英文),能處理複雜的多對象場景,並支持用自然語言描述修改內容的指令式編輯。

Qwen 2 Image 使用場景

多語言營銷活動

根據中文、英文或混合語言提示詞生成圖像,製作雙語營銷材料,無需事先翻譯提示詞。

指令式圖像編輯

用日常語言描述修改內容來修改現有圖像——替換背景、添加對象、調整光線或刪除元素,無需打開編輯器。

針對特定領域微調開源模型

將 Qwen 2 Image 的輸出用作微調開源 Qwen 模型的訓練數據或基線,用於產品目錄或品牌內容等特定領域圖像任務。

FAQ

Qwen 2 Image + OpenClaw 常見問題

OpenClaw 一般設定

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

OpenClaw 設定指南 →

Qwen 2 Image 模型目錄

查看所有 Qwen 2 Image 版本、收費及 API 文件。

Qwen 2 Image 模型 →

立即在 OpenClaw 中試用 Qwen 2 Image。

取得免費 RunAPI key,將 prompt 貼入 OpenClaw,開始生成。