Natural wildlife documentary, a single anatomically correct giant anteater beside a red-earth termite mound in open dry Brazilian cerrado, ochre grass and scattered low scrub under bright afternoon light. Low medium side view, locked camera, entire long snout and forequarters visible. It brings its nose close to a small hole, gives one brief sneeze that lifts a tiny puff of loose red dust, then blinks and holds still. Its long muzzle, small ears, bushy tail and coat markings remain consistent. Audio: one soft animal sneeze exactly on the head movement, dry wind and distant insects, no human voice or music. One continuous five-second shot. No cuts, subtitles, captions, visible writing, logos, advertising or watermarks.
Wan 2.5 Text to Video API
alibaba/wan-2.5/text-to-videoWan 2.5 Text to Video 将文字描述生成带同步音频的短片,支持连贯运动与最高 1080p 画质。它根据提示词组织人物、场景和动作,让运镜方向与声音配合创作意图。
示例
开发接入
快速开始
通过统一生成接口提交请求,再使用任务编号查询视频。示例可切换为 cURL、JavaScript 或 Python。
配置访问凭证
在服务端配置 VIDGO_API_KEY,并通过 Authorization 请求头传递 Bearer 凭证。
- 提交地址
- POST
https://api.vidgo.ai/api/generate/submit - 请求鉴权
- Authorization: Bearer VIDGO_API_KEY
提交生成请求
填写 model 与 input,并向生成接口发送 POST 请求;成功后保存返回的 task_id。
REQUEST_BODY=$(cat <<'JSON'
{
"model": "alibaba/wan-2.5/text-to-video",
"input": {
"prompt": "清晨,一辆红色自行车驶过河边石桥。镜头从侧面平稳跟拍,阳光穿过树叶,伴随车轮声与鸟鸣。",
"aspect_ratio": "1280*720",
"duration": 5
}
}
JSON
)
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")
CODE=$(printf '%s' "$RESPONSE" | jq -r '.code // empty')
if [ "$CODE" != "0" ] && [ "$CODE" != "200" ]; then
printf 'API error: %s
' "$RESPONSE" >&2
exit 1
fi
printf '%s
' "$RESPONSE"查询执行状态
使用 task_id 发送 GET 请求,等待状态变为 finished 或 failed。
任务查询
GET https://api.vidgo.ai/api/generate/status/{task_id}将地址中的 {task_id} 替换为提交响应中的编号,使用同一 Bearer 凭证查询。
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "task-wan25-example",
"status": "not_started",
"created_time": "2026-09-27T00:00:00Z"
}
}{
"code": 200,
"data": {
"task_id": "task-unified-...",
"status": "finished",
"files": [
{
"file_url": "https://storage.vidgo.ai/generated/video.mp4",
"file_type": "video"
}
],
"created_time": "2026-08-22T10:00:00Z",
"progress": 100,
"error_message": null
}
}读取视频文件
完成后读取 data.files 中的视频链接;失败时读取 data.error_message 并检查请求。
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "alibaba/wan-2.5/text-to-video",
"input": {
"prompt": "清晨,一辆红色自行车驶过河边石桥。镜头从侧面平稳跟拍,阳光穿过树叶,伴随车轮声与鸟鸣。",
"aspect_ratio": "1280*720",
"duration": 5
}
}
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')
BUSINESS_CODE=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.code // empty')
if [ "$BUSINESS_CODE" != "0" ] && [ "$BUSINESS_CODE" != "200" ]; then
printf 'Submit failed:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
START_TIME=$(date +%s)
POLL_DELAY=2
while true; do
if [ $(( $(date +%s) - START_TIME )) -ge 600 ]; then
printf 'Timed out after 600 seconds
' >&2
exit 1
fi
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')
BUSINESS_CODE=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.code // empty')
if [ "$BUSINESS_CODE" != "0" ] && [ "$BUSINESS_CODE" != "200" ]; then
printf 'Status request failed:
%s
' "$STATUS_RESPONSE" >&2
exit 1
fi
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 "$POLL_DELAY"
if [ "$POLL_DELAY" -lt 10 ]; then POLL_DELAY=$((POLL_DELAY + 1)); fi
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
done请求参数
将以下参数放入请求的 input 对象,model 使用当前页面对应的模型标识。
| 字段 | 类型 | 必填 | 默认值 | 用途与取值 |
|---|---|---|---|---|
| prompt | string | 是 | — | 填写 1–1500 个字符,依次说明主体、场景、动作和运镜,并写出环境声或音乐需求。 |
| aspect_ratio | string | 是 | — | 选择宽*高像素尺寸:832*480、480*832、1280*720、720*1280、1920*1080 或 1080*1920。 |
| duration | integer | 否 | 5 | 选择 5 或 10,单位为秒;默认 5。费用随时长更新。 |
| audio | string | 否 | — | 可选,填入可公开访问的音频文件链接,为视频提供配音或音乐;留空时根据画面生成匹配的声音。 |
| negative_prompt | string | 否 | — | 可选,写出希望排除的画面元素,例如模糊、文字或多余人物。 |
| seed | integer | 否 | — | 可选,填写整数以记录随机种子,便于对照提示词与生成设置。 |
响应字段
提交响应提供任务编号,状态查询响应提供执行状态与视频文件。
| 字段 | 类型 | 用途与取值 |
|---|---|---|
| code | integer | 业务结果码;0 或 200 表示本次请求成功。 |
| data.task_id | string | 本次生成任务的编号,用于后续状态查询。 |
| data.status | string | 任务状态:not_started、running、finished 或 failed。 |
| data.files | array<object> | 完成后的文件列表;读取 file_type 为 video 的条目及其 file_url。 |
| data.error_message | string | null | 任务失败时的错误说明,可据此检查素材或调整请求。 |
任务生命周期
保存提交后获得的 task_id,通过同一编号跟踪任务直至完成或失败。
not_started任务已创建,等待开始处理。
running任务正在处理,继续查询同一任务。
finished任务已完成,从 files 读取视频链接。
failed任务已失败,读取 error_message 并检查输入。
查询与错误处理
- 继续查询同一任务获得 task_id 后,用它查询执行进度;查询遇到网络错误时,重试该任务的状态请求。
- 按字段检查请求校验失败时核对必填字段、类型和枚举;图片链接与音频链接应可公开访问。
- 核对完成响应状态为 finished 时读取视频文件;若缺少 file_url,保留 task_id 和返回数据以便排查。
模型规格
| 规格项 | 取值 | 说明 |
|---|---|---|
| 输入方式 | 文本提示词 | 通过文字描述主体、场景、动作和声音。 |
| 视频时长 | 5 秒 / 10 秒 | 用 duration 选择单个短片的长度,默认 5 秒。 |
| 输出清晰度 | 480p / 720p / 1080p | 通过 aspect_ratio 的六档宽*高像素尺寸选择清晰度与方向。 |
| 音频方式 | 同步生成 / 自定义音频 | 随画面生成匹配声音,或通过 audio 提供可公开访问的音频文件链接。 |
相关模型
Wan 2.5 Text to Video API 常见问题
Wan 2.5 Text to Video API 是什么?
Wan 2.5 Text to Video 是阿里巴巴通义团队用于将文字描述生成视频的模型。它根据场景提示词生成 5 秒或 10 秒短片,支持同步音频、连贯动作与最高 1080p 画质。通过原生音画生成,模型将提示词中的主体、动作和声音线索组织成同一场景,并按描述引导镜头运动。你可以通过 API 进行程序化调用,也可以在上方体验区直接在线试用。
Wan 2.5 Text to Video 能生成同步音频吗?
可以,模型根据提示词和画面生成匹配的声音。将声音与场景动作一起描述,例如车轮声、雨声或轻柔配乐,让画面和声音围绕同一段场景展开。
Wan 2.5 Text to Video 如何使用自定义音频?
在 Audio 中填写可公开访问的音频文件链接,为视频提供现成配音或音乐。提示词同时写清与音频相配的人物、场景和动作,便于围绕录音组织画面。
Wan 2.5 Text to Video 如何引导运镜?
在提示词中直接描述镜头方向与速度,例如“缓慢推近人物面部”或“从侧面平稳跟拍自行车”。将主体动作与镜头动作分开表达,让一个主要镜头运动贯穿短片。
Wan 2.5 Text to Video 能生成 10 秒短片吗?
可以,将 Duration 设为 10;默认值为 5 秒。用 5 秒呈现一个简短动作,用 10 秒给缓慢运镜或较完整的动作过程留出空间。
Wan 2.5 Text to Video 如何选择 1080p?
在 Aspect Ratio 中选择 1920*1080 横向尺寸或 1080*1920 纵向尺寸。该参数填写宽*高像素值,另外四档尺寸对应 480p 与 720p,便于按展示方向和清晰度选型。
Wan 2.5 Text to Video 如何组织场景提示词?
按主体、动作、环境、光线、镜头和声音组织 1–1500 个字符的描述。围绕一个主要事件展开,并写清人物外观或物体特征,让动作与场景线索前后连贯。
Wan 2.5 Text to Video 如何使用负面提示词?
在 Negative Prompt 中写出希望排除的元素,例如模糊、文字或多余人物,同时在 Prompt 中正面描述目标画面。调整时记录 Seed 与其他设置,逐次比较一个变化对结果的影响。















