---
title: &quot;在 OpenClaw 中透過 RunAPI 使用 Imagen 4 — 圖像 API 指南&quot;
url: &quot;https://runapi.ai/zh-TW/openclaw-imagen-4.md&quot;
canonical: &quot;https://runapi.ai/zh-TW/openclaw-imagen-4&quot;
locale: &quot;zh-TW&quot;
model: &quot;imagen-4&quot;
---

# 在 OpenClaw 中使用 Imagen 4。

Imagen 4 是 Google DeepMind 的圖像生成模型，具有精準的文字渲染和高提示詞保真度。OpenClaw agent 透過與聊天相同的 RunAPI 端點和 API key 呼叫它，無需安裝額外技能。

## 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;imagen-4&quot;,
    &quot;prompt&quot;: &quot;A ceramic coffee mug on a wooden table with morning light, the text HELLO printed on the side in serif font, photorealistic&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;imagen-4&quot;
}

```

## How it works

1. **設定 RunAPI** — 設定 RUNAPI_API_KEY 環境變數。若已在 OpenClaw 中將 RunAPI 設定為 provider 用於聊天，同一個 key 也適用於圖像生成。
2. **呼叫 Imagen 4** — 向 text_to_image 端點發送 POST 請求，將 model 設為 imagen-4，並附上描述性提示詞。視需要加入 aspect_ratio 或 negative_prompt。
3. **取得結果** — 回應包含一個 task_id。輪詢任務狀態端點，直到狀態變為 completed。完成後的回應包含生成的圖像 URL。

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | 必填。imagen-4、imagen-4-fast 或 imagen-4-ultra。 |
| `prompt` | `string` | 對所需圖像的文字描述。 |
| `aspect_ratio` | `string` | 選填。例如 1:1、16:9、9:16。 |
| `negative_prompt` | `string` | 選填。生成圖像中需要避免的內容。 |

## FAQ

### 可以在 OpenClaw 中使用 Imagen 4 嗎？

可以。OpenClaw agent 透過 RunAPI text_to_image 端點呼叫 Imagen 4。將 model 欄位設為 imagen-4，並使用聊天所用的同一個 RUNAPI_API_KEY 發送請求。無需額外技能或外掛。

### Imagen 4 需要單獨的 API key 嗎？

不需要。同一個 RUNAPI_API_KEY 適用於聊天、圖像、影片和音樂的 113+ 個模型。一個 key，一個計費帳戶。

### Imagen 4 是非同步還是同步的？

非同步。初始請求傳回狀態為 pending 的 task_id。輪詢任務狀態端點直到任務完成，然後從回應中取得圖像 URL。RunAPI SDK 會自動處理輪詢。

### 透過 RunAPI 使用 Imagen 4 的價格是多少？

Imagen 4 按用量計費，無月度最低消費。價格因方案而異：imagen-4-fast 最便宜，imagen-4 為標準方案，imagen-4-ultra 品質最高。請查看 RunAPI 定價頁面取得最新每張價格。


## Links

- [OpenClaw 設定指南 →](https://runapi.ai/zh-TW/openclaw)
- [Imagen 4 模型 →](https://runapi.ai/zh-TW/models/imagen-4)
- [Model catalog](https://runapi.ai/zh-TW/models)
- [API docs](https://runapi.ai/zh-TW/docs)
