content 中带参考视频,提示词描述延长部分的内容与运镜,并传 omni_reference_task_type: extend。duration 为新生成片段的时长;输出比例跟随输入视频,ratio 只能为 adaptive,不传时按 adaptive 处理,传其他值返回 400,不扣费。
想直接调试?打开 创建视频生成任务,在请求示例下拉框中选择「视频延长」,填入 API Key 后点击 Try it。
请求示例
示例中的$DREAMTO_API_KEY 为你的 API Key。
curl -X POST "https://api.dreamto.ai/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $DREAMTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5-flash",
"content": [
{
"type": "text",
"text": "延续原片运镜,人物继续向画面右侧走出,光线逐渐转为黄昏"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/clip.mp4"
},
"role": "reference_video"
}
],
"ratio": "adaptive",
"duration": 5,
"resolution": "720p",
"omni_reference_task_type": "extend"
}'
import os
import requests
payload = {
"model": "seedance-2.5-flash",
"content": [
{
"type": "text",
"text": "延续原片运镜,人物继续向画面右侧走出,光线逐渐转为黄昏"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/clip.mp4"
},
"role": "reference_video"
}
],
"ratio": "adaptive",
"duration": 5,
"resolution": "720p",
"omni_reference_task_type": "extend"
}
resp = requests.post(
"https://api.dreamto.ai/api/v3/contents/generations/tasks",
headers={"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"},
json=payload,
timeout=60,
)
print(resp.status_code, resp.json()) # {'id': 'task_...', 'request_id': 'req_...'}
const payload = {
"model": "seedance-2.5-flash",
"content": [
{
"type": "text",
"text": "延续原片运镜,人物继续向画面右侧走出,光线逐渐转为黄昏"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/clip.mp4"
},
"role": "reference_video"
}
],
"ratio": "adaptive",
"duration": 5,
"resolution": "720p",
"omni_reference_task_type": "extend"
};
const resp = await fetch("https://api.dreamto.ai/api/v3/contents/generations/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DREAMTO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(resp.status, await resp.json()); // { id: 'task_...', request_id: 'req_...' }
响应
创建成功返回 HTTP 200。request_id 与响应头 X-Request-Id 相同,排查问题时请提供:
{
"id": "task_8c1d2e3f4a5b6c7d8e9f0a1b",
"request_id": "req_3f9a1c2b7d4e5f60718293a4"
}
id 后,调用 查询任务 轮询结果,status 为 succeeded 时读取 content.video_url。全部请求参数与取值说明见 创建视频生成任务。
