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)
model | string | required | video model ID |
prompt | string | required | text description; required for text-to-video, optional for image-to-video (describes motion/stylization) |
duration | number | video duration (seconds) | |
resolution | string | Resolution | |
aspect_ratio | string | aspect ratio | |
image | object | first frame reference image for image-to-video (i2v). ⚠️ Must be an object `{"url": "https://..."}`. `grok-imagine-video-1.5-preview` is required. |
200 — task submitted (asynchronous). Use returned ID to poll status.402 — Insufficient balance# 文生视频 (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"