Create Grok Video

POST/v1/videos
Create asynchronous videos from text, first and last frames, keyframes or reference images with grok-imagine-video-1.5.

Generation 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

ModeInputPurpose
Text to videopromptGenerate from a text description
Image to videoprompt + imageUse an image as the first frame
Last frameprompt + last_frameSpecify the ending image
First and last framesprompt + image + last_frameLock the starting and ending frames
Keyframesprompt + keyframes; optional first/last framesSpecify intermediate frames
Reference imagesprompt + reference_imagesGuide 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/json
model:requiredstring

Use grok-imagine-video-1.5. Your API key must have access to this model.

Allowedgrok-imagine-video-1.5
Examplegrok-imagine-video-1.5
prompt:requiredstring

Non-empty generation prompt. Required in every mode, including image, last-frame, keyframe and reference-image inputs.

ExampleA paper boat floats on a calm lake. Locked camera, soft daylight.
duration:optionalinteger

Video duration in seconds, from 1 through 15. Default: 8.

Example3
seconds:optionalinteger

Compatibility alias for duration. Prefer duration and do not send conflicting values.

Example3
resolution:optionalstring

480p (default), 720p or 1080p. Requests using reference_images, last_frame or keyframes are limited to 720p.

Allowed480p720p1080p
Example480p
aspect_ratio:optionalstring

Video aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 or 5:2.

Allowed1:116:99:164:33:43:22:321:95:2
Example16:9
generate_audio:optionalboolean

Set false to disable audio generation. Omission uses the upstream default.

Examplefalse
image:optionalobject

First-frame object, for example {"url":"https://..."}. Use a public HTTP(S) image URL or a complete image data URL. file_id is not supported.

Example{"url":"https://example.com/start.jpg"}
last_frame:optionalobject

Last-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.

Example{"url":"https://example.com/end.jpg"}
keyframes:optionalarray

1–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.

Example[{"image":{"url":"https://example.com/middle.jpg"},"timestamp_s":1}]
reference_images:optionalarray

1–14 {"url":"https://..."} objects for visual guidance, such as characters or style. These do not lock exact frames.

Example[{"url":"https://example.com/character.jpg"},{"url":"https://example.com/style.jpg"}]

Response

200

A 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.

Related endpoints