---
title: &quot;在 Hermes Agent 中透過 RunAPI 使用 Z Image — 圖像 API 指南&quot;
url: &quot;https://runapi.ai/zh-TW/hermes-z-image.md&quot;
canonical: &quot;https://runapi.ai/zh-TW/hermes-z-image&quot;
locale: &quot;zh-TW&quot;
model: &quot;z-image&quot;
---

# 在 Hermes Agent 中使用 Z Image。

Z Image 是阿里巴巴的快速圖像生成模型，支援中英文雙語文字渲染。Hermes Agent 透過 RunAPI custom provider 端點呼叫它——與聊天使用相同的 base_url 和 API key，無需額外外掛或 GPU 租用。

## API example

```bash
curl -X POST https://runapi.ai/v1/text_to_image \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;z-image&quot;,
    &quot;prompt&quot;: &quot;A neon-lit Tokyo street at night with Japanese shop signs, cinematic lighting, 8K detail&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;z-image&quot;
}

```

## How it works

1. **設定 RunAPI** — 將 RunAPI API key 設定為環境變數。若已在 Hermes Agent 中將 RunAPI 設定為 custom provider，同一個 key 和 base_url 也適用於圖像生成。
2. **呼叫 Z Image** — 向 text_to_image 端點發送 POST 請求，將 model 設為 z-image，並附上文字提示詞。Z Image 支援中英文雙語提示詞，並能精準渲染文字。
3. **取得結果** — API 立即傳回 task_id。輪詢任務狀態端點，直到狀態變為 completed，然後從回應輸出中取得生成的圖像 URL。

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | 必填。使用 z-image。 |
| `prompt` | `string` | 文字描述，支援中文和英文。 |
| `negative_prompt` | `string` | 選填。圖像中需要避免的內容。 |
| `size` | `string` | 選填。輸出尺寸，例如 1024x1024。 |

## FAQ

### 可以在 Hermes Agent 中使用 Z Image 嗎？

可以。若在 Hermes Agent 中設定了 RunAPI 作為 custom provider，同一個 API key 和 base_url 也可以處理 Z Image 請求。向 text_to_image 端點發送 POST 請求，將 model 設為 z-image。

### Z Image 需要單獨的 API key 嗎？

不需要。用於聊天和其他模型的同一個 RUNAPI_API_KEY 也適用於 Z Image。所有 RunAPI 模型共享一個 key 和一個點數餘額。

### Z Image 是非同步還是同步的？

非同步。API 立即傳回 task_id。輪詢任務狀態端點或使用 webhook 回呼了解圖像是否已就緒。RunAPI SDK 會自動處理輪詢。

### Z Image 的價格是多少？

Z Image 按任務按用量計費。請查看 RunAPI 定價頁面取得最新價格。沒有月度訂閱或最低消費。


## Links

- [Hermes Agent 設定指南 →](https://runapi.ai/zh-TW/hermes-agent)
- [Z Image 模型 →](https://runapi.ai/zh-TW/models/z-image)
- [Model catalog](https://runapi.ai/zh-TW/models)
- [API docs](https://runapi.ai/zh-TW/docs)
