- Third-party
xAI's next-generation video generation model. Generates, edits, and extends videos from text and image inputs. Supports multiple aspect ratios and resolutions with improved quality over the previous generation.
| Model Info | |
|---|---|
| Terms and License | link ↗ |
| More information | link ↗ |
| Pricing | View pricing in the Cloudflare dashboard ↗ |
Usage
const response = await env.AI.run(
'xai/grok-imagine-video-1.5-preview',
{
prompt: 'Generate a slow and serene time-lapse',
image: { url: 'https://docs.x.ai/assets/api-examples/video/milkyway-still.png' },
duration: 12,
},
)
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-1.5-preview",
"input": {
"prompt": "Generate a slow and serene time-lapse",
"image": {
"url": "https://docs.x.ai/assets/api-examples/video/milkyway-still.png"
},
"duration": 12
}
}'{
"state": "Completed",
"result": {
"video": "https://examples.aig.cloudflare.com/xai/grok-imagine-video-1.5-preview/image-to-video.mp4"
},
"gatewayMetadata": {
"keySource": "Unified"
}
}Parameters
_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