---
title: &quot;在爱马仕 (Hermes Agent) 中通过 RunAPI 使用 Z Image — 图像 API 指南&quot;
url: &quot;https://runapi.ai/zh-CN/hermes-z-image.md&quot;
canonical: &quot;https://runapi.ai/zh-CN/hermes-z-image&quot;
locale: &quot;zh-CN&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，并附上文字 prompt。Z Image 支持中英文双语 prompt，并能精准渲染文字。
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-CN/hermes-agent)
- [Z Image 模型 →](https://runapi.ai/zh-CN/models/z-image)
- [Model catalog](https://runapi.ai/zh-CN/models)
- [API docs](https://runapi.ai/zh-CN/docs)
