Grok Imagine video generation (async)

Submit an asynchronous xAI Grok Imagine video task. Poll using the returned task ID to retrieve the video URL.

POST /v1/videos/generations

## Grok Imagine video generation (async) xAI Grok Imagine video model, asynchronous task mode: `POST /v1/videos/generations` submits immediately and returns task ID; poll via `GET /v1/videos/generations/{id}` to check status; when task `succeeded`, response includes video URL. **Model** - `grok-imagine-video` — text-to-video (t2v) / image-to-video (i2v) - `grok-imagine-video-1.5-preview` — **only image-to-video (i2v)**, must pass `image` **Image-to-video (i2v)**: pass `image` field (first frame reference image). ⚠️ `image` must be an object `{"url": "https://..."}` **Query status**: see 'query video task' (`GET /v1/videos/generations/{id}`); when task `succeeded` is completed, response includes video URL (directly accessible for download)

Request body

modelstringrequiredvideo model ID
promptstringrequiredtext description; required for text-to-video, optional for image-to-video (describes motion/stylization)
durationnumbervideo duration (seconds)
resolutionstringResolution
aspect_ratiostringaspect ratio
imageobjectfirst frame reference image for image-to-video (i2v). ⚠️ Must be an object `{"url": "https://..."}`. `grok-imagine-video-1.5-preview` is required.

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