xAI
Create a video with Grok
Create asynchronous Grok Imagine Video 1.5 jobs from text, a source image, or image and preset-voice references.
POST
/
grok
/
v1
/
videos
/
generations
curl https://api.cometapi.com/grok/v1/videos/generations \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary '{
"model": "grok-imagine-video-1.5",
"prompt": "A paper boat glides across a quiet pond at sunrise.",
"duration": 1,
"aspect_ratio": "16:9",
"resolution": "480p"
}'{
"request_id": "<request_id>"
}Use this endpoint to start a Grok video job from text, a source image, or reference inputs. It returns a
For a data URI, use
Generated videos include an audio track. Set
request_id immediately, so treat it as the first step in an async workflow.
Always send model: grok-imagine-video-1.5 explicitly. model and prompt are required for the 1.5 request shapes documented here.
Choose an input mode
| Mode | Request fields | Rules |
|---|---|---|
| Text-to-video | prompt | Omit image, reference_images, and reference_audios. |
| Image-to-video | prompt, image.url | image.url accepts a public image URL or an image data URI. Do not combine image with reference inputs. |
| Reference-to-video | prompt and at least one of reference_images or reference_audios | Send up to 7 reference images and up to 3 preset voices. Reference-to-video output is limited to 720p. |
data:image/png;base64,<BASE64_IMAGE_DATA>. Each reference_images item uses the same url field. A reference audio item uses a preset voice_id, such as eve. In the prompt, tags such as <IMAGE_0> and <AUDIO_0> can identify the corresponding reference.
Start with a small request
- Use
model: grok-imagine-video-1.5 - For a first request, keep
durationat1andresolutionat480p - Keep
promptexplicit so the scene and motion are clear - Add one input mode at a time before combining reference images and voices
Duration and resolution
| Setting | Supported values | Default | Boundary behavior |
|---|---|---|---|
duration | integer 1-15 | 8 | Use shorter clips for first tests; longer clips cost more and take longer to complete. |
resolution | 480p, 720p, 1080p | 480p | Higher resolution requests cost more and take longer to complete. Reference-to-video supports up to 720p. |
aspect_ratio | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 | 16:9 for text-to-video | For image-to-video, omission preserves the source image’s aspect ratio. |
duration, resolution, and aspect_ratio explicitly when your application depends on a particular output shape.
Task flow
1
Create the job
Send the model, prompt, and any inputs, then save the returned
request_id.2
Poll for completion
Call Get xAI video results until the top-level
status becomes done, failed, or expired. An initial response can contain only the echoed request_id while task metadata is prepared.3
Persist the output
Copy the final
video.url into your own storage if you need it after the temporary delivery window.Body
application/json
Last modified on August 21, 2026
⌘I
curl https://api.cometapi.com/grok/v1/videos/generations \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary '{
"model": "grok-imagine-video-1.5",
"prompt": "A paper boat glides across a quiet pond at sunrise.",
"duration": 1,
"aspect_ratio": "16:9",
"resolution": "480p"
}'{
"request_id": "<request_id>"
}