Skip to main content
xAIFastHigh

Grok Imagine Video

Generate videos using xAI's Grok Imagine Video model. Supports text-to-video, image-to-video, and editing an existing short video clip.

580 credits
per 5s video (default) โ€” billed per second (117/s, 1-15s)
Flat per-second pricing regardless of resolution or aspect ratio
Text-to-video and image-to-video generation
Video editing mode โ€” modify an existing short clip (up to 8.7s) with a prompt
480p or 720p output, up to 15 seconds
Auto aspect ratio detection from the input image

Run it right now

Test this model instantly in the Console Playground โ€” no code required

Sign in to try

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

Quick Start

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "xai/grok-imagine-video",
  "input": {
    "prompt": "a penguin walks away from the camera, towards a large snowy mountaintop in the distance",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }
}'

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-Text prompt for video generation
imagestringNo-Input image to generate video from (image-to-video). Supports jpg, jpeg, png, webp
videostringNo-Input video to edit (video editing mode). Direct link, max 8.7 seconds. mp4, mov, webm
durationintegerNo5Duration of the video in seconds (1-15). Ignored when editing a video
resolutionstringNo720pResolution of the video. Ignored when editing a video
720p480p
aspect_ratiostringNoautoAspect ratio. Defaults to 16:9 for text-to-video, or the input image's ratio for image-to-video. Ignored when editing a video
auto16:94:31:19:163:43:22:3

How to Provide File Input

There are 3 ways to provide files for the imagevideo parameters:

Recommended

Direct Upload (Multipart)

Attach files directly to POST /v1/predictions/upload. No separate upload step needed.

curl -X POST "https://api.core.today/v1/predictions/upload" \
  -H "X-API-Key: cdt_your_api_key" \
  -F "model=xai/grok-imagine-video" \
  -F 'input={"prompt":"your prompt here"}' \
  -F "file:image=@your_file.png"

Image URL

Pass a publicly accessible URL directly. You can also use file_url from the Storage API.

{
  "model": "xai/grok-imagine-video",
  "input": {
    "prompt": "your prompt here",
    "image": "https://example.com/image.jpg"
  }
}
See the File Upload docs for more upload methods including Presigned URLs.

Common Parameters

Common parameters used when calling POST /v1/predictions.

ParameterTypeRequiredDefaultDescription
modelstringYes-Model identifier
inputobjectYes-Object containing the model-specific parameters from the table above
output_folderstringNo-Folder path for output files (max 256 chars, '..' not allowed)
webhook_urlstringNo-Webhook URL to call on completion
is_publicbooleanNofalseIf true, output files are also available via permanent public URLs

Examples

Text-to-Video (720p)

Generate a 5-second clip directly from a text prompt

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "xai/grok-imagine-video",
  "input": {
    "prompt": "a penguin walks away from the camera, towards a large snowy mountaintop in the distance",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }
}'

Longer Clip (15s)

The maximum 15-second duration, still billed at the same flat per-second rate

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "xai/grok-imagine-video",
  "input": {
    "prompt": "a lone astronaut walking across a red Martian desert as twin suns set on the horizon",
    "duration": 15,
    "resolution": "480p",
    "aspect_ratio": "21:9"
  }
}'

Tips & Best Practices

1Pricing is a flat $0.05/sec regardless of resolution or aspect ratio โ€” pick 720p unless file size matters
2Duration ranges 1-15 seconds; longer clips cost proportionally more with no per-second discount
3In video editing mode, duration and resolution inputs are ignored (the source clip's length is kept)
4aspect_ratio: auto lets the model infer 16:9 for text prompts or match your input image automatically

Use Cases

Quick text-to-video clips for social content
Animating a still image into short motion
Editing an existing video clip with a text instruction
Iterating on video length up to 15 seconds at a flat rate
Vertical or square clips using explicit aspect ratios