Create an xAI video
Use CometAPI POST /grok/v1/videos/generations to create Grok image-to-video jobs from an input image and prompt, then poll results via request_id.
request_id immediately, so treat it as the first step in an async workflow.
Start with a small request
- Use
model: grok-imagine-video-1.5 - Set
image.urlto a public JPEG, PNG, or WebP URL - For a first request, keep
durationat1andresolutionat720p - Keep
promptexplicit so the animation direction is clear - If you send base64, keep the docs and OpenAPI example form as
data:image/png;base64,<BASE64_IMAGE_DATA>
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 | 720p in the examples | Higher resolution requests cost more and take longer to complete. |
aspect_ratio | ratio labels such as 1:1, 16:9, or 9:16 | 16:9 in the examples | This endpoint uses resolution plus aspect_ratio; do not send a separate size field for exact WxH control. |
| Request combination | Intended output WxH |
|---|---|
resolution: 480p, aspect_ratio: 1:1 | 480x480 |
resolution: 720p, aspect_ratio: 16:9 | 1280x720 |
resolution: 720p, aspect_ratio: 9:16 | 720x1280 |
Task flow
Poll for completion
done.Authorizations
Bearer token authentication. Use your CometAPI key.
Body
Prompt describing how the source image should animate. CometAPI requires this field for this route.
"Animate the still image with a slow camera move and natural motion."
Output aspect ratio. Combine with resolution to choose the target frame; for example 480p with 1:1 targets 480x480, 720p with 16:9 targets 1280x720, and 720p with 9:16 targets 720x1280. This endpoint does not expose an exact size field.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Output duration in seconds. Use an integer from 1 through 15. If omitted, CometAPI treats the request as an 8-second generation for billing and default handling.
Source image for image-to-video. Use a public JPEG, PNG, or WebP URL, or a data URI such as data:image/png;base64,<BASE64_IMAGE_DATA>.
xAI video model id. The default example uses Grok Imagine 1.5 for image-to-video.
"grok-imagine-video-1.5"
Output resolution. Use 720p for a small image-to-video test, or 1080p when you need a higher resolution tier.
480p, 720p, 1080p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
Response
Request accepted.
Deferred request id used for polling.