OPENCLAW + GROK IMAGINE

在 OpenClaw 中使用 Grok Imagine。

Grok Imagine 是 xAI 的圖像和影片生成套件——文生圖、圖生圖、文生影片和圖生影片。OpenClaw agent 透過與聊天相同的 RunAPI key 和 /v1 端點呼叫它,無需安裝額外技能。

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

Requirements:
- Use the RunAPI API at https://runapi.ai/v1/text_to_image.
- Read the API key from RUNAPI_API_KEY environment variable.
- Set the model to "grok-imagine-text-to-image".
- Write a descriptive prompt for the image you want.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the output URL.
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-text-to-image",
    "prompt": "a robot hand placing a chess piece on a board, dramatic side lighting, slow motion feel"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "grok-imagine-text-to-image"
}
複製 curl 指令進行測試 grok-imagine
運作原理

三步在 OpenClaw 中使用 Grok Imagine

1

設定 RunAPI

在 shell profile 中設定 RUNAPI_API_KEY 環境變數。若 RunAPI 已在 OpenClaw 中設定用於聊天,同一個 key 也適用於 Grok Imagine,無需額外設定。

export RUNAPI_API_KEY=runapi_xxx
2

呼叫 Grok Imagine

向 text_to_image 端點發送 POST 請求,將 model 設為 grok-imagine-text-to-image,並附上描述圖像的提示詞。影片生成請使用 text_to_video 和 grok-imagine-text-to-video。

text_to_image
3

取得結果

API 立即傳回 task_id。輪詢任務狀態端點,直到狀態變為 completed,然後從回應中取得輸出圖像或影片 URL。

task_id: tsk_abc123
參數

Grok Imagine API 參數

參數 類型 說明
model string 必填。例如 grok-imagine-text-to-image、grok-imagine-image-to-video。
prompt string 對所需輸出的文字描述。
image_url string 圖生圖或圖生影片的來源圖像 URL。
aspect_ratio string 選填。輸出長寬比,例如 16:9、1:1。

OpenClaw 上的 Grok Imagine 是什麼?

Grok Imagine(Aurora)是 xAI 內建於 Grok 平台的圖像與影片生成器。它能從文字提示詞生成逼真肖像、動漫風格插圖,以及附帶同步音訊的短片。OpenClaw 代理透過 RunAPI 呼叫它,無需 Grok 或 SuperGrok 訂閱,即可進行文生圖、圖像編輯和影片生成。

Grok Imagine 使用情境

逼真肖像生成

從文字描述生成高品質的逼真肖像和角色圖像,適用於社群媒體頭像、行銷人設或創意專案。

社群媒體內容創作

直接從文字提示詞生成社交貼文、限時動態和廣告用的圖像及短片,輸出內容無水印。

風格化藝術與動漫角色

從詳細提示詞生成插圖風格和動漫角色藝術,為遊戲、品牌或內容系列打造一致的角色設計。

FAQ

Grok Imagine + OpenClaw 常見問題

OpenClaw 通用設定

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

OpenClaw 設定指南 →

Grok Imagine 模型目錄

查看所有 Grok Imagine 變體、價格和 API 文件。

Grok Imagine 模型 →

立即在 OpenClaw 中試用 Grok Imagine。

取得免費 RunAPI key,將提示詞貼到 OpenClaw,開始使用 xAI Grok Imagine 生成圖像和影片。