OPENCLAW + GROK IMAGINE

在 OpenClaw 中使用 Grok Imagine。

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

一個 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 設定檔中設定 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,並附上描述圖像的 prompt。如需影片,以 grok-imagine-text-to-video 使用 text_to_video。

text_to_image
3

取得結果

API 立即返回 task_id。輪詢 task status 端點直到狀態變為 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 agent 通過 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,將 prompt 貼入 OpenClaw,開始使用 xAI Grok Imagine 生成圖像和影片。