All models
xAI
Video
Available
Grok Imagine Image to Video
Output is an MP4 video with an audio track generated together with the video (dialogue written in the prompt is spoken). Audio cannot be turned off.
Image to Video
From 400 credits (≈ ₹400.00) per request.
Parameters
| Parameter | Type | Description |
|---|---|---|
image_urls |
array<string> | Provide an external image URL as a reference for video generation. Up to 7 images are supported. Do not use it simultaneously with task_id. In your prompt, reference an uploaded image by typing @image(n) followed by a space (for example: @image1 a sunset over the ocean). - Supports JPEG, PNG, and WEBP formats - Maximum file size for each image: 10MB - The Spicy mode is not available when using external images - The array can contain a maximum of seven URLs - Only one is supported when the resolu |
task_id |
string | Task ID from a previously generated Grok image. Use with index to select a specific image. Do not use with image_urls. - Use task ID from grok-imagine/text-to-image generations - Supports all modes including Spicy - Maximum length: 100 characters max length 100 |
index |
integer | When using task_id, the 0-based index of the image to use. A grok-imagine/text-to-image task returns 2 images, so valid values are 0 and 1. Default 0. - Ignored if image_urls is provided min 0 · max 1 · default 0 |
prompt |
string | Text prompt describing the desired video motion. Optional field. - Should be detailed and specific about the desired visual motion - Describe movement, action sequences, camera work, and timing - Include details about subjects, environments, and motion dynamics - Maximum length: 5000 characters - Supports English language prompts |
mode |
string | Specifies the generation mode affecting the style and intensity of motion. Note: Spicy mode is not available for external image inputs. - **fun**: More creative and playful interpretation - **normal**: Balanced approach with good motion quality - **spicy**: More dynamic and intense motion effects (not available for external images) Default: normal one of: "fun", "normal", "spicy" · default "normal" |
duration |
string | The duration of the generated video (in seconds) (6-30). (Minimum: 6, Maximum: 30, Step: 1) |
resolution |
string | The resolution of the generated video. one of: "480p", "720p", "1080p" · default "480p" |
aspect_ratio |
string | Image ratio selection only applies to multi-image generation mode. In single-image mode, the video width and height are referenced to the image width and height. one of: "2:3", "3:2", "1:1", "16:9", "9:16" · default "16:9" |
nsfw_checker |
boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
What you get back
Files arrive in output.files[] as private links that expire, with their type and size.
Use it from your code
# 1. Create the task
curl https://nexus.promptscenes.in/api/v1/tasks \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "grok-imagine-image-to-video",
"input": {
"index": 0,
"mode": "normal",
"resolution": "480p",
"aspect_ratio": "16:9"
},
"callback_url": "https://your-app.com/webhooks/nexus"
}'
# 2. Poll for the result
curl https://nexus.promptscenes.in/api/v1/tasks/TASK_ID \
-H "Authorization: Bearer $NEXUS_API_KEY"
import os, time, uuid, requests
API = "https://nexus.promptscenes.in/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['NEXUS_API_KEY']}"}
task = requests.post(
f"{API}/tasks",
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={
"model": "grok-imagine-image-to-video",
"input": {
"index": 0,
"mode": "normal",
"resolution": "480p",
"aspect_ratio": "16:9",
},
"callback_url": "https://your-app.com/webhooks/nexus",
},
).json()
while task["status"] not in ("succeeded", "failed", "cancelled"):
time.sleep(3)
task = requests.get(f"{API}/tasks/{task['id']}", headers=HEADERS).json()
print(task["status"], task.get("output"))
const API = "https://nexus.promptscenes.in/api/v1";
const headers = {
Authorization: `Bearer ${process.env.NEXUS_API_KEY}`,
"Content-Type": "application/json",
};
let task = await fetch(`${API}/tasks`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({
"model": "grok-imagine-image-to-video",
"input": {
"index": 0,
"mode": "normal",
"resolution": "480p",
"aspect_ratio": "16:9"
},
"callback_url": "https://your-app.com/webhooks/nexus"
}),
}).then((r) => r.json());
while (!["succeeded", "failed", "cancelled"].includes(task.status)) {
await new Promise((r) => setTimeout(r, 3000));
task = await fetch(`${API}/tasks/${task.id}`, { headers }).then((r) => r.json());
}
console.log(task.status, task.output);
Request
{
"model": "grok-imagine-image-to-video",
"input": {
"index": 0,
"mode": "normal",
"resolution": "480p",
"aspect_ratio": "16:9"
}
}
Response
{
"id": "6f1c…",
"object": "task",
"model": "grok-imagine-image-to-video",
"status": "succeeded",
"output": {
"files": [
{
"url": "https://…signed…",
"mime": "…",
"size": 0
}
]
},
"estimated_cost": "…",
"charged": "…"
}