Skip to main content
POST

Authorizations

Authorization
string
header
required

API Key authentication. Format: Bearer YOUR_API_KEY.

Body

application/json

xAI Grok Imagine reference-to-video request. Generates a video from a prompt while preserving the subjects from up to 7 reference images. Duration is capped at 10 seconds.

prompt
string
required

Text description of the video to generate

Minimum string length: 1
Example:

"The character runs across a snowy field under the northern lights"

reference_images
string[]
required

Reference images (1-7) whose subjects are preserved in the generated video. Each item is a publicly accessible image URL or a base64 data URI.

Required array length: 1 - 7 elements
Minimum string length: 1
Example:
duration
integer
default:8

Video duration in seconds (max 10 when using reference images)

Required range: 1 <= x <= 10
Example:

10

aspect_ratio
enum<string>

Video aspect ratio

Available options:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
Example:

"16:9"

resolution
enum<string>
default:480p

Video resolution

Available options:
480p,
720p
Example:

"720p"

Response

Task submitted successfully

code
integer
required

Response code, 0 indicates success

Example:

0

message
string
required

Response message

Example:

"success"

data
object
required

Detailed data about the submitted asynchronous task.