promptstringrequerido
Text description of the desired video.
xai/grok-imagine-video/text-to-videoGrok Imagine Video by xAI - generate cinematic videos from text descriptions with AI. Create high-quality video content with natural motion, camera control, and optional audio generation.
Probar el modelo
¿Qué le gustaría hacer después?
Seleccione un ejemplo para cargar sus entradas y el resultado en el playground.
{
"prompt": "Anime schoolgirl bursting out of house door, cherry blossoms blowing, morning light, speed lines indicating rush, chibi-ready expressions, classic shojo aesthetic, vibrant colors"
}Grok Imagine Video turns a prompt into a 1–15 second clip with native audio.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Up to 4,096 characters. |
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 | 16:9 | Output frame shape. |
$0.05 per output second.
| Output | Price |
|---|---|
| 6s (default) | $0.30 |
| 10s | $0.50 |
| 15s | $0.75 |
Failed runs are not charged.
Other Grok Imagine Video endpoints: xai/grok-imagine-video/image-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).
Empiece a construir
Envíe este modelo a través de la API de ejecución unificada de SandBase.
# 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/text-to-video",
"prompt": "Anime schoolgirl bursting out of house door, cherry blossoms blowing, morning light, speed lines indicating rush, chibi-ready expressions, classic shojo aesthetic, vibrant colors",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9"
}
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"Cree una clave de API de SandBase y configúrela en el entorno de su servidor. Todas las solicitudes usan autenticación Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Conserve la clave en el servidor. No la exponga en código del navegador ni la confirme en un repositorio.
Haga un POST a /v1/run con este ID de modelo y sus entradas. El ejemplo de solicitud anterior incluye el envío y el sondeo.
Use el ID de ejecución devuelto para sondear hasta que el estado sea completed, failed o timeout. Lea la salida solo después de completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Proporcione una URL de archivo accesible públicamente en el campo de imagen, video o audio del modelo. Los formatos y límites admitidos se muestran junto a cada entrada de Playground.
Use el control de subir o reemplazar en los campos de imagen admitidos en Playground. Los campos de URL de video aceptan un video de conducción alojado; no implican compatibilidad con la subida de video.
promptstringrequeridoText description of the desired video.
durationintegerVideo duration in seconds.
Valor predeterminado: 6
Mínimo: 1
Máximo: 15
resolutionstringResolution of the output video.
Valor predeterminado: "720p"
Valores posibles: "480p", "720p"
aspect_ratiostringThe aspect ratio of the generated image.
Valor predeterminado: "16:9"
Valores posibles: "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16"
{
"model": "xai/grok-imagine-video/text-to-video",
"prompt": "Anime schoolgirl bursting out of house door, cherry blossoms blowing, morning light, speed lines indicating rush, chibi-ready expressions, classic shojo aesthetic, vibrant colors",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9"
}Una ejecución completada expone su resultado en la salida. Lo siguiente es el ejemplo guardado del modelo, no una nueva generación.
[
{
"poster": "https://static.sandbase.ai/examples/posters/a3eef95c5f7288e57f7a.jpg",
"source": "xAI schema mirror",
"source_url": "https://docs.x.ai/",
"url": "https://static.sandbase.ai/examples/0bd87eb9-18fe-4dd1-bc10-a1480fcab6d9/output/3869cf9e-9063-413d-bdfe-43b343a78491.mp4"
}
]