万相2.7-参考生视频API
更新时间 2026-09-07 09:15:03
最近更新时间: 2026-09-07 09:15:03
文本介绍万相2.7‑参考生视频模型调用API。
调用流程
接口采用异步任务模式,分两步执行:
step1:调用创建任务接口,成功返回task_id
step2:调用查询任务接口查询对应task_id,直到task_status值为SUCCEEDED,获取生成视频url
创建任务接口详情
http调用
请求方式:POST
请求路径:https://ai.ctaigw.cn/v1/services/aigc/video-generation/video-synthesis
请求头
| 参数 | 必填 | 说明 |
|---|---|---|
| Content‑Type | 是 | 固定application/json |
| Authorization | 是 | Bearer ${YOUR_APP_KEY} |
| X‑DashScope‑Async | 是 | 必须enable |
请求参数
| 一级字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型调用名称或模型ID |
| input | object | 是 | 输入主体对象 |
| input.prompt | string | 是 | 文本提示词 中文用图1、视频1;英文用Image 1、Video 1引用 media 素材;单素材可简写「参考图片 / 参考视频」 |
| input.negative_prompt | string | 否 | 反向提示词 |
| input.media | array | 是 | 参考素材数组,参考图像 + 参考视频总数≤5; 至少传入 1 个参考图 / 参考视频;首帧图最多 1 张 |
| input.media[].type | string | 是 | 素材类型: - reference_image参考图 - reference_video参考视频 - first_frame首帧图 |
| input.media[].url | string | 是 | 素材地址 |
| input.media[].reference_voice | string | 否 | 单素材独立音色参考音频 url; 优先级高于 reference_video 自带音频 |
| parameters | object | 否 | 视频生成参数 |
| resolution | string | 否 | 分辨率档位,否720P、1080P; 默认1080P;影响计费 |
| ratio | string | 否 | 宽高比:16:9/9:16/1:1/4:3/3:4; 传入 first_frame 首帧图后该参数自动失效 |
| duration | integer | 否 | 输出视频时长 |
| prompt_extend | boolean | 否 | 是否开启 prompt 智能扩写 |
| watermark | boolean | 否 | 是否添加水印标识,水印位于视频右下角,文案固定为“AI生成”。 - false:默认值,不添加水印。 - true:添加水印。 |
| seed | integer | 否 | 随机种子 [0,2147483647]; 相同 seed 结果倾向稳定,但不能保证完全一致 |
响应参数
| 参数 | 类型 | 说明 |
|---|---|---|
| request_id | string | 请求唯一标识,用于问题排查溯源 |
| output | object | 任务输出主体 |
| output.task_id | string | 查询的任务 ID |
| output.task_status | string | 任务状态 - PENDING:任务排队中 - RUNNING:任务处理中 - SUCCEEDED:任务执行成功 - FAILED:任务执行失败 - CANCELED:任务已取消 - UNKNOWN:任务不存在或状态未知 |
查询任务接口详情
http调用
请求方式:GET
请求路径:https://ai.ctaigw.cn/v1/tasks/{task_id}
Path 路径参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| task_id | string | 是 | 创建异步任务接口返回的任务 ID |
请求头
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | 身份认证,格式:Bearer ${YOUR_APP_KEY} |
响应参数
| 参数 | 类型 | 说明 |
|---|---|---|
| request_id | string | 请求唯一标识,用于问题排查溯源 |
| output | object | 任务输出主体 |
| output.task_id | string | 查询的任务 ID |
| output.task_status | string | 任务状态 - PENDING:任务排队中 - RUNNING:任务处理中 - SUCCEEDED:任务执行成功 - FAILED:任务执行失败 - CANCELED:任务已取消 - UNKNOWN:任务不存在或状态未知 |
| output.submit_time | string | 任务提交时间,格式YYYY‑MM‑DD HH:mm:ss.SSS |
| output.scheduled_time | string | 任务调度执行时间 |
| output.end_time | string | 任务结束时间;任务未结束为空 |
| output.video_url | string | 视频URL。仅在 task_status 为 SUCCEEDED 时返回 |
| output.orig_prompt | string | 原始输入的prompt,对应请求参数prompt |
| output.actual_prompt | string | 当 prompt_extend=true 时,系统会对输入 prompt 进行智能改写,此字段返回实际用于生成的优化后 prompt。 - 若 prompt_extend=false,该字段不会返回。 - 注意:wan2.6 模型无论 prompt_extend 取值如何,均不返回此字段。 |
| usage | object | 用量统计,仅任务成功返回 |
| usage.input_video_duration | integer | 输入的视频的时长,单位秒 |
| usage.output_video_duration | integer | 输出视频的时长,单位秒 其值等同于 input.duration 的入参值。 |
| usage.duration | integer | 总的视频时长,用于计费。 等于 input_video_duration +output_video_duration。 |
| usage.SR | integer | 生成视频的分辨率档位。示例值:720。 |
| usage.video_count | integer | 生成视频的数量。固定为 1。 |
| usage.ratio | string | 生成视频的宽高比。示例值:16:9 |
请求/响应示例
参考生视频创建任务
请求
curl --location 'https://ai.ctaigw.cn/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer ${YOUR_APP_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.7-r2v",
"input": {
"prompt": "视频1抱着图3,在图4的椅子上弹奏一支舒缓的乡村民谣,并说道:“今天的阳光真好。”图1手中拿着图2,路过视频1,把手中的图2放到视频1旁边的桌子上,并说道:“真好听,能不能再唱一遍”。",
"media": [
{
"type": "reference_image",
"url": "https://aaaa.ctyun.cn/pic/001.jpg",
"reference_voice": "https://aaaa.ctyun.cn/wan-r2v-girl-voice.mp3"
},
{
"type": "reference_video",
"url": "https://aaaa.ctyun.cn/wan-r2v-role2.mp4",
"reference_voice": "https://aaaa.ctyun.cn/wan-r2v-boy-voice.mp3"
},
{
"type": "reference_image",
"url": "https://aaaa.ctyun.cn/wan-r2v-object3.png"
},
{
"type": "reference_image",
"url": "https://aaaa.ctyun.cn/wan-r2v-object4.png"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 10,
"prompt_extend": false,
"watermark": true
}
}'正常响应
{
"output": {
"task_status": "PENDING",
"task_id": "xxxx‑xxxx‑xxxx‑xxxx"
},
"request_id": "00d06a841873c0a83bfaf1fae0184625"
}异常响应示例
{
"error": {
"type:": "Invalid_request",
"code": "missing_parameter",
"message": "Missing required parameters"
}
}查询任务请求示例
请求
curl -X GET https://ai.ctaigw.cn/v1/tasks/{task_id} \
--header "Authorization: Bearer ${YOUR_APP_KEY}"正常响应示例
{
"request_id": "00d06a841873c0a83bfaf1fae0184625",
"output": {
"task_id": "xxxx‑xxxx‑xxxx‑xxxx",
"task_status": "SUCCEEDED",
"submit_time": "2026-08-26 12:10:05.001",
"scheduled_time": "2026-08-26 12:10:05.201",
"end_time": "2026-08-26 12:10:25.001",
"orig_prompt": "视频1抱着图3在椅子上弹奏民谣……",
"video_url": "https://xxx/xxx.mp4"
},
"usage": {
"duration": 15,
"input_video_duration": 5,
"output_video_duration": 10,
"SR": 720,
"ratio": "16:9",
"video_count": 1
}
}