Создание видео Wan
Создайте видео Wan из текста, референсных медиафайлов или первого и последнего кадров через CometAPI, затем опросите задачу и скачайте файл MP4.
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F model=wan3.0 \
-F 'prompt=A small robot walks through a bright greenhouse with smooth camera movement.' \
-F seconds=5 \
-F size=1920x1080{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "wan3.0",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}id, чтобы опрашивать задачу и скачать готовое видео.
POST /v1/videos использует multipart/form-data. Передайте явное целочисленное значение seconds и size в форме WxH.
wan3.0-prime использует те же общедоступные поля запроса, ограничения для медиафайлов и процесс работы с задачами, что и wan3.0. При использовании Prime задайте для model точное значение wan3.0-prime. Prime поддерживает преобразование текста в видео, изображения в видео, входные данные первого и последнего кадров, а также комбинированные ссылки на изображения, видео и аудио. Референсные медиафайлы и входные данные кадров необходимо отправлять отдельными запросами.
Выберите режим ввода
Для каждого режима требуютсяmodel и prompt. Доступные входные медиафайлы зависят от модели:
| Цель | Идентификаторы моделей | Поля медиафайлов |
|---|---|---|
| Преобразование текста в видео | wan2.6, wan2.7, wan3.0, wan3.0-prime | Не указывайте поля медиафайлов |
| Преобразование изображения в видео | wan2.7, wan3.0, wan3.0-prime | input_reference URL-адреса или загруженные файлы изображений |
| Референсное видео | wan2.6 | reference_videos только |
| Ссылки на изображения и видео | wan2.7, wan3.0, wan3.0-prime | input_reference с reference_videos |
| Ссылки на изображения, видео и аудио | wan3.0, wan3.0-prime | Ссылки на изображения и видео с reference_audios |
| Первый и последний кадры | wan2.7, wan3.0, wan3.0-prime | first_frame, при необходимости last_frame |
Создание видео Wan 3.0 Prime
Этот минимальный запрос создаёт пятисекундную задачу преобразования текста в видео с Prime:prompt='A small robot walks through a bright greenhouse '
prompt+='with smooth camera movement.'
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0-prime' \
--form-string "prompt=$prompt" \
-F 'seconds=5' \
-F 'size=1920x1080'
Использование референсных изображений
Дляwan2.7, wan3.0 и wan3.0-prime отправляйте референсные изображения через input_reference как общедоступные HTTPS URL-адреса или загруженные файлы.
Для нескольких изображений повторяйте поле в порядке изображений, указывая один URL-адрес или файл в каждом поле.
Используйте только URL-адреса или только файлы в пределах input_reference. Отправляйте каждый URL-адрес отдельно, а не объединяйте URL-адреса в значение, разделённое запятыми.
Используйте изображения PNG или JPEG размером до 20 МБ каждое.
Один URL-адрес или файл input_reference использует процесс преобразования изображения в видео. Изображение определяет композицию и внешний вид; используйте Prompt для описания движения и поведения камеры.
Для wan3.0 и wan3.0-prime отправляйте не более 10 референсных изображений через input_reference, независимо от того, используете ли вы URL-адреса или загруженные файлы.
Использование эталонных видео и аудио
Передавайте видео черезreference_videos, а аудиоклипы — через reference_audios, повторяя каждое поле для каждого входного файла.
Каждый входной файл может быть общедоступным HTTPS URL или загруженным файлом.
Для эталонных видео используйте файлы MP4 с видео в кодировке H.264. Для эталонных аудио используйте отдельные файлы 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-адреса медиафайлов или имена файлов своими входными данными:
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan2.6' \
--form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'reference_videos=https://your-media-host/reference-1.mp4' \
-F 'reference_videos=https://your-media-host/reference-2.mp4'
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan2.6' \
--form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'reference_videos=@reference-1.mp4;type=video/mp4' \
-F 'reference_videos=@reference-2.mp4;type=video/mp4'
Эталонные изображения и видео Wan 2.7
Сочетайте эталонные изображения и видео, чтобы управлять внешним видом и движением объекта. Установитеseconds в целое число от 2 до 10. Не указывайте reference_audios.
Используйте два URL изображений или два загруженных изображения с эталонным видео:
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan2.7' \
-F 'prompt=Preserve the image subjects and follow the video motion.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'input_reference=https://your-image-host/reference-1.png' \
-F 'input_reference=https://your-image-host/reference-2.jpg' \
-F 'reference_videos=https://your-media-host/reference.mp4'
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan2.7' \
-F 'prompt=Preserve the image subjects and follow the video motion.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'input_reference=@reference-1.png;type=image/png' \
-F 'input_reference=@reference-2.jpg;type=image/jpeg' \
-F 'reference_videos=@reference.mp4;type=video/mp4'
Эталонные изображения, видео и аудио Wan 3.0
Дляwan3.0 и wan3.0-prime сочетайте эталонные изображения и видео с эталонными аудио, чтобы управлять внешним видом, движением и ритмом.
Передавайте не более пяти эталонных видео общей длительностью не более 15 секунд. Частота каждого видео должна быть не менее 16 fps.
Передавайте не более пяти эталонных аудио общей длительностью не более 15 секунд. Длительность видео и аудио учитывается отдельно.
Установите выходной параметр seconds в целое число от 2 до 30.
Используйте два URL изображений или два загруженных изображения с одним видео и двумя аудиоклипами:
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0' \
-F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'input_reference=https://your-image-host/reference-1.png' \
-F 'input_reference=https://your-image-host/reference-2.jpg' \
-F 'reference_videos=https://your-media-host/reference.mp4' \
-F 'reference_audios=https://your-media-host/reference-1.mp3' \
-F 'reference_audios=https://your-media-host/reference-2.mp3'
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0-prime' \
-F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'input_reference=https://your-image-host/reference-1.png' \
-F 'input_reference=https://your-image-host/reference-2.jpg' \
-F 'reference_videos=https://your-media-host/reference.mp4' \
-F 'reference_audios=https://your-media-host/reference-1.mp3' \
-F 'reference_audios=https://your-media-host/reference-2.mp3'
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0' \
-F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'input_reference=@reference-1.png;type=image/png' \
-F 'input_reference=@reference-2.jpg;type=image/jpeg' \
-F 'reference_videos=@reference.mp4;type=video/mp4' \
-F 'reference_audios=@reference-1.mp3;type=audio/mpeg' \
-F 'reference_audios=@reference-2.mp3;type=audio/mpeg'
Используйте первый и последний кадры
Дляwan2.7, wan3.0 и wan3.0-prime передавайте first_frame для начального изображения и при необходимости last_frame для конечного изображения.
Каждое поле принимает один общедоступный HTTPS URL для PNG или JPEG либо один загруженный файл PNG или JPEG.
Для входных кадров Wan 2.7 начальное изображение определяет соотношение сторон, а size выбирает уровень выходного разрешения.
Отправляйте входные кадры отдельным запросом, отдельно от input_reference, reference_videos и reference_audios.
Эти примеры Wan 2.7 создают переход между начальным и конечным кадрами:
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan2.7' \
-F 'prompt=Move smoothly from the opening frame to the ending frame.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'first_frame=https://your-image-host/first-frame.png' \
-F 'last_frame=https://your-image-host/last-frame.jpg'
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan2.7' \
-F 'prompt=Move smoothly from the opening frame to the ending frame.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'first_frame=@first-frame.png;type=image/png' \
-F 'last_frame=@last-frame.jpg;type=image/jpeg'
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0' \
-F 'prompt=Move smoothly from the opening frame to the ending frame.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'first_frame=https://your-image-host/first-frame.png' \
-F 'last_frame=https://your-image-host/last-frame.jpg'
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0-prime' \
-F 'prompt=Move smoothly from the opening frame to the ending frame.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'first_frame=https://your-image-host/first-frame.png' \
-F 'last_frame=https://your-image-host/last-frame.jpg'
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F 'model=wan3.0' \
-F 'prompt=Move smoothly from the opening frame to the ending frame.' \
-F 'seconds=5' \
-F 'size=1280x720' \
-F 'first_frame=@first-frame.png;type=image/png' \
-F 'last_frame=@last-frame.jpg;type=image/jpeg'
Настройка длительности и размера
Отправьтеseconds как целое число в диапазоне, допустимом для вашей модели и режима ввода.
| Идентификатор модели | Режим ввода | seconds | По умолчанию |
|---|---|---|---|
wan3.0, wan3.0-prime | Текст, ссылки или кадры | целое число 2–30 | 5 секунд, 1920x1080 |
wan2.7 | Текст | целое число 2–15 | 5 секунд, 1920x1080 |
wan2.7 | Кадры | целое число 2–15 | 5 секунд, уровень 1080p; соотношение сторон определяется исходным изображением |
wan2.7 | Ссылки на изображения/видео | целое число 2–10 | 5 секунд, 1920x1080 |
wan2.6 | Текст | 5, 10, 15 | 5 секунд, 1920x1080 |
wan2.6 | Ссылки на видео | 5, 10 | 5 секунд, 1920x1080 |
size одним из значений WxH ниже для целевой модели.
Значения размеров Wan 3.0 также применяются к wan3.0-prime.
Значения размеров Wan 3.0
| Уровень разрешения | Соотношение сторон | size (WxH) |
|---|---|---|
480p | 16:9 | 832x480 |
9:16 | 480x832 | |
1:1 | 624x624 | |
4:3 | 704x528 | |
3:4 | 528x704 | |
720p | 16:9 | 1280x720 |
9:16 | 720x1280 | |
1:1 | 960x960 | |
4:3 | 1088x832 | |
3:4 | 832x1088 | |
1080p | 16:9 | 1920x1080 |
9:16 | 1080x1920 | |
1:1 | 1440x1440 | |
4:3 | 1632x1248 | |
3:4 | 1248x1632 |
Значения размеров Wan 2.7
| Уровень разрешения | Соотношение сторон | size (WxH) |
|---|---|---|
720p | 16:9 | 1280x720 |
9:16 | 720x1280 | |
1080p | 16:9 | 1920x1080 |
9:16 | 1080x1920 | |
1:1 | 1440x1440 |
Значения размеров Wan 2.6
| Уровень разрешения | Соотношение сторон | size (WxH) |
|---|---|---|
720p | 16:9 | 1280x720 |
9:16 | 720x1280 | |
4:3 | 1088x832 | |
3:4 | 832x1088 | |
1080p | 16:9 | 1920x1080 |
9:16 | 1080x1920 | |
1:1 | 1440x1440 | |
4:3 | 1632x1248 | |
3:4 | 1248x1632 |
Процесс выполнения задачи
Создайте задачу
id.Проверьте задачу
status не примет значение completed, failed или error.Скачайте результат
completed, вызовите Получить содержимое видео Wan чтобы скачать файл MP4.Тело
Wan model ID: wan2.6, wan2.7, wan3.0, or wan3.0-prime. Wan 3.0 and Wan 3.0 Prime use the same public request fields, task flow, and media limits; use the exact model ID wan3.0-prime when targeting Prime. Use wan2.6 for text or reference-video input. Use wan2.7 for text, image/video references, or frame inputs. Wan 3.0 and Wan 3.0 Prime also support reference audio.
"wan3.0-prime"
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, 480p: 832x480, 480x832, 624x624, 704x528, 528x704; 720p: 1280x720, 720x1280, 960x960, 1088x832, 832x1088; 1080p: 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}.
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F model=wan3.0 \
-F 'prompt=A small robot walks through a bright greenhouse with smooth camera movement.' \
-F seconds=5 \
-F size=1920x1080{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "wan3.0",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}