在 Hermes Agent 中使用 Z Image。
Z Image 是 Alibaba 的快速圖像生成模型,具備中英文雙語文字渲染能力。Hermes Agent 透過 RunAPI 自訂 provider 端點呼叫它——與聊天使用的 base_url 和 API key 相同,無需額外插件或 GPU 租用。
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.
- Use the custom:runapi provider configured in your Hermes Agent config.yaml.
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"
}
三步驟在 Hermes Agent 中使用 Z Image
設定 RunAPI
將 RunAPI API key 設定為環境變數。如果你已在 Hermes Agent 中將 RunAPI 設定為自訂 provider,同一個 key 和 base_url 亦適用於圖像生成。
export RUNAPI_API_KEY=runapi_xxx
呼叫 Z Image
向 text_to_image 端點發送 POST 請求,將 model 設為 z-image,並附上文字 prompt。Z Image 支援中文和英文 prompt,文字渲染準確。
text_to_image
取得結果
API 立即返回 task_id。輪詢 task status 端點直到狀態變為 completed,然後從回應輸出中取得生成的圖像 URL。
task_id: tsk_abc123
Z Image API 參數
| 參數 | 類型 | 說明 |
|---|---|---|
model |
string |
必填。使用 z-image。 |
prompt |
string |
文字描述。支援中文和英文。 |
negative_prompt |
string |
可選。在圖像中需要避免的內容。 |
size |
string |
可選。輸出尺寸,例如 1024x1024。 |
Hermes Agent 上的 Z Image 是什麼?
Z Image 亞秒級生成寫實圖像,提示詞遵循度高,面部細節精準。基於 Apache 2.0 開源權重,通過 RunAPI 每張約 $0.004,是最快也是最便宜的圖像模型。Hermes Agent 通過與聊天相同的 custom provider 呼叫它。
Z Image 使用場景
影視動畫分鏡製作
以亞秒級速度生成分鏡幀,快速迭代構圖和攝像機角度,速度足以跟上實時創意討論的節奏。
電商產品可視化
以 RunAPI 上最低的單張成本生成具有寫實材質和光線效果的產品列表圖,適合大批量目錄生成。
教育插圖
創作帶中英雙語文字標註的教育示意圖和插圖,適用於面向中英文受眾的教科書、課程材料和培訓內容。
Z Image + Hermes Agent 常見問題
可以。如果你在 Hermes Agent 中已將 RunAPI 設定為自訂 provider,同一個 API key 和 base_url 亦可處理 Z Image 請求。向 text_to_image 端點發送 POST 請求,將 model 設為 z-image 即可。
不需要。用於聊天和其他模型的同一個 RUNAPI_API_KEY 亦適用於 Z Image。所有 RunAPI 模型共用一個 key 和一個點數餘額。
Z Image 是非同步的。API 立即返回 task_id。輪詢 task status 端點或使用 webhook callback 以知悉圖像何時就緒。RunAPI SDK 會自動處理輪詢。
Z Image 按用量付費,按任務計費。請查看 RunAPI 收費頁面了解最新價格。無月費訂閱或最低消費。