role 传 reference_image(最多 9 张),按出现顺序编号为「图片1」「图片2」…,在提示词中用 [图片N] 指明各自的用途。
想直接调试?打开 创建视频生成任务,在请求示例下拉框中选择「多图参考生视频」,填入 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": "[图片1]戴着眼镜穿着蓝色T恤的男生和[图片2]的柯基小狗,坐在[图片3]的草坪上,视频卡通风格"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/boy.png"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/dog.png"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/grass.png"
},
"role": "reference_image"
}
],
"ratio": "16:9",
"duration": 5,
"resolution": "720p"
}'
import os
import requests
payload = {
"model": "seedance-2.5-flash",
"content": [
{
"type": "text",
"text": "[图片1]戴着眼镜穿着蓝色T恤的男生和[图片2]的柯基小狗,坐在[图片3]的草坪上,视频卡通风格"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/boy.png"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/dog.png"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/grass.png"
},
"role": "reference_image"
}
],
"ratio": "16:9",
"duration": 5,
"resolution": "720p"
}
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": "[图片1]戴着眼镜穿着蓝色T恤的男生和[图片2]的柯基小狗,坐在[图片3]的草坪上,视频卡通风格"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/boy.png"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/dog.png"
},
"role": "reference_image"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/grass.png"
},
"role": "reference_image"
}
],
"ratio": "16:9",
"duration": 5,
"resolution": "720p"
};
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。全部请求参数与取值说明见 创建视频生成任务。
