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,并附上描述图像的 prompt。视频生成请使用 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 agent 通过 RunAPI 调用它,无需 Grok 或 SuperGrok 订阅即可完成文生图、图像编辑和视频生成。

Grok Imagine 使用场景

写实肖像生成

根据文字描述生成高质量写实肖像和角色图像,适用于社交媒体头像、营销人设或创意项目。

社交媒体内容创作

直接从文本提示生成社交帖子、故事和广告所需的图片及短视频,输出结果无水印。

风格化插画与动漫角色

根据详细提示创作插画风格和动漫角色形象,为游戏、品牌或内容系列生成一致的角色设计。

常见问题

Grok Imagine + OpenClaw 常见问题

OpenClaw 通用配置

还没配置?从 OpenClaw 的 RunAPI 配置指南开始。

OpenClaw 配置指南 →

Grok Imagine 模型目录

查看所有 Grok Imagine 变体、价格和 API 文档。

Grok Imagine 模型 →

立即在 OpenClaw 中试用 Grok Imagine。

获取免费 RunAPI key,将 prompt 粘贴到 OpenClaw,开始使用 xAI Grok Imagine 生成图像和视频。