Skip to main content
POST

Available models

Key: resolution is chosen by the model name

Grok video is priced per resolution tier, and the resolution is selected via the model-name suffix: use ...-720p for 720p and ...-480p for 480p. Do not pass a resolution parameter (it has no effect). Each resolution has its own price — see the models & pricing page.

size only sets the aspect ratio

size (e.g. 1280x720, 720x1280) is used only to determine the aspect ratio (landscape 16:9 / portrait 9:16, etc.); it does not set the resolution. Do not use 1792x1024 / 1024x1792 (they are rejected).

Flow

  1. POST /v1/videos — submit the task and get id (the task_id)
  2. GET /v1/videos/{task_id} — poll until status=completed
  3. Read the video URL from metadata.url, or download the stream via GET /v1/videos/{task_id}/content

Image-to-video and reference-to-video

  • Image-to-video: pass image or input_reference (URL or Base64 data URI); the model animates the image as the first frame. grok-imagine-video-1.5-preview requires an input image.
  • Reference-to-video (grok-imagine-video only): pass an images array of reference images to guide generation; image and images are mutually exclusive. A compatibility alias ref_images (a root-level array equivalent to images; use one or the other, not both) also works; new integrations should prefer images.

Duration

Specify with seconds (recommended, a string like "5") or duration (a number). The allowed range is 1–15 seconds.

Authorizations

Authorization
string
header
required

Bearer Token authentication, format: Authorization: Bearer sk-xxxxxx. Get an API Key in the console.

Body

application/json

Grok Imagine video generation request. model and prompt are required. Resolution is determined by the model-name suffix (-480p / -720p); do not pass resolution. size only sets the aspect ratio.

model
enum<string>
required

Model ID. Resolution is determined by the suffix (-480p / -720p) and is priced per resolution tier. grok-imagine-video supports text/image/reference to video; grok-imagine-video-1.5-preview is image-to-video only (input image required).

Available options:
grok-imagine-video-480p,
grok-imagine-video-720p,
grok-imagine-video-1.5-preview-480p,
grok-imagine-video-1.5-preview-720p
Example:

"grok-imagine-video-720p"

prompt
string
required

Text prompt describing the video content, motion, scene, camera, and style. For image-to-video, describe the desired motion and changes.

Example:

"A crystal-powered rocket lifts off from the red dunes of Mars, cinematic, stable shot"

size
string

Frame size, e.g. 1280x720. Used only to determine the aspect ratio (landscape 16:9 / portrait 9:16, etc.); it does not set the resolution (resolution comes from the model-name suffix). Do not use 1792x1024 / 1024x1792 (rejected).

Example:

"1280x720"

seconds
string

Recommended. Video duration in seconds, preferably a string (e.g. "5"). Allowed range 1–15 seconds. Do not combine with duration.

Example:

"5"

duration
number

Compatibility field. Video duration in seconds, allowed range 1–15. New integrations should use the top-level seconds; do not combine with seconds.

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

5

image
string

Single input image, URL or Base64 data URI. Setting it triggers image-to-video mode. grok-imagine-video-1.5-preview requires an input image. Mutually exclusive with images.

Example:

"https://example.com/image.jpg"

input_reference
string

Input image (Sora-style field), URL or Base64 data URI, equivalent to image. Used for image-to-video; provide either image or this.

Example:

"https://example.com/image.jpg"

images
string[]

Multiple reference images, URL or Base64. Used for reference-to-video mode (grok-imagine-video only). Mutually exclusive with image. The recommended field for multi-image reference.

Example:
ref_images
string[]

Compatibility alias for the reference-images array, equivalent to images (use one or the other, not both). For clients that follow this convention; new integrations should prefer images.

Example:
user
string

End-user identifier for auditing and risk control; not used in generation.

Example:

"user-1234"

Response

Grok video task created successfully

Grok video task object, compatible with the OpenAI / Sora video task format.

id
string
required

Video task ID.

Example:

"video_abc123"

object
enum<string>
required

Object type, always video.

Available options:
video
Example:

"video"

model
enum<string>
required

The model used to run the task.

Available options:
grok-imagine-video-480p,
grok-imagine-video-720p,
grok-imagine-video-1.5-preview-480p,
grok-imagine-video-1.5-preview-720p
Example:

"grok-imagine-video-720p"

status
enum<string>
required

Task status.

Available options:
queued,
in_progress,
completed,
failed
Example:

"queued"

progress
integer
required

Task progress percentage (0–100).

Required range: 0 <= x <= 100
Example:

0

created_at
integer<int64>
required

Task creation timestamp (milliseconds).

Example:

1764347090922

seconds
string
required

Video duration in seconds.

Example:

"10"

completed_at
integer<int64>

Task completion timestamp (milliseconds), filled once complete.

Example:

1764347170000

expires_at
integer<int64>

Expiration timestamp (milliseconds) of the task and the video file.

Example:

1764433570000

size
string

Actual output size, e.g. 1280x720. The actual resolution comes from the model-name suffix; the aspect ratio comes from the request size.

Example:

"1280x720"

error
object

Grok video task error info.

metadata
object

Extra metadata; usually contains a url field once complete.