imagesarray必填
One or more reference image URLs to guide the video generation as style and content references. Reference in prompt as <IMAGE_0>, <IMAGE_1>, etc. Maximum 7 images.
xai/grok-imagine-video/1.5/reference-to-videoGrok Imagine Video 1.5 is xAI's image-to-video AI model. Bring static images to life with fluid animation, consistent character motion, and professional-grade video output.
試用這個模型
PNG, JPEG, WebP, or GIF · 20 MiB maximum each
接下來您想做什麼?
選擇一個範例,將其輸入與結果載入 playground。
{
"duration": 1,
"images": [
"https://static.sandbase.ai/examples/182071c8-4a68-49d6-8ddb-2e1ba5af7d4d/input/2e71e37f-fbf8-44ba-a7ad-c1a366f777bd.png"
],
"prompt": "the subject walks forward",
"resolution": "480p"
}Grok Imagine Video 1.5 reference-to-video: reference images keep characters and objects consistent in a 1–15 second clip.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Up to 4,096 characters. |
aspect_ratio | 21:9 / 16:9 / 3:2 / 4:3 / 5:4 / 1:1 / 4:5 / 3:4 / 2:3 / 9:16 | — | Output frame shape. |
resolution | 480p / 720p | 720p | Sets the per-second rate. |
duration | integer 1–15 | 8 | Output length in seconds. |
images | image URL[], required | — | Reference images, Image 1, Image 2, … |
Per output second: $0.08 at 480p and $0.14 at 720p, plus $0.01 per reference image.
| Output | 480p | 720p |
|---|---|---|
| 8s (default) | $0.65 | $1.13 |
| 15s | $1.21 | $2.11 |
Failed runs are not charged.
Other Grok Imagine Video 1.5 endpoints: xai/grok-imagine-video/1.5/text-to-video, xai/grok-imagine-video/1.5/image-to-video, xai/grok-imagine-video/1.5/lite/text-to-video, xai/grok-imagine-video/1.5/lite/image-to-video, xai/grok-imagine-video/text-to-video (previous version).
開始建置
透過 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/1.5/reference-to-video",
"prompt": "The person from <IMAGE_0> walks through a rainy neon-lit street.",
"duration": 8,
"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"建立 SandBase API 金鑰,並將其設定在伺服器環境中。所有請求都使用 Bearer 驗證。
export SANDBASE_API_KEY="YOUR_API_KEY"請將金鑰保留在伺服器端,不要在瀏覽器程式碼中公開,也不要提交到儲存庫。
使用此模型 ID 及其輸入,向 /v1/run 發送 POST。上方的請求範例包含提交與輪詢。
使用回傳的執行 ID 持續輪詢,直到狀態為 completed、failed 或 timeout。只有在 completed 之後才讀取輸出。
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"在模型的 image、video 或 audio 欄位中傳入可公開存取的檔案 URL。支援格式與限制會顯示在每個 Playground 輸入欄位旁。
在 Playground 中支援的圖片欄位上使用上傳或取代控制項。影片 URL 欄位可接受託管的 driving video;它們不代表支援影片上傳。
imagesarray必填One or more reference image URLs to guide the video generation as style and content references. Reference in prompt as <IMAGE_0>, <IMAGE_1>, etc. Maximum 7 images.
promptstring必填Text prompt describing the video. Tag references as <IMAGE_0>, <IMAGE_1>, etc.
durationintegerVideo duration in seconds.
預設:8
最小值:1
最大值:15
resolutionstringResolution of the output video.
預設:"720p"
可能值:"480p", "720p"
aspect_ratiostringThe aspect ratio of the generated image.
可能值:"21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16"
{
"model": "xai/grok-imagine-video/1.5/reference-to-video",
"prompt": "The person from <IMAGE_0> walks through a rainy neon-lit street.",
"duration": 8,
"resolution": "720p"
}已完成的執行會在輸出中顯示結果。以下為模型已儲存的範例,並非新的生成結果。
[
{
"poster": "https://static.sandbase.ai/examples/posters/d087fb8ab1ef444377f3.jpg",
"source": "Completed user prediction (human visual safety screened)",
"source_url": "https://www.sandbase.ai",
"url": "https://static.sandbase.ai/examples/182071c8-4a68-49d6-8ddb-2e1ba5af7d4d/output/95798e92-c36f-4ca4-bd1a-bcff7dcee1ca.mp4"
}
]