Skip to main content
Submit an asynchronous video generation task using xAI’s Grok video models. The API accepts a prompt plus optional duration, aspect ratio, resolution, and reference images — then immediately returns a task id for polling. Grok supports both text-to-video and image-to-video modes, with four distinct model variants offering different duration ranges, resolution caps, and reference image constraints.

Base URL

Endpoint

Authentication

Models

Choose the model that best fits your duration, resolution, and billing needs:
grok_video3_max and grok_video3_stable require reference images to be publicly accessible URLs — base64-encoded images are not supported for these models.

Request Parameters

string
required
The Grok model to use. See the model table above for capabilities.Supported values:
  • grok_video3
  • grok_video3_pro
  • grok_video3_max
  • grok_video3_stable
string
required
Text description of the video you want to generate. Include subject, action, camera movement, and visual style for best results.Example: "A cat dancing in the rain, cinematic style"
integer
Output video duration in seconds. Behavior varies by model:
string
Output video aspect ratio. Defaults to 16:9 for all models.
string
Output resolution. Defaults to 720p for all models.
array
Array of reference image URLs for image-to-video generation. When omitted, the request is treated as text-to-video.Constraints by model:
  • grok_video3 — up to 7 images
  • grok_video3_pro — reference images supported
  • grok_video3_max — up to 5 images; must be public URLs
  • grok_video3_stable — up to 7 images; must be public URLs
Example: ["https://example.com/ref1.jpg", "https://example.com/ref2.jpg"]
Passing image_urls switches the request to image-to-video mode. Do not pass image_urls for pure text-to-video generation.

Response Fields

string
Unique task identifier. Save this — you’ll use it to poll the Query Video Task endpoint.
string
Object type. Always "video".
integer
Unix timestamp of when the task was created.
string
The model name used for this task.
string
Task status at creation. Always "queued" on successful submission.
string
Error message. null on successful submission.

Code Examples

Example Response

Key Constraints

  • Omit image_urls for text-to-video; include it for image-to-video
  • For grok_video3_max: only the enumerated duration values are accepted — do not pass arbitrary seconds
  • For grok_video3_stable: reference images must be publicly accessible URLs (no base64)
  • More reference images generally means longer queue and generation time
  • grok_video3_pro has a fixed 10-second duration — do not set the duration field

Next Steps

Use the returned id to poll the Query Video Task endpoint for status updates and to retrieve video_url when generation completes.