Create video generation
Video / grok-imagine-video
Create video generation
Generate 6- to 20-second videos with grok-imagine-video from text or reference images.
POST
Create video generation
/v1/videos/generations returns a task_id immediately after submission. Generation time depends on duration and resolution, and is generally one to five minutes. Poll /v1/tasks/{task_id} for status.
The video endpoint currently supports only the
grok-imagine-video model. Inference and billing use the special pricing for the Grok route.Request URL
Text-to-video example
task_id, call Retrieve video task.
Reference-image-to-video example
Convert reference images todata:image/...;base64,... Data URLs first. Browser blob: URLs cannot be submitted directly; your server must read the binary data and encode it.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Currently fixed to grok-imagine-video. |
prompt | string | Yes | Video description, up to 2,500 characters. |
seconds | string | Yes | Duration in seconds: "6" / "10" / "12" / "16" / "20". |
size | string | Yes | Frame size: 1280x720 (16:9), 720x1280 (9:16), or 1024x1024 (1:1). |
resolution_name | string | Yes | Resolution tier: 720p (HD) or 480p (SD). |
preset | string | Yes | Style preset: normal (standard), fun (high playfulness), spicy (high intensity), or custom (custom prompt). |
input_reference | string[] | No | Array of up to seven reference-image Data URLs. When provided, enables reference-image-to-video mode. |
group | string | No | Route group. Console requests include default; third-party callers generally leave it empty. |
Duration and resolution combinations
- Use
720pfor final output.480pgenerates faster and is suitable for previews. - Longer durations increase generation time and price. Start with
seconds: "6"to validate the workflow. - When changing the same prompt to
9:16or1:1, describe where the subject should appear in the frame to avoid cropping.
Error handling
The video endpoint also uses the OpenAI-styleerror wrapper. See Errors for common errors. If a 400 response reports a reference-image problem, verify that:
- The reference image is PNG, JPEG, or WebP.
- It uses a Data URL, not a
blob:URL or regular HTTP URL. - Each reference image is smaller than 10 MB.
- The request includes no more than seven reference images.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Maximum string length:
2500Available options:
6, 10, 12, 16, 20 Available options:
1280x720, 720x1280, 1024x1024 Available options:
480p, 720p Available options:
normal, fun, spicy, custom Maximum array length:
7data:image/...;base64,... Data URL
Response
Video task submission