进阶 docs.leonardo.ai 2026-11-22 15:11:20 · 0 阅读
第55章 Wan 2.6 视频生成指南
Wan 2.6
本指南介绍如何通过 Leonardo.AI REST API 使用 Wan 2.6 模型生成视频。
示例请求
curl --request POST \
--url https://cloud.leonardo.ai/api/rest/v2/generations \
--header 'accept: application/json' \
--header 'authorization: Bearer <YOUR_API_KEY>' \
--header 'content-type: application/json' \
--data '
{
"model": "wan-2.6",
"public": false,
"parameters": {
"prompt": "The koala plays with the cat",
"guidances": {
"start_frame": [
{
"image": {
"id": "<YOUR_START_IMAGE_ID>",
"type": "UPLOADED"
}
}
]
},
"duration": 5,
"negative_prompt": "",
"width": 1920,
"height": 1080
}
}'
API 请求端点、头部及参数
端点
https://cloud.leonardo.ai/api/rest/v2/generations
头部
--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"
Body 参数
| 参数 | 类型 | 定义 |
|---|---|---|
| duration | number | 视频时长(秒)。可选 5、10 或 15。默认值为 5。 |
| guidances.audio_reference | array | 最多 1 项。每项包含 audio.id 和 audio.type (UPLOADED)。指定音频参考用于引导。 |
| guidances.start_frame | array | 最多 1 项。每项包含 image.id 和 image.type (INIT, GENERATION, UPLOADED, GENERATED, 或 VARIATION)。 |
| guidances.video_reference_base | array | 最多 3 项。每项包含 video.id 和 video.type (UPLOADED 或 GENERATED)。指定用于编辑的基础视频。 |
| height | number | 设置输出视频的高度(像素)。请参阅“尺寸”了解有效的宽高组合。 |
| model | string | 指定生成使用的模型。设为 wan-2.6。 |
| negative_prompt | string | 描述需在生成视频中避免的内容。最多 500 字符。默认值为 ""。 |
| prompt | string | 描述要生成的视频内容。最多 1500 字符。 |
| public | boolean | 控制生成的视频是否为公开(true)或私有(false)。 |
| quantity | number | 生成输出的数量。设为 1。默认值为 1。 |
| resolution | string | 使用自动尺寸(width: 0, height: 0)进行图生视频时的输出分辨率。有效值为 720p 和 1080p。决定计费等级。默认值为 1080p。 |
| seed | number | 用于可复现生成的随机种子。设置为 0 到 2147483647 之间。 |
| width | number | 设置输出视频的宽度(像素)。请参阅“尺寸”了解有效的宽高组合。 |
尺寸
API 接受以下宽高比组合中的宽度和高度参数:
| 分辨率 | 宽高比 | 像素值 (宽 x 高) |
|---|---|---|
| 720p | 16:9 (横向) | 1280x720 |
| 720p | 4:3 | 960x720 |
| 720p | 1:1 (方形) | 960x960 |
| 720p | 3:4 | 720x960 |
| 720p | 9:16 (纵向) | 720x1280 |
| 1080p | 16:9 (横向) | 1920x1080 |
| 1080p | 4:3 | 1440x1080 |
| 1080p | 1:1 (方形) | 1440x1440 |
| 1080p | 3:4 | 1080x1440 |
| 1080p | 9:16 (纵向) | 1080x1920 |
| Auto | - | 0x0 |
设置 width: 0 和 height: 0 (AUTO) 可让模型推断尺寸;使用 resolution 参数控制输出分辨率等级。
更新于 4 个月前。此页面是否对您有帮助?