在 OpenClaw 中使用 Z Image。
Z Image 是阿里巴巴的快速圖像生成模型,支援中英文雙語文字渲染。OpenClaw agent 透過與聊天相同的 RunAPI 端點和 API key 呼叫它,無需額外技能或 provider 帳戶。
Use the RunAPI text_to_image endpoint to generate an image with Z Image.
Requirements:
- Use the RUNAPI_API_KEY environment variable for authentication.
- Send a POST request to https://runapi.ai/v1/text_to_image.
- Set model to "z-image".
- Write a descriptive prompt for the image you want to generate.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the image URL from the output.
curl -X POST https://runapi.ai/v1/text_to_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-image",
"prompt": "A neon-lit Tokyo street at night with Japanese shop signs, cinematic lighting, 8K detail"
}'
{
"task_id": "tsk_abc123",
"status": "pending",
"model": "z-image"
}
三步在 OpenClaw 中使用 Z Image
設定 RunAPI
將 RunAPI API key 設定為環境變數。若已在 OpenClaw 中為聊天設定了 RunAPI,同一個 key 和端點也適用於圖像生成。
export RUNAPI_API_KEY=runapi_xxx
呼叫 Z Image
向 text_to_image 端點發送 POST 請求,將 model 設為 z-image,並附上文字提示詞。Z Image 支援中英文雙語提示詞,並能精準渲染文字。
text_to_image
取得結果
API 立即傳回 task_id。輪詢任務狀態端點,直到狀態變為 completed,然後從回應輸出中取得生成的圖像 URL。
task_id: tsk_abc123
Z Image API 參數
| 參數 | 類型 | 說明 |
|---|---|---|
model |
string |
必填。使用 z-image。 |
prompt |
string |
文字描述,支援中文和英文。 |
negative_prompt |
string |
選填。圖像中需要避免的內容。 |
size |
string |
選填。輸出尺寸,例如 1024x1024。 |
OpenClaw 上的 Z Image 是什麼?
Z Image 是速度最佳化的圖像模型,使用者稱其在消費級硬體上的次秒生成和超逼真輸出「令人驚嘆」。它採用 Apache 2.0 開源授權,能渲染中英雙語文字,並捕捉其他快速模型難以呈現的細膩面部細節。透過 RunAPI 每張約 $0.004,是目前最便宜的選項之一。OpenClaw 代理使用與聊天相同的 API key 呼叫它。
Z Image 使用情境
概念探索與快速原型製作
以每張不到一分錢的成本在幾秒內生成數十個視覺概念,非常適合在決定用更昂貴的模型做最終輸出前,先探索各種方向。
雙語行銷活動
在單張圖像中創建精確渲染中英文字的行銷視覺素材,適用於跨境電商和多語言社群媒體。
時尚與商品攝影模擬稿
生成具備精確材質紋理和光線的逼真商品攝影模擬稿,速度快到足以即時迭代構圖。
Z Image + OpenClaw 常見問題
可以。若在 OpenClaw 中設定了 RunAPI 作為 provider,同一個 API key 和端點也可以處理 Z Image 請求。向 text_to_image 端點發送 POST 請求,將 model 設為 z-image。
不需要。用於聊天和其他模型的同一個 RUNAPI_API_KEY 也適用於 Z Image。所有 RunAPI 模型共享一個 key 和一個點數餘額。
非同步。API 立即傳回 task_id。輪詢任務狀態端點或使用 webhook 回呼了解圖像是否已就緒。RunAPI SDK 會自動處理輪詢。
Z Image 按任務按用量計費。請查看 RunAPI 定價頁面取得最新價格。沒有月度訂閱或最低消費。