v1

Generate a video from a text prompt and optionally an image. This is an asynchronous operation that returns a request_id for polling.

post/v1/videos/generations

Request

  • Base URL: https://docs.x.ai (the document declares no server; this is the origin it was published from)
  • URL: https://docs.x.ai/v1/videos/generations
  • Auth: HTTP bearer

Request body

aspect_ratio'1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '3:2' | '2:3' | '21:9' | '5:2'

Aspect ratio for video generation.

durationinteger nullable

Video duration in seconds. Range: [1, 15]. Default: 8. Also accepts seconds for OpenAI API compatibility. Accepts both number (8) and string ("8") values.

modelstring nullable

Model to be used.

promptstring

Prompt for video generation. Required for text-to-video (T2V) and reference-to-video (R2V). Optional for image-to-video (I2V) — when omitted, the model generates a video from the image alone.

resolution'480p' | '720p' | '1080p'

Resolution for video generation.

userstring nullable

A unique identifier representing your end-user.

Example request

{
  "model": "grok-imagine-video"
}

Response

Video generation started successfully

request_idstring required

A unique request ID to poll for the result.

Changes

No recorded changes to this operation across all 1 revision of this API.