Grok Imagine 视频生成 (异步)

xAI Grok Imagine 视频生成, 异步任务. 提交返回任务 ID, 轮询查询状态获取视频 URL.

POST /v1/videos/generations

## Grok Imagine 视频生成 (异步) xAI Grok Imagine 视频模型, 异步任务模式: `POST /v1/videos/generations` 提交后**立即返回任务 ID**, 通过 `GET /v1/videos/generations/{id}` 轮询查询状态, 任务 `succeeded` 时响应含视频 URL。 **模型** - `grok-imagine-video` — 文生视频 (t2v) / 图生视频 (i2v) - `grok-imagine-video-1.5-preview` — **仅图生视频 (i2v)**, 必须传 `image` **图生视频 (i2v)**: 传 `image` 字段 (首帧参考图)。⚠️ `image` 必须是对象 `{"url": "https://..."}`。 **查询状态**: 见「查询视频任务」(`GET /v1/videos/generations/{id}`), 任务 `succeeded` 时响应含视频 URL (可直接访问下载)。

Request body

modelstringrequired视频模型 ID
promptstringrequired文本描述; 文生视频必填, 图生视频可选 (描述运动/风格)
durationnumber视频时长 (秒)
resolutionstring分辨率
aspect_ratiostring画面比例
imageobject图生视频 (i2v) 首帧参考图。⚠️ 必须是对象 `{"url": "https://..."}`。`grok-imagine-video-1.5-preview` 必填。

Responses

Example

# 文生视频 (t2v)
curl -X POST https://api.router.ai/v1/videos/generations \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "一只柯基在草地上奔跑, 阳光明媚",
    "resolution": "720p",
    "duration": 5
  }'

# 图生视频 (i2v) — image 必须是 {"url":...} 对象
curl -X POST https://api.router.ai/v1/videos/generations \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video-1.5-preview",
    "prompt": "镜头缓慢推近",
    "image": { "url": "https://example.com/first_frame.jpg" },
    "resolution": "720p"
  }'

# 查询任务状态
curl https://api.router.ai/v1/videos/generations/gt-20260629130818-9b3a2f \
  -H "Authorization: Bearer $YOUR_API_KEY"

API reference