Create Grok Video
/v1/videosGeneration workflow
Creation is asynchronous. The create response contains a task rather than a video file.
- Call POST /v1/videos with your UnifyLLM API key and save the exact id from the response.
- Poll GET /v1/videos/{task_id} every 5–10 seconds while queued or in_progress.
- Once completed, inspect error for moderation blocks or other problems before downloading GET /v1/videos/{task_id}/content.
Generation modes
| Mode | Input | Purpose |
|---|---|---|
| Text to video | prompt | Generate from a text description |
| Image to video | prompt + image | Use an image as the first frame |
| Last frame | prompt + last_frame | Specify the ending image |
| First and last frames | prompt + image + last_frame | Lock the starting and ending frames |
| Keyframes | prompt + keyframes; optional first/last frames | Specify intermediate frames |
| Reference images | prompt + reference_images | Guide characters or style without locking exact frames |
Parameters and media limits
- Use grok-imagine-video-1.5. A non-empty prompt is required in all modes.
- Requests using reference_images, last_frame or keyframes support at most 720p. Do not request 1080p for these modes.
- example.com image URLs are templates. Replace them with actual public images. Image objects use url, not file_id.
- Use at most 4 keyframes, strictly within (0, duration), in distinct 1/3-second slots.
Request Body
application/jsonmodel:requiredstringUse grok-imagine-video-1.5. Your API key must have access to this model.
grok-imagine-video-1.5grok-imagine-video-1.5prompt:requiredstringNon-empty generation prompt. Required in every mode, including image, last-frame, keyframe and reference-image inputs.
A paper boat floats on a calm lake. Locked camera, soft daylight.duration:optionalintegerVideo duration in seconds, from 1 through 15. Default: 8.
3seconds:optionalintegerCompatibility alias for duration. Prefer duration and do not send conflicting values.
3resolution:optionalstring480p (default), 720p or 1080p. Requests using reference_images, last_frame or keyframes are limited to 720p.
480p720p1080p480paspect_ratio:optionalstringVideo aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 or 5:2.
1:116:99:164:33:43:22:321:95:216:9generate_audio:optionalbooleanSet false to disable audio generation. Omission uses the upstream default.
falseimage:optionalobjectFirst-frame object, for example {"url":"https://..."}. Use a public HTTP(S) image URL or a complete image data URL. file_id is not supported.
{"url":"https://example.com/start.jpg"}last_frame:optionalobjectLast-frame object, for example {"url":"https://..."}. Use alone or combine with image to lock both ends. Accepts a public image URL or a complete image data URL.
{"url":"https://example.com/end.jpg"}keyframes:optionalarray1–4 keyframes, each shaped as {"image":{"url":"..."},"timestamp_s":1}. Timestamps must be strictly between 0 and duration and occupy distinct 1/3-second slots.
[{"image":{"url":"https://example.com/middle.jpg"},"timestamp_s":1}]reference_images:optionalarray1–14 {"url":"https://..."} objects for visual guidance, such as characters or style. These do not lock exact frames.
[{"url":"https://example.com/character.jpg"},{"url":"https://example.com/style.jpg"}]Response
200A successful request returns a JSON response. The complete example is shown in the code panel.
Usage notes
- This channel supports Grok 1.5 generation, not video editing, extension, audio references, storage_options or custom output uploads.
- Save the exact id returned by creation and query its status instead of submitting creation again.