> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 视频延长

> 延续参考视频继续生成后续画面。

同样在 `content` 中带参考视频，提示词描述延长部分的内容与运镜，并传 `omni_reference_task_type: extend`。`duration` 为新生成片段的时长；输出比例跟随输入视频，`ratio` 只能为 `adaptive`，不传时按 `adaptive` 处理，传其他值返回 400，不扣费。

> [!TIP]
>
> 想直接调试？打开 [创建视频生成任务](https://docs.dreamto.ai/api-reference/seedance-2-5-flash/create-task.md)，在请求示例下拉框中选择「视频延长」，填入 API Key 后点击 **Try it**。

## 请求示例

示例中的 `$DREAMTO_API_KEY` 为你的 API Key。

```bash cURL theme={null}
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"
  }'
```

```python Python theme={null}
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_...'}
```

```javascript Node.js theme={null}
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` 相同，排查问题时请提供：

```json theme={null}
{
  "id": "task_8c1d2e3f4a5b6c7d8e9f0a1b",
  "request_id": "req_3f9a1c2b7d4e5f60718293a4"
}
```

拿到任务 `id` 后，调用 [查询任务](https://docs.dreamto.ai/api-reference/seedance-2-5-flash/get-task.md) 轮询结果，`status` 为 `succeeded` 时读取 `content.video_url`。全部请求参数与取值说明见 [创建视频生成任务](https://docs.dreamto.ai/api-reference/seedance-2-5-flash/create-task.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.