promptstringwajib
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.
Coba model ini
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 7
Apa yang ingin Anda lakukan selanjutnya?
Pilih contoh untuk memuat input dan hasilnya ke 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).
Mulai membangun
Kirim model ini melalui 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"Buat SandBase API key dan atur di environment server Anda. Semua permintaan menggunakan autentikasi Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Simpan key di server. Jangan tampilkan di kode browser atau commit ke repository.
POST ke /v1/run dengan ID model ini dan inputnya. Contoh permintaan di atas mencakup pengiriman dan polling.
Gunakan run ID yang dikembalikan untuk polling sampai status completed, failed, atau timeout. Baca output hanya setelah completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Kirim URL file yang dapat diakses publik di field image, video, atau audio model. Format dan batas yang didukung ditampilkan di samping setiap input Playground.
Gunakan kontrol upload atau replace pada field gambar yang didukung di Playground. Field URL video menerima video driving yang di-host; ini tidak berarti dukungan upload video.
promptstringwajibText 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
Maksimum: 10
resolutionstringResolution of the output video.
Default: "720p"
Nilai yang mungkin: "480p", "720p"
aspect_ratiostringThe aspect ratio of the generated image.
Default: "16:9"
Nilai yang mungkin: "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16"
reference_image_urlsarraywajibOne 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"
]
}Run yang selesai menampilkan hasilnya di output. Berikut adalah contoh tersimpan model ini, bukan generasi baru.
[
{
"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"
}
]