One continuous ten-second fixed full-body shot inside a small circular circus rehearsal ring. A single adult male acrobat with closely cropped dark hair wears plain burgundy practice clothes and soft black shoes. He starts standing centered, holding one straight white baton horizontally. He tosses that single baton gently a short distance above his head, watches it, catches it cleanly with one hand, then makes a controlled half turn and gives a modest bow toward the camera. Keep his whole body and the baton visible throughout, with one consistent person and one consistent baton. Warm overhead rehearsal lighting, empty wooden benches, realistic movement, no cuts, no extra performers, no text or logos.
Grok Imagine Video Text to Video API
xai/grok-imagine-video/text-to-videoGrok Imagine Video Text to Video 将场景描述转为短片,结合文字引导的主体动作与运镜。提示词组织场景和动态过程,时长、生成模式与画幅共同确定镜头的呈现形式。
获取 API Key继续使用
示例
REST API
快速开始
提交请求并保存 task_id,在任务完成后读取生成文件。
连接 Vidgo API
在服务端保存 API Key,通过 Authorization: Bearer VIDGO_API_KEY 发送。
- 端点
- POST
https://api.vidgo.ai/api/generate/submit - 认证
- Authorization: Bearer VIDGO_API_KEY
提交生成任务
在请求顶层设置 model 和 callback_url,将下列字段放入 input。
curl --request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "xai/grok-imagine-video/text-to-video",
"input": {
"prompt": "清晨的林间小径上,一名骑行者从远处驶来,镜头向右平移跟随,树叶在微风中轻轻摇动。",
"duration": 6,
"mode": "normal",
"aspect_ratio": "16:9"
}
}'获取结果
状态为 not_started 或 running 时,每 2–5 秒查询一次;finished 和 failed 为终态。
查询状态
GET https://api.vidgo.ai/api/generate/status/{task_id}状态为 not_started 或 running 时,每 2–5 秒查询一次;finished 和 failed 为终态。
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "example-task-id",
"status": "not_started",
"created_time": "2026-09-27T10:00:00Z"
}
}{
"code": 200,
"data": {
"task_id": "example-task-id",
"status": "finished",
"created_time": "2026-09-27T10:00:00Z",
"files": [
{
"file_url": "https://example.com/result.mp4",
"file_type": "video"
}
]
}
}完整轮询示例
提交请求并保存 task_id,在任务完成后读取生成文件。
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "xai/grok-imagine-video/text-to-video",
"input": {
"prompt": "清晨的林间小径上,一名骑行者从远处驶来,镜头向右平移跟随,树叶在微风中轻轻摇动。",
"duration": 6,
"mode": "normal",
"aspect_ratio": "16:9"
}
}
JSON
)
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
TASK_ID=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.data.task_id // .task_id // empty')
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
while true; do
STATUS_RESPONSE=$(curl --silent --show-error --fail-with-body \
--url "https://api.vidgo.ai/api/generate/status/$TASK_ID" \
--header "Authorization: Bearer $VIDGO_API_KEY")
STATUS=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.data.status // .status // empty')
case "$STATUS" in
finished)
printf '%s' "$STATUS_RESPONSE" | jq -r '(.data.files // .files // [])[]?.file_url'
break
;;
failed)
printf '%s' "$STATUS_RESPONSE" | jq -r '.data.error_message // .error_message // "Generation failed"' >&2
exit 1
;;
not_started|running)
sleep 2
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
done请求参数
在请求顶层设置 model 和 callback_url,将下列字段放入 input。
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| input.prompt | string | 是 | – | 描述场景与动作,长度为 1–5,000 个字符。 |
| input.aspect_ratio | string | 否 | – | 可选值为 1:1、2:3、3:2、16:9、9:16。 |
| input.mode | string | 否 | – | 生成风格,可选 fun、normal、spicy。 |
| input.duration | integer | 否 | 6 | 视频时长,单位为秒,可选整数 6、10;默认 6。 |
响应字段
提交响应返回 task_id,状态响应返回生成文件或任务错误。
| 字段 | 类型 | 说明 |
|---|---|---|
| code | integer | 业务返回码,0 或 200 表示成功。 |
| data.task_id | string | 用于查询状态的任务标识。 |
| data.status | string | not_started, running, finished, failed |
| data.created_time | string | 任务创建时间。 |
| data.files[].file_url | string | 生成文件的 URL。 |
| data.files[].file_type | string | video |
| data.error_message | string | null | 任务失败原因。 |
任务生命周期
状态为 not_started 或 running 时,每 2–5 秒查询一次;finished 和 failed 为终态。
not_started已接收,等待执行。
running正在生成。
finished读取生成文件。
failed读取 error_message 并结束轮询。
轮询与错误处理
- 轮询状态为 not_started 或 running 时,每 2–5 秒查询一次;finished 和 failed 为终态。
- 重试状态查询遇到 429 或临时服务错误时延长间隔,再查询同一 task_id。
- 回调在请求顶层提供公开 callback_url,接收任务完成通知。
模型规格
| 规格 | 取值 | 说明 |
|---|---|---|
| 输入 | Prompt | 描述场景与动作,长度为 1–5,000 个字符。 |
| 输出 | video | 6 秒或 10 秒视频。 |
| aspect_ratio | 1:1 · 2:3 · 3:2 · 16:9 · 9:16 | 可选值为 1:1、2:3、3:2、16:9、9:16。 |
| mode | fun · normal · spicy | 生成风格,可选 fun、normal、spicy。 |
| duration | 6 · 10 | 视频时长,单位为秒,可选整数 6、10;默认 6。 |
相关模型
Grok Imagine Video Text to Video API 常见问题
Grok Imagine Video Text to Video API 是什么?
Grok Imagine Video Text to Video 是 xAI 用于根据文字生成视频场景的模型。它生成 6 秒或 10 秒短片,提供可选视觉模式及方形、竖幅和横幅画面。提示词共同描述主体、环境、动作与镜头方向,为片段建立明确的场景和运动过程。你可以通过 API 调用,也可以在“体验”标签中在线试用。
Grok Imagine Video Text to Video 如何使用运镜指令?
在 prompt 中同时说明主体动作和镜头运动。例如,主体保持静止而镜头逐渐推进,或镜头跟随人物穿过场景,让两种运动各自承担清晰的作用。
Grok Imagine Video Text to Video 有哪些视觉模式?
mode 可选 fun、normal、spicy,与场景提示词一同使用。比较不同视觉处理时,保留相同提示词及其他设置,便于观察该选项带来的变化。
Grok Imagine Video Text to Video 如何选择短片时长?
duration 可设为 6 秒或 10 秒,省略时按 6 秒生成。按所选长度安排动作:短镜头集中呈现一次运动,需要更长展开过程的动作可选择 10 秒。
Grok Imagine Video Text to Video 提供哪些画幅?
aspect_ratio 可选 1:1、2:3、3:2、16:9 和 9:16,分别用于方形配图视频、竖幅场景或横向构图。
何时应选择 Grok Imagine Video Text to Video 而非 Grok Imagine Video Image to Video?
希望通过文字简报定义场景、主体和动作时,选择 Grok Imagine Video Text to Video;希望已有图片提供视觉起点时,选择 Grok Imagine Video Image to Video。
Grok Imagine Video Text to Video 的 10 秒短片如何计费?
10 秒短片每条为 40 credits,即 $0.200;6 秒短片每条为 30 credits,即 $0.150。费用按所选时长对应的单条视频计算。















