Generate videos with xAI's Grok Imagine Video model over the direct xAI API. Text-to-video and image-to-video with synchronized audio. For editing an existing clip, use xai/grok-imagine-video/edit.
Test this model instantly in the Console Playground โ no code required
Copy usage instructions for Claude, ChatGPT, or other AI
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": 8,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}'| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | - | Text prompt for video generation |
image | string | No | - | Input image to generate video from (image-to-video). Supports jpg, jpeg, png, webp |
duration | integer | No | 8 | Duration of the video in seconds (1-15) |
resolution | string | No | - | Resolution of the video. When omitted, billing uses the 720p rate โ set it explicitly 480p720p |
aspect_ratio | string | No | 16:9 | Aspect ratio of the output video ('auto' is not accepted by the direct xAI API) 16:94:31:19:163:43:22:3 |
There are 3 ways to provide files for the image parameter:
Pass a publicly accessible URL directly. With the Storage API (POST /v1/files/upload-url) the file uploads straight to S3 (50MB per file) and you pass the returned file_url.
{
"model": "xai/grok-imagine-video",
"input": {
"prompt": "your prompt here",
"image": "https://example.com/image.jpg"
}
}Attach files directly to POST /v1/predictions/upload. No separate upload step, but the bytes pass through the API server so the whole request is capped at 10MB.
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"Common parameters used when calling POST /v1/predictions.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | Model identifier |
input | object | Yes | - | Object containing the model-specific parameters from the table above |
output_folder | string | No | - | Folder path for output files (max 256 chars, '..' not allowed) |
webhook_url | string | No | - | Webhook URL to call on completion |
is_public | boolean | No | false | If true, output files are also available via permanent public URLs |
Generate an 8-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": 8,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}'480p costs ~28% less per second than 720p
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": "16:9"
}
}'POST /v1/predictions