Video Generation
Use CometAPI POST /grok/v1/videos/generations to create videos with Grok, animate an input image via prompt, and 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 - For a first request, keep
durationat1andresolutionat480p - Add
image.urlonly when you want image-to-video - 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 | 480p | 720p requests are billed at the higher resolution tier. |
aspect_ratio | ratio labels such as 1:1, 16:9, or 9:16 | 1:1 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 for the video job.
"A candle flickers on a wooden table."
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.
Optional source image for image-to-video.
xAI video model id.
"grok-imagine-video"
Output resolution. Use 480p for faster first tests or 720p for the higher resolution tier.
480p, 720p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
Response
Request accepted.
Deferred request id used for polling.