Model ID
Use with the Workers AI binding, the AI Gateway REST API, or the Unified API.
Calling the provider directly? Use the provider's model name instead, including with provider-native endpoints or the provider's own SDK. For example, Anthropic's name for anthropic/claude-opus-4.8 is claude-opus-4-8.
- Third-party
- Zero data retention
xAI's video generation model. Generates, edits, and extends videos from text and image inputs with native synchronized audio including dialogue, sound effects, and music. Supports multiple creative modes (normal, fun, custom).
| Model Info | |
|---|---|
| Terms and License | link ↗ |
| More information | link ↗ |
| Zero data retention | Yes |
| Pricing |
|
const response = await env.AI.run(
'xai/grok-imagine-video',
{
prompt: 'A golden retriever running through a field of sunflowers on a sunny day',
aspect_ratio: '16:9',
duration: 5,
resolution: '720p',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xai/grok-imagine-video",
"input": {
"prompt": "A golden retriever running through a field of sunflowers on a sunny day",
"aspect_ratio": "16:9",
"duration": 5,
"resolution": "720p"
}
}'{
"state": "Completed",
"result": {
"video": "https://examples.aig.cloudflare.com/xai/grok-imagine-video/simple-video.mp4"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}Portrait Video — Vertical video for social media
const response = await env.AI.run(
'xai/grok-imagine-video',
{
prompt: 'Slow-motion close-up of ink drops blooming through water against a black background',
aspect_ratio: '9:16',
duration: 5,
resolution: '720p',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xai/grok-imagine-video",
"input": {
"prompt": "Slow-motion close-up of ink drops blooming through water against a black background",
"aspect_ratio": "9:16",
"duration": 5,
"resolution": "720p"
}
}'{
"state": "Completed",
"result": {
"video": "https://examples.aig.cloudflare.com/xai/grok-imagine-video/portrait-video.mp4"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}Cinematic Landscape — Widescreen cinematic shot at extended duration
const response = await env.AI.run(
'xai/grok-imagine-video',
{
prompt:
'A wide drone shot over snow-covered mountain peaks at sunrise, dramatic lighting with low clouds',
aspect_ratio: '16:9',
duration: 10,
resolution: '720p',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xai/grok-imagine-video",
"input": {
"prompt": "A wide drone shot over snow-covered mountain peaks at sunrise, dramatic lighting with low clouds",
"aspect_ratio": "16:9",
"duration": 10,
"resolution": "720p"
}
}'{
"state": "Completed",
"result": {
"video": "https://examples.aig.cloudflare.com/xai/grok-imagine-video/cinematic-landscape.mp4"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}_operation
stringenum: generate, edit, extendprompt
stringduration
integerminimum: 1maximum: 15aspect_ratio
stringenum: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3resolution
stringenum: 480p, 720psize
stringenum: 848x480, 1696x960, 1280x720, 1920x1080▶image{}
object▶video{}
object▶reference_images[]
arraymaxItems: 10▶output{}
objectuser
stringvideo
string