One continuous five-second low water-level camera push through a large natural sea arch. A single turquoise swell enters a shadowed basalt sea cave and curls into white foam around the rocks while sunlight glows through the arch ahead. Keep the arch geometry fixed and the water physically coherent. Gradual forward motion, no cuts. Natural surf ambience. No text, lettering, captions, logos, watermarks, brands, advertising or product packaging.
Wan 2.7 Text to Video API
alibaba/wan-2.7/text-to-videoWan 2.7 Text to Video 将文本提示词转化为 5–15 秒 720p 与 1080p 高清视频,具备 Thinking Mode 提示词深度推理、原生音视频同步与高保真物理运动模拟。它在支持多种画幅比例的同时严格遵循叙事细节,保持复杂光影与连贯镜头运动的时间一致性。
拖拽文件、粘贴剪贴板素材,或输入 URL。
示例
REST API 规格
快速开始
提交任务并查询状态。
第一步:配置 API 鉴权
在控制台创建 API Key,提交请求时附带 Authorization: Bearer <API_KEY>。
- 任务提交端点
- POST
https://api.vidgo.ai/api/generate/submit - 鉴权请求头
- Authorization: Bearer VIDGO_API_KEY
第 2 步:提交任务
POST /api/generate/submit · alibaba/wan-2.7/text-to-video
REQUEST_BODY=$(cat <<'JSON'
{
"model": "alibaba/wan-2.7/text-to-video",
"input": {
"resolution": "720p",
"duration": 5,
"prompt": "Describe the scene or edit",
"aspect_ratio": "16:9"
}
}
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 查询进度;not_started 或 running 时继续轮询,finished 或 failed 时停止。成功后读取 data.files[].file_url,失败时读取 data.error_message。
状态查询端点
GET https://api.vidgo.ai/api/generate/status/{task_id}使用 task_id 查询进度;not_started 或 running 时继续轮询,finished 或 failed 时停止。成功后读取 data.files[].file_url,失败时读取 data.error_message。
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "task-example",
"status": "running",
"created_time": "2026-09-21T08: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
}
}端到端完整脚本示例
展开查看在生产环境中具备轮询重试、异常保护和超时处理的完整自动化脚本。
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "alibaba/wan-2.7/text-to-video",
"input": {
"resolution": "720p",
"duration": 5,
"prompt": "Describe the scene or edit",
"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')
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 对象)
向 /api/generate/submit 提交 POST 请求时,input 内部所支持的生成参数配置:
| 字段 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| prompt | string | 是 | — | 提示词去除首尾空格后最多 5,000 字符;图生视频可不填。 |
| audio_url | string | 否 | — | 可选的公开 HTTP(S) 音频地址。 |
| aspect_ratio | string | 否 | 16:9 | 16:9、9:16、1:1、4:3 或 3:4,默认 16:9。 |
| resolution | string | 否 | 720p | 720p 或 1080p,默认 720p。 |
| duration | integer | 否 | 5 | 5、10 或 15 秒,默认 5 秒。 |
| seed | integer | 否 | — | 可选整数,范围为 0–2147483647。 |
| enable_safety_checker | boolean | 否 | — | 可选安全检查设置,默认不传。 |
响应字段(查询结果)
通过 GET /api/generate/status/{task_id} 轮询获取的任务详情:
| 字段 | 类型 | 描述 |
|---|---|---|
| code | integer | 业务响应状态码,200 表示成功。 |
| data.task_id | string | 异步任务全局唯一流水号。 |
| data.status | string | 任务执行阶段:not_started(排队中)、running(生成中)、finished(已完成)、failed(失败)。 |
| data.files | array | 生成成功时包含的成片文件列表,每项含 file_url 与 file_type。 |
| data.error_message | string | null | 任务执行异常时的具体错误描述。 |
任务生命周期
客户端应根据 status 字段判断任务进度,达到 finished 或 failed 终态时立即终止轮询:
not_started排队中
running生成中
finished已就绪
failed失败
轮询与异常处理
- 轮询频次推荐建议初始轮询间隔设为 2–3 秒,随着任务持续可递增至 5 秒一次,避免过密请求。
- 网络波动与重试若查询网络出现 5xx 或连接超时,不代表任务失败,可稍作休眠后继续重试查询。
- 异步 Webhook 回调支持在提交请求体根层级传递 callback_url,在任务终态时系统将通过 POST 自动推送完整任务结果。
接口规格
| 规格项 | 取值 | 说明 |
|---|---|---|
| 模型 | alibaba/wan-2.7/text-to-video | |
| 分辨率 | 720p / 1080p | 默认 720p |
| 时长 | 5、10 或 15 秒,默认 5 秒。 |
Wan 2.7 Text to Video API 常见问题
Wan 2.7 Text to Video API 是什么?
Wan 2.7 Text to Video 是阿里通义实验室研发的文本生成视频模型。它根据文本提示词直接生成 5 至 15 秒 720p 或 1080p 高清视频,具备 Thinking Mode 提示词深度推理、伴随音频协同以及高保真物理运动模拟能力。基于 Diffusion Transformer 骨干网络与 Wan-VAE 3D 因果时空压缩架构,它在严格遵循复杂叙事指令的同时呈现连贯平滑的运镜轨迹与时间一致性。你可以通过 API 进行程序化调用,也可以在上方体验区直接在线试用。
Wan 2.7 Text to Video 单次可以生成多长时长的视频?
Wan 2.7 Text to Video 支持 5 秒、10 秒和 15 秒三个离散的时长档位。你可以在提交请求时按需传入对应的 duration 整数,系统将根据所选时长精确计费并生成完整镜头。
Wan 2.7 Text to Video 支持同步音频生成吗?
Wan 2.7 Text to Video 支持通过传入 audio_url 参数接入伴随音频。提供公开可访问的音频文件链接后,模型在生成视频画面时能够协同参考音频节奏,呈现视听统一的动态效果。
Wan 2.7 Text to Video 支持哪些输出分辨率?
Wan 2.7 Text to Video 支持 720p 与 1080p 两种原生分辨率。默认档位为 720p(12 积分/秒),若需用于大屏展示或商业级精细渲染,可指定为 1080p(18 积分/秒)。
Wan 2.7 Text to Video 支持哪些画幅比例?
Wan 2.7 Text to Video 支持 5 种原生画幅比例:16:9 横屏、9:16 竖屏、1:1 正方形以及 4:3 与 3:4。模型根据指定比例原生生成构图,无需后期黑边填充或画质裁切。
Thinking Mode 如何提升 Wan 2.7 Text to Video 的生成效果?
Thinking Mode 赋予模型在生成视频前进行多步语义推理的能力。它能够深入剖析复杂长提示词中的空间逻辑、主体间相对位置与动作前后衔接,显著减少物体形变并增强真实物理运动规律。
Wan 2.7 Text to Video 任务失败时如何计费?
系统在任务提交时根据设定的时长与分辨率费率预扣积分。如果任务在参数校验、媒体加载或生成过程中出现异常导致失败,系统会自动将预扣积分全额返还至你的账户。