promptstringrequired
Text prompt describing the video to generate. Use @Image1, @Image2, etc. to reference specific images from reference_image_urls in order.
xai/grok-imagine-video/reference-to-videoGrok Imagine Video is xAI's image-to-video AI model. Bring static images to life with fluid animation, consistent character motion, and professional-grade video output.
Try the model
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 7
Customize your input with more control.
What would you like to do next?
Select an example to load its inputs and result into the playground.
{
"prompt": "A @Image1 running through a sunlit meadow, cinematic slow motion",
"reference_image_urls": [
"https://static.sandbase.ai/examples/1d487450-78ff-4d5a-87b2-0abdacea87d7/input/1bb4adf0-cb56-4abf-8133-5b627a7fd3ef.png"
]
}Grok Imagine Video reference-to-video: up to 7 reference images keep characters and objects consistent in a 1–10 second clip.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Up to 4,096 characters. |
aspect_ratio | 16:9 / 4:3 / 3:2 / 1:1 / 2:3 / 3:4 / 9:16 | 16:9 | Output frame shape. |
resolution | 480p / 720p | 720p | Sets the per-second rate. |
duration | integer 1–10 | 8 | Output length in seconds. |
reference_image_urls | image URL[] (≤7), required | — | Reference images, up to 7. |
$0.07 per output second at 720p and $0.05 at 480p, plus $0.002 per request.
| Output | 480p | 720p |
|---|---|---|
| 6s | $0.302 | $0.422 |
| 8s (default) | $0.402 | $0.562 |
| 10s | $0.502 | $0.702 |
Failed runs are not charged.
Other Grok Imagine Video endpoints: xai/grok-imagine-video/text-to-video, xai/grok-imagine-video/image-to-video, xai/grok-imagine-video/video-edit, xai/grok-imagine-video/video-extend, xai/grok-imagine-video/1.5/text-to-video (1.5, newer).
Start building
Submit this model through the SandBase Unified Run API.
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "xai/grok-imagine-video/reference-to-video",
"prompt": "A @Image1 running through a sunlit meadow, cinematic slow motion",
"duration": 8,
"resolution": "720p",
"aspect_ratio": "16:9",
"reference_image_urls": [
"https://static.sandbase.ai/examples/xai/grok-imagine-video/reference-to-video/input_reference_image_urls_0.png"
]
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"Create a SandBase API key and set it in your server environment. All requests use Bearer authentication.
export SANDBASE_API_KEY="YOUR_API_KEY"Keep the key on your server. Do not expose it in browser code or commit it to a repository.
POST to /v1/run with this model ID and its inputs. The request example above includes submission and polling.
Use the returned run ID to poll until the status is completed, failed or timeout. Read output only after completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Pass a publicly accessible file URL in the model’s image, video or audio field. Supported formats and limits are shown beside each Playground input.
Use the upload or replace control on supported image fields in the Playground. Video URL fields accept a hosted driving video; they do not imply video-upload support.
promptstringrequiredText prompt describing the video to generate. Use @Image1, @Image2, etc. to reference specific images from reference_image_urls in order.
durationintegerVideo duration in seconds.
Default: 8
Minimum: 1
Maximum: 10
resolutionstringResolution of the output video.
Default: "720p"
Possible values: "480p", "720p"
aspect_ratiostringThe aspect ratio of the generated image.
Default: "16:9"
Possible values: "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16"
reference_image_urlsarrayrequiredOne or more reference image URLs to guide the video generation as style and content references. Reference in prompt as @Image1, @Image2, etc. Maximum 7 images.
{
"model": "xai/grok-imagine-video/reference-to-video",
"prompt": "A @Image1 running through a sunlit meadow, cinematic slow motion",
"duration": 8,
"resolution": "720p",
"aspect_ratio": "16:9",
"reference_image_urls": [
"https://static.sandbase.ai/examples/xai/grok-imagine-video/reference-to-video/input_reference_image_urls_0.png"
]
}A completed run exposes its result in output. The following is the model’s saved example, not a new generation.
[
{
"poster": "https://static.sandbase.ai/examples/posters/008e2a60f15ea4813552.jpg",
"source": "xAI schema mirror",
"source_url": "https://docs.x.ai/",
"url": "https://static.sandbase.ai/examples/1d487450-78ff-4d5a-87b2-0abdacea87d7/output/a93d9668-7b65-41f8-9c74-3792eb4dc43e.mp4"
}
]