创建 Wan 视频
通过 CometAPI 使用文本、参考媒体或首尾帧创建 Wan 视频,然后轮询任务并下载 MP4 文件。
id,以便轮询任务并下载已完成的视频。
POST /v1/videos 使用 multipart/form-data。请以 seconds 的形式发送明确的整数值,并以 size 的 WxH 格式发送。
选择输入模式
每种模式都需要model 和 prompt。可用的媒体输入取决于模型:
使用参考图像
对于wan2.7、wan3.0 和 wan3.0-prime,请通过 input_reference 以可公开访问的 HTTPS URL 或上传文件的形式发送参考图像。
对于多张图像,请按图像顺序重复该字段,每个字段提供一个 URL 或文件。
在 input_reference 中使用全部 URL 或全部文件。请分别发送每个 URL,而不要将多个 URL 合并为逗号分隔的值。
使用每张最大 20 MB 的 PNG 或 JPEG 图像。
单个 input_reference URL 或文件将使用图像生成视频工作流。该图像会引导构图和外观;请使用 Prompt 描述运动和摄像机行为。
对于 wan3.0 和 wan3.0-prime,无论使用 URL 还是上传文件,均最多通过 input_reference 发送 10 张参考图像。
使用参考视频和音频
通过reference_videos 发送视频,并通过 reference_audios 发送音频片段;每个输入均需重复传入相应字段一次。
每个输入都可以是可公开访问的 HTTPS URL 或上传的文件。
视频参考请使用包含 H.264 编码视频的 MP4 文件。音频参考请使用单独的 MP3 文件。
不同字段可以使用不同的输入类型,例如将图片 URL 与上传的视频搭配使用。在 reference_videos 或 reference_audios 中,请全部使用 URL 或全部使用文件。
最多可上传五个视频文件,每个最大为 50 MiB(50 × 1024 × 1024 字节).
最多可上传五个音频文件,每个最大为 15 MiB(15 × 1024 × 1024 字节).
Wan 2.6 视频参考
发送一到三个reference_videos,每个时长为 2–30 秒,大小不超过 30 MB,且帧率至少为 16 fps。
这些限制同时适用于 URL 和上传的视频。在 Prompt 中,按照输入顺序将主体称为 @Video1、@Video2 和 @Video3。
在此模式下,省略 input_reference、reference_audios、first_frame 和 last_frame。将 seconds 设置为 5 或 10。
以下示例根据两个视频参考创建一个五秒视频。请将媒体 URL 或文件名替换为你的输入:
Wan 2.7 图片和视频参考
结合图片和视频参考来引导主体外观和动作。将seconds 设置为从 2 到 10 的整数。省略 reference_audios。
使用两个图片 URL 或两张上传的图片,并搭配一个视频参考:
Wan 3.0 图片、视频和音频参考
对于wan3.0 和 wan3.0-prime,结合图片和视频参考以及音频参考,以引导外观、动作和节奏。
最多发送五个视频参考,总时长不超过 15 秒。每个视频的帧率必须至少为 16 fps。
最多发送五个音频参考,总时长不超过 15 秒。视频和音频时长分别计算。
将输出 seconds 设置为从 2 到 30 的整数。
使用两个图片 URL 或两张上传的图片,并搭配一个视频和两个音频片段:
使用首帧和尾帧
对于wan2.7、wan3.0 和 wan3.0-prime,为起始图像发送 first_frame,并可选地为结束图像发送 last_frame。
每个字段都接受一个可公开访问的 HTTPS PNG 或 JPEG URL,或者一个已上传的 PNG 或 JPEG 文件。
对于 Wan 2.7 帧输入,起始图像决定宽高比,而 size 选择输出分辨率级别。
请将帧输入与 input_reference、reference_videos 和 reference_audios 分开提交请求。
以下 Wan 2.7 示例会在起始帧和结束帧之间创建过渡:
设置时长和尺寸
将seconds 作为整数发送,其值须在适用于你的模型和输入模式的范围内。
size 设置为适用于目标模型的以下 WxH 值之一。
Wan 3.0 的尺寸值也适用于 wan3.0-prime。
Wan 3.0 尺寸值
Wan 2.7 尺寸值
Wan 2.6 尺寸值
任务流程
创建任务
id。轮询任务
status 为 completed、failed 或 error。下载结果
completed 时,调用 检索 Wan 视频内容 以下载 MP4 文件。授权
Bearer authentication. Use your CometAPI API key.
请求体
Wan model ID: wan2.6, wan2.7, wan3.0, or wan3.0-prime. Use wan2.6 for text or reference-video input. Use wan2.7 for text, image/video references, or frame inputs. Use wan3.0 or wan3.0-prime to also include reference audio.
"wan3.0"
Text prompt that describes the video to generate. Describe the appearance and motion to preserve from references, or the transition between first_frame and last_frame. For wan2.6 video references, use @Video1, @Video2, and @Video3 in input order.
"A small robot walks through a bright greenhouse with smooth camera movement."
Requested output duration in whole seconds. Send an explicit integer. For wan2.6 reference-to-video, use 5 or 10; text-to-video also accepts 15. For wan2.7 reference-to-video, use 2 through 10; text and frame inputs accept 2 through 15. For wan3.0 and wan3.0-prime, use 2 through 30. Default is 5.
2 <= x <= 305
Supported WxH size values. For wan3.0 and wan3.0-prime: 832x480, 480x832, 624x624, 640x480, 480x640, 1280x720, 720x1280, 960x960, 1088x832, 832x1088, 1920x1080, 1080x1920, 1440x1440, 1632x1248, 1248x1632. For wan2.6: 1280x720, 720x1280, 1088x832, 832x1088, 1920x1080, 1080x1920, 1440x1440, 1632x1248, 1248x1632. For wan2.7: 1280x720, 720x1280, 1920x1080, 1080x1920, 1440x1440. Default is 1920x1080. For Wan 2.7 frame inputs, the opening image determines the aspect ratio; size selects the output resolution tier.
"1920x1080"
PNG or JPEG reference images for wan2.7, wan3.0, and wan3.0-prime. Repeat input_reference with one publicly accessible HTTPS image URL or uploaded image file per field. Use all URLs or all files within this field. Do not combine URLs into a comma-separated value. A single URL or file uses the image-to-video workflow. Each image can be up to 20 MB. For wan3.0 and wan3.0-prime, send at most 10 reference images, whether you use URLs or uploaded files. Image and video references can share a request; reference audio requires wan3.0 or wan3.0-prime. Submit frame inputs separately. Omit for text-to-video and wan2.6 reference-to-video. Submit images in the order you want to reference them in the prompt.
^https://Reference videos for wan2.6, wan2.7, wan3.0, and wan3.0-prime. Repeat reference_videos with publicly accessible HTTPS URLs or uploaded MP4 files with H.264 video. Use one input type within this field: all URLs or all files. For wan2.6, send 1 to 3 clips, each 2 to 30 seconds and up to 30 MB, with at least 16 fps; omit image, audio, and frame fields. For wan2.7, combine video references with image references. For wan3.0 and wan3.0-prime, send at most 5 clips totaling at most 15 seconds, with at least 16 fps. Video uploads are limited to 5 files, each at most 50 MiB (50 x 1024 x 1024 bytes); the lower wan2.6 limits still apply. Submit frame inputs separately.
1^https://Reference audio for wan3.0 and wan3.0-prime, combined with image or video references. Repeat reference_audios with publicly accessible HTTPS MP3 URLs or uploaded MP3 files. Use one input type within this field: all URLs or all files. Send at most 5 audio references totaling at most 15 seconds, counted separately from reference video duration. Audio uploads are limited to 5 files, each at most 15 MiB (15 x 1024 x 1024 bytes). Submit frame inputs separately. Omit for wan2.6 and wan2.7.
1^https://Opening frame for wan2.7, wan3.0, and wan3.0-prime, as one publicly accessible HTTPS PNG or JPEG URL or one uploaded PNG or JPEG file. Use first_frame alone or add last_frame to guide the ending. Submit frame inputs in a separate request from input_reference, reference_videos, and reference_audios. Omit for wan2.6. For Wan 2.7 frame inputs, the opening image determines the aspect ratio; size selects the output resolution tier.
^https://Ending frame for wan2.7, wan3.0, and wan3.0-prime, as one publicly accessible HTTPS PNG or JPEG URL or one uploaded PNG or JPEG file. Use with first_frame to guide the ending. Submit frame inputs in a separate request from input_reference, reference_videos, and reference_audios. Omit for wan2.6. For Wan 2.7 frame inputs, the opening image determines the aspect ratio; size selects the output resolution tier.
^https://响应
Task created. Store the returned id and poll GET /v1/videos/{task_id}.
Task ID. Use this value with retrieve and content endpoints.
"task_example"
Object type. Video tasks return video.
"video"
Model ID used for the task.
"wan3.0"
Task lifecycle status. Poll until the value is completed, failed, or error.
queued, in_progress, completed, failed, error "queued"
Task progress as a coarse percentage.
0 <= x <= 1000
Task creation time as a Unix timestamp in seconds.
1779938152
Compatibility alias for id when present.
"task_example"
Task completion time as a Unix timestamp in seconds. This field appears on completed tasks.
1779938219
Temporary video delivery URL. This field appears on completed tasks.
"<temporary-video-url>"
Failure details. This field appears when the task fails.