进阶 docs.leonardo.ai 2026-11-22 15:11:20 · 0 阅读
第56章 Wan 2.7 API 视频生成指南
Wan 2.7
本指南演示如何通过 Leonardo.AI REST API 使用 Wan 2.7 模型生成视频。
示例请求
curl --request POST \
--url https://cloud.leonardo.ai/api/rest/v2/generations \
--header 'accept: application/json' \
--header 'authorization: Bearer ' \
--header 'content-type: application/json' \
--data '
{
"model": "wan-2.7",
"public": false,
"parameters": {
"prompt": "The koala plays with the cat",
"guidances": {
"start_frame": [
{
"image": {
"id": "",
"type": "UPLOADED"
}
}
],
"end_frame": [
{
"image": {
"id": "",
"type": "UPLOADED"
}
}
]
},
"duration": 5,
"width": 1920,
"height": 1080
}
}
'
API 请求端点、请求头与参数
端点
https://cloud.leonardo.ai/api/rest/v2/generations
请求头
--header "accept: application/json" \ --header "authorization: Bearer" \ --header "content-type: application/json"
Body 参数
| 参数 | 类型 | 定义 |
|---|---|---|
| duration | number | 生成视频的时长(秒)。可选值为 2, 3, 4, 5, 6, 7, 8, 9 或 10。默认值为 5。 |
| guidances.end_frame | array | 最大 1 项。每项包含 image.id 和 image.type(GENERATED 或 UPLOADED)。 |
| guidances.image_reference | array | 用于引导视频生成的参考图像。每项包含 image.id、image.type(GENERATED 或 UPLOADED)以及 strength(LOW, MID 或 HIGH;默认 MID)。 |
| guidances.start_frame | array | 最大 1 项。每项包含 image.id 和 image.type(GENERATED 或 UPLOADED)。 |
| guidances.video_reference_base | array | 最大 1 项。作为编辑基础的参考视频。每项包含一个带有 id 和 type(UPLOADED 或 GENERATED)的 video 对象,以及一个可选的项级 type(BASE 或 FEATURE):BASE 路由到 edit-video,FEATURE 路由到 reference-to-video。 |
| height | number | 设置输出视频的高度(像素)。 |
| model | string | 指定生成所用的模型。设置为 wan-2.7。 |
| prompt | string | 生成视频内容的文本描述。最多 2500 个字符。 |
| public | boolean | 控制生成的视频是公开(true)还是私有(false)。 |
| quantity | number | 生成的输出数量。默认值为 1(最大 1)。 |
| resolution | string | 编辑模式下的输出分辨率。设置为 720p 或 1080p。默认值为 1080p。 |
| width | number | 设置输出视频的宽度(像素)。 |
尺寸
API 接受以下宽高比组合的 width 和 height 参数:
| 分辨率 | 宽高比 | 像素值 (宽 x 高) |
|---|---|---|
| 720p | 16:9 (横向) | 1280x720 |
| 1:1 (方形) | 960x960 | |
| 9:16 (纵向) | 720x1280 | |
| 1080p | 16:9 (横向) | 1920x1080 |
| 1:1 (方形) | 1440x1440 | |
| 9:16 (纵向) | 1080x1920 | |
| Auto | — | 0x0 |
更新于 5 个月前 此页面对你有帮助吗?