参考生视频
阿里百炼参考生视频接口,用于通过文本和参考素材生成多角色互动视频。
概览
- 请求方法:
POST - 请求路径:
/task/bailian/ref2video - 内容类型:
application/json - 分类:视频模型(Video)/阿里百炼
认证方式
- Header:
Authorization: Bearer <token>
请求参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型名称,支持 wan2.6-r2v-flash、wan2.6-r2v |
| input.prompt | string | 是 | 文本提示词,描述视频期望元素和视觉特点,支持角色引用例如 character1、character2 |
| input.reference_urls | array[string] | 是 | 参考素材 URL 数组,支持视频和图像,最多 5 个参考文件 |
| input.negative_prompt | string | 否 | 反向提示词,描述不希望出现在视频中的内容 |
| parameters.duration | integer | 否 | 视频时长(秒),wan2.6-r2v-flash 和 wan2.6-r2v 支持 2~10 秒,默认 5 秒 |
| parameters.shot_type | string | 否 | 镜头类型,single 或 multi,影响视频镜头组织方式 |
| parameters.seed | integer | 否 | 随机种子,范围 [0, 2147483647] |
| parameters.audio | boolean | 否 | 是否生成有声视频,音频会影响费用 |
| parameters.size | string | 是 | 视频分辨率,格式为宽*高,默认 1920*1080,具体可选值依赖模型 |
请求示例
curl 示例
bash
curl -X POST "https://api.gpt.ge/task/bailian/ref2video" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YOUR_TOKEN" \
-d '{
"model": "wan2.6-r2v-flash",
"input": {
"prompt": "Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对 Character2 说道:听起来不错",
"reference_urls": [
"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4",
"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4",
"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png",
"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
]
},
"parameters": {
"size": "1280*720",
"duration": 10,
"audio": true,
"shot_type": "multi"
}
}'JavaScript (fetch) 示例
javascript
fetch('https://api.gpt.ge/task/bailian/ref2video', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({
model: 'wan2.6-r2v-flash',
input: {
prompt: 'Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对 Character2 说道:听起来不错',
reference_urls: [
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4',
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4',
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png',
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png'
]
},
parameters: {
size: '1280*720',
duration: 10,
audio: true,
shot_type: 'multi'
}
})
})
.then(res => res.json())
.then(console.log)Python 示例(requests)
python
import requests
payload = {
'model': 'wan2.6-r2v-flash',
'input': {
'prompt': 'Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对 Character2 说道:听起来不错',
'reference_urls': [
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4',
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4',
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png',
'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png'
]
},
'parameters': {
'size': '1280*720',
'duration': 10,
'audio': True,
'shot_type': 'multi'
}
}
resp = requests.post(
'https://api.gpt.ge/task/bailian/ref2video',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
json=payload
)
print(resp.json())返回字段说明
| 字段 | 类型 | 描述 |
|---|---|---|
| request_id | string | 请求 ID |
| output | object | 输出任务信息 |
| output.task_id | string | 任务 ID |
| output.task_status | string | 任务状态 |
返回示例(200)
json
{
"request_id": "9f829e8a-6db3-4998-8515-134223f0fc11",
"output": {
"task_id": "ac22cbc8-3fb3-45b6-9091-d8a7b41650bc",
"task_status": "PENDING"
}
}