文生视频:根据文本提示词创建视频生成任务
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data '
{
"model": "wan2.7-t2v",
"input": {
"prompt": "黄昏海边的灯塔,镜头缓慢推进,海浪轻拍礁石,海鸟叫声,电影级光影,稳定运镜"
}
}
'{
"output": {
"task_id": "c2e7570c-0af2-4eba-919f-3af3d1164a38",
"task_status": "PENDING"
},
"request_id": "a23b81b0-0c05-9972-a6c9-ee757400afdb"
}Wan2.7 视频生成(阿里云)
Wan2.7 文生视频 API 参考
Wan2.7-t2v 文生视频 API 参考与在线调试:纯文本提示词生成 2–15 秒视频,DashScope 异步透传端点。
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
文生视频:根据文本提示词创建视频生成任务
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data '
{
"model": "wan2.7-t2v",
"input": {
"prompt": "黄昏海边的灯塔,镜头缓慢推进,海浪轻拍礁石,海鸟叫声,电影级光影,稳定运镜"
}
}
'{
"output": {
"task_id": "c2e7570c-0af2-4eba-919f-3af3d1164a38",
"task_status": "PENDING"
},
"request_id": "a23b81b0-0c05-9972-a6c9-ee757400afdb"
}Documentation Index
Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
Use this file to discover all available pages before exploring further.
右侧 Playground 可直接调试:在 Authorization 填
Bearer sk-your-api-key,填好 model / input / parameters 后发起请求。提交成功会返回 task_id,后续轮询与下载见下方说明。- 创建请求必须走
/wan/api/v1/services/aigc/video-generation/video-synthesis并带请求头X-DashScope-Async: enable,不要用/v1/videos。 duration必须是 整数(5不是"5");resolution写 大写720P。
代码示例
curl -X POST "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis" \
-H "X-DashScope-Async: enable" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-t2v",
"input": {
"prompt": "黄昏海边的灯塔,镜头缓慢推进,海浪轻拍礁石,海鸟叫声,电影级光影,稳定运镜"
},
"parameters": {
"resolution": "720P",
"duration": 5,
"prompt_extend": true,
"watermark": true
}
}'
参数说明速查
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
model | string | ✓ | — | 固定 wan2.7-t2v |
input.prompt | string | ✓ | — | 文本提示词,建议描述场景、镜头运动、光线、风格 |
input.negative_prompt | string | — | 反向提示词,≤500 字符 | |
parameters.resolution | string | 720P | 720P / 1080P(大写) | |
parameters.ratio | string | 16:9 | 16:9 / 9:16 / 1:1 / 4:3 / 3:4 | |
parameters.duration | int | 5 | 2–15 秒整数 | |
parameters.prompt_extend | bool | true | 智能改写,推荐开启 | |
parameters.watermark | bool | false | 右下角「AI 生成」水印 | |
parameters.seed | int | 随机 | 0–2147483647,固定可复现 |
响应格式
创建成功返回task_id(不是视频本身):
{
"output": { "task_id": "c2e7570c-0af2-4eba-919f-3af3d1164a38", "task_status": "PENDING" },
"request_id": "a23b81b0-0c05-9972-a6c9-ee757400afdb"
}
提交后需 轮询
GET /v1/tasks/{task_id} 直到 status: "completed",再从响应的 result_url 下载 mp4。下载时 不要带 Authorization 头(OSS 签名直链),result_url 默认 24 小时过期。完整轮询循环与 Python 客户端见 Wan 概览 · 异步调用流程。授权
在 API易控制台获取的 API Key
请求头
异步处理开关,必须设置为 enable,否则报 current user api does not support synchronous calls
可用选项:
enable 请求体
application/json
此页面对您有帮助吗?
⌘I