promptstringобязательно
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.
Попробовать модель
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 7
Что вы хотите сделать дальше?
Выберите пример, чтобы загрузить его входные данные и результат в 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).
Начните разработку
Отправьте эту модель через 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"Создайте ключ SandBase API и задайте его в окружении сервера. Все запросы используют аутентификацию Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Храните ключ на сервере. Не раскрывайте его в коде браузера и не коммитьте в репозиторий.
Отправьте POST на /v1/run с этим ID модели и её входными данными. Пример запроса выше включает отправку и опрос.
Используйте возвращённый ID запуска, чтобы опрашивать статус до завершения, ошибки или таймаута. Читайте вывод только после завершения.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Передайте публично доступный URL файла в поле image, video или audio модели. Поддерживаемые форматы и лимиты показаны рядом с каждым полем Playground.
Используйте управление загрузкой или заменой в поддерживаемых полях изображений в Playground. Поля URL видео принимают размещённое видео для вождения; это не означает поддержку загрузки видео.
promptstringобязательноText prompt describing the video to generate. Use @Image1, @Image2, etc. to reference specific images from reference_image_urls in order.
durationintegerVideo duration in seconds.
По умолчанию: 8
Минимум: 1
Максимум: 10
resolutionstringResolution of the output video.
По умолчанию: "720p"
Возможные значения: "480p", "720p"
aspect_ratiostringThe aspect ratio of the generated image.
По умолчанию: "16:9"
Возможные значения: "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16"
reference_image_urlsarrayобязательноOne 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"
]
}В завершённом запуске результат доступен в output. Ниже приведён сохранённый пример модели, а не новая генерация.
[
{
"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"
}
]