imagestringbắt buộc
URL of the input image for video generation.
xai/grok-imagine-video/image-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.
Thử model
PNG, JPEG, WebP hoặc GIF · tối đa 20 MiB
Bạn muốn làm gì tiếp theo?
Chọn một ví dụ để nạp đầu vào và kết quả của nó vào playground.
{
"image": "https://static.sandbase.ai/examples/f044c9ae-db59-43ac-a737-59b5480873ae/input/0e57dfa7-564f-4ae5-bd6c-f33aa4fd6580.png",
"prompt": "Medieval knight in ornate armor walking through a mystical forest, bioluminescent plants pulsing with light, ancient stone ruins overgrown with glowing vines, over-the-shoulder camera, dark fantasy aesthetic, volumetric fog and Lumen lighting"
}Grok Imagine Video image-to-video: animate a picture into a 1–15 second clip with native audio.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Up to 4,096 characters. |
image | image URL, required | — | First frame. JPEG, PNG, or WebP URL. |
resolution | 480p / 720p | 720p | Sets the per-second rate. |
duration | integer 1–15 | 6 | Output length in seconds. |
aspect_ratio | 16:9 / 4:3 / 3:2 / 1:1 / 2:3 / 3:4 / 9:16 | — | Output frame shape. |
$0.07 per output second at 720p and $0.05 at 480p, plus $0.002 per request.
| Output | 480p | 720p |
|---|---|---|
| 6s (default) | $0.302 | $0.422 |
| 10s | $0.502 | $0.702 |
| 15s | $0.752 | $1.052 |
Failed runs are not charged.
Other Grok Imagine Video endpoints: xai/grok-imagine-video/text-to-video, xai/grok-imagine-video/reference-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).
Bắt đầu xây dựng
Gửi model này qua 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/image-to-video",
"image": "https://static.sandbase.ai/examples/xai/grok-imagine-video/image-to-video/input_image_0.png",
"prompt": "Medieval knight in ornate armor walking through a mystical forest, bioluminescent plants pulsing with light, ancient stone ruins overgrown with glowing vines, over-the-shoulder camera, dark fantasy aesthetic, volumetric fog and Lumen lighting",
"duration": 6,
"resolution": "720p"
}
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"Tạo một SandBase API key và đặt nó trong môi trường máy chủ của bạn. Tất cả request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key trên máy chủ. Không hiển thị trong mã trình duyệt hoặc commit vào repository.
POST tới /v1/run với model ID này và các đầu vào của nó. Ví dụ request ở trên bao gồm cả bước gửi và polling.
Dùng run ID được trả về để poll cho đến khi trạng thái là completed, failed hoặc timeout. Chỉ đọc đầu ra sau khi completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Cung cấp một URL tệp có thể truy cập công khai trong trường image, video hoặc audio của model. Các định dạng và giới hạn được hỗ trợ hiển thị bên cạnh từng input trong Playground.
Dùng điều khiển upload hoặc replace trên các trường image được hỗ trợ trong Playground. Trường URL video chấp nhận một video driving được host; điều này không đồng nghĩa hỗ trợ tải lên video.
imagestringbắt buộcURL of the input image for video generation.
promptstringbắt buộcText description of desired changes or motion in the video.
durationintegerVideo duration in seconds.
Mặc định: 6
Tối thiểu: 1
Tối đa: 15
resolutionstringResolution of the output video.
Mặc định: "720p"
Giá trị có thể dùng: "480p", "720p"
aspect_ratiostringOutput aspect ratio. Omit to match the input image.
Giá trị có thể dùng: "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16"
{
"model": "xai/grok-imagine-video/image-to-video",
"image": "https://static.sandbase.ai/examples/xai/grok-imagine-video/image-to-video/input_image_0.png",
"prompt": "Medieval knight in ornate armor walking through a mystical forest, bioluminescent plants pulsing with light, ancient stone ruins overgrown with glowing vines, over-the-shoulder camera, dark fantasy aesthetic, volumetric fog and Lumen lighting",
"duration": 6,
"resolution": "720p"
}Một run đã hoàn tất sẽ hiển thị kết quả trong output. Phần sau là ví dụ đã lưu của model, không phải một lần tạo mới.
[
{
"poster": "https://static.sandbase.ai/examples/posters/31a11aff2676ad71ba05.jpg",
"source": "xAI schema mirror",
"source_url": "https://docs.x.ai/",
"url": "https://static.sandbase.ai/examples/f044c9ae-db59-43ac-a737-59b5480873ae/output/17697857-c655-4eeb-b3e6-e5eaa3f9bee1.mp4"
}
]