OPENCLAW + IMAGEN 4

在 OpenClaw 中使用 Imagen 4。

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

一個 API key · 文生圖端點 · 非同步任務輪詢
Use RunAPI to generate an image with Google Imagen 4.

Requirements:
- Read the API key from RUNAPI_API_KEY. Do not hardcode the key.
- Send a POST request to https://runapi.ai/v1/text_to_image.
- Set the model to imagen-4.
- Write a descriptive prompt for the image you want.
- The response returns a task_id. Poll the task status endpoint until the task completes.
- When the task is complete, retrieve the image URL from the response.
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "imagen-4",
    "prompt": "A ceramic coffee mug on a wooden table with morning light, the text HELLO printed on the side in serif font, photorealistic"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "imagen-4"
}
複製 curl 指令進行測試 imagen-4
運作原理

三步在 OpenClaw 中使用 Imagen 4

1

設定 RunAPI

設定 RUNAPI_API_KEY 環境變數。若已在 OpenClaw 中將 RunAPI 設定為 provider 用於聊天,同一個 key 也適用於圖像生成。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Imagen 4

向 text_to_image 端點發送 POST 請求,將 model 設為 imagen-4,並附上描述性提示詞。視需要加入 aspect_ratio 或 negative_prompt。

POST /v1/text_to_image
3

取得結果

回應包含一個 task_id。輪詢任務狀態端點,直到狀態變為 completed。完成後的回應包含生成的圖像 URL。

task_id: tsk_abc123
參數

Imagen 4 API 參數

參數 類型 說明
model string 必填。imagen-4、imagen-4-fast 或 imagen-4-ultra。
prompt string 對所需圖像的文字描述。
aspect_ratio string 選填。例如 1:1、16:9、9:16。
negative_prompt string 選填。生成圖像中需要避免的內容。

OpenClaw 上的 Imagen 4 是什麼?

Imagen 4 是 Google DeepMind 的圖像模型,使用者稱其「秒速呈現驚艷效果」,評測者描述為 API 市場「每像素最佳性價比」。它提供三個層級——Fast 用於快速原型製作、Standard 用於正式生產、Ultra 用於最高細節——最便宜的層級每張約 $0.02。OpenClaw 代理透過同一個 RunAPI key 呼叫三個層級。

Imagen 4 使用情境

大規模快速原型製作

以每張 $0.02 的 Fast 層級進行快速概念探索,在確定方向前生成數十個變體,再用 Standard 或 Ultra 層級進行最終製作。

含清晰文字的 UI 和標籤設計

生成介面模擬稿、產品標籤和招牌設計,其中嵌入的文字清晰渲染並精確遵循提示詞。

逼真材質與素材

創建逼真的材質紋理、復古旅遊明信片和探險風格攝影場景,具備精確的光線和表面細節。

FAQ

Imagen 4 + OpenClaw 常見問題

OpenClaw 通用設定

尚未設定?請從 OpenClaw 的 RunAPI 設定指南開始。

OpenClaw 設定指南 →

Imagen 4 模型目錄

查看所有 Imagen 4 變體、價格和 API 文件。

Imagen 4 模型 →

立即在 OpenClaw 中試用 Imagen 4。

取得免費 RunAPI key,將提示詞貼到 OpenClaw,開始使用 Google Imagen 4 生成圖像。