Crear un video de Wan
Crea un video de Wan a partir de texto, medios de referencia o fotogramas inicial y final mediante CometAPI; luego consulta la tarea y descarga el archivo MP4.
{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "wan3.0",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}id devuelto para consultar la tarea y descargar el video completado.
POST /v1/videos usa multipart/form-data. Envía un valor entero explícito para seconds y un size en formato WxH.
wan3.0-prime usa los mismos campos de solicitud públicos, límites de medios y flujo de tareas que wan3.0. Establece model en el valor exacto wan3.0-prime al usar Prime. Prime admite texto a video, imagen a video, entradas de primer y último fotograma, y referencias combinadas de imagen, video y audio. Los medios de referencia y las entradas de fotogramas deben enviarse en solicitudes independientes.
Elige un modo de entrada
Todos los modos requierenmodel y prompt. Las entradas de medios disponibles dependen del modelo:
| Objetivo | ID de modelo | Campos de medios |
|---|---|---|
| Texto a video | wan2.6, wan2.7, wan3.0, wan3.0-prime | Omite los campos de medios |
| Imagen a video | wan2.7, wan3.0, wan3.0-prime | input_reference URL o archivos de imagen cargados |
| Video de referencia | wan2.6 | reference_videos solamente |
| Referencias de imagen y video | wan2.7, wan3.0, wan3.0-prime | input_reference con reference_videos |
| Referencias de imagen, video y audio | wan3.0, wan3.0-prime | Referencias de imagen/video con reference_audios |
| Primer y último fotogramas | wan2.7, wan3.0, wan3.0-prime | first_frame, de forma opcional last_frame |
Crear un video Wan 3.0 Prime
Esta solicitud mínima crea una tarea de texto a video de cinco segundos con 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'
Usar imágenes de referencia
Parawan2.7, wan3.0 y wan3.0-prime, envía imágenes de referencia mediante input_reference como URL HTTPS de acceso público o archivos cargados.
Para varias imágenes, repite el campo en el orden de las imágenes, con una URL o archivo por campo.
Usa todas las URL o todos los archivos dentro de input_reference. Envía cada URL por separado en lugar de combinar las URL en un valor separado por comas.
Usa imágenes PNG o JPEG de hasta 20 MB cada una.
Una única URL o archivo input_reference utiliza el flujo de trabajo de imagen a video. La imagen guía la composición y la apariencia; usa el prompt para describir el movimiento y el comportamiento de la cámara.
Para wan3.0 y wan3.0-prime, envía como máximo 10 imágenes de referencia mediante input_reference, tanto si usas URL como archivos cargados.
Use videos y audio de referencia
Envíe videos mediantereference_videos y clips de audio mediante reference_audios, repitiendo cada campo una vez por entrada.
Cada entrada puede ser una URL HTTPS de acceso público o un archivo cargado.
Use archivos MP4 con video codificado con H.264 para las referencias de video. Use archivos MP3 independientes para las referencias de audio.
Los distintos campos pueden usar diferentes tipos de entrada, como una URL de imagen con videos cargados. Dentro de reference_videos o reference_audios, use solo URL o solo archivos.
Puede cargar hasta cinco archivos de video, cada uno de un máximo de 50 MiB (50 × 1024 × 1024 bytes).
Puede cargar hasta cinco archivos de audio, cada uno de un máximo de 15 MiB (15 × 1024 × 1024 bytes).
Referencias de video de Wan 2.6
Envíe de una a tresreference_videos, de 2 a 30 segundos cada una, de hasta 30 MB y de al menos 16 fps.
Estos límites se aplican tanto a las URL como a los videos cargados. En el Prompt, haga referencia a los sujetos como @Video1, @Video2 y @Video3, en el orden de entrada.
Para este modo, omita input_reference, reference_audios, first_frame y last_frame. Establezca seconds en 5 o 10.
Estos ejemplos crean un video de cinco segundos a partir de dos referencias de video. Sustituya las URL de medios o los nombres de archivo por sus entradas:
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'
Referencias de imagen y video de Wan 2.7
Combine referencias de imagen y video para guiar la apariencia y el movimiento del sujeto. Establezcaseconds en un número entero de 2 a 10. Omita reference_audios.
Use dos URL de imágenes o dos imágenes cargadas con una referencia de video:
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'
Referencias de imagen, video y audio de Wan 3.0
Parawan3.0 y wan3.0-prime, combine referencias de imagen y video con referencias de audio para guiar la apariencia, el movimiento y el ritmo.
Envíe como máximo cinco referencias de video con una duración combinada máxima de 15 segundos. Cada video debe tener al menos 16 fps.
Envíe como máximo cinco referencias de audio con una duración combinada máxima de 15 segundos. Cuente por separado la duración de video y audio.
Establezca seconds de salida en un número entero de 2 a 30.
Use dos URL de imágenes o dos imágenes cargadas con un video y dos clips de audio:
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'
Usa el primer y el último fotograma
Parawan2.7, wan3.0 y wan3.0-prime, envía first_frame para la imagen inicial y, opcionalmente, last_frame para la imagen final.
Cada campo acepta una URL HTTPS de acceso público para una imagen PNG o JPEG, o un archivo PNG o JPEG cargado.
Para las entradas de fotogramas de Wan 2.7, la imagen inicial determina la relación de aspecto, mientras que size selecciona el nivel de resolución de salida.
Envía las entradas de fotogramas en una solicitud independiente de input_reference, reference_videos y reference_audios.
Estos ejemplos de Wan 2.7 crean una transición entre los fotogramas inicial y final:
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'
Configurar la duración y el tamaño
Envíaseconds como un número entero dentro del intervalo correspondiente a tu modelo y modo de entrada.
| ID del modelo | Modo de entrada | seconds | Predeterminado |
|---|---|---|---|
wan3.0, wan3.0-prime | Texto, referencias o fotogramas | entero 2–30 | 5 segundos, 1920x1080 |
wan2.7 | Texto | entero 2–15 | 5 segundos, 1920x1080 |
wan2.7 | Fotogramas | entero 2–15 | 5 segundos, nivel 1080p; la relación de aspecto sigue la imagen inicial |
wan2.7 | Referencias de imagen/vídeo | entero 2–10 | 5 segundos, 1920x1080 |
wan2.6 | Texto | 5, 10, 15 | 5 segundos, 1920x1080 |
wan2.6 | Referencias de vídeo | 5, 10 | 5 segundos, 1920x1080 |
size en uno de los valores WxH siguientes para el modelo de destino.
Los valores de tamaño de Wan 3.0 también se aplican a wan3.0-prime.
Valores de tamaño de Wan 3.0
| Nivel de resolución | Relación de aspecto | 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 |
Valores de tamaño de Wan 2.7
| Nivel de resolución | Relación de aspecto | size (WxH) |
|---|---|---|
720p | 16:9 | 1280x720 |
9:16 | 720x1280 | |
1080p | 16:9 | 1920x1080 |
9:16 | 1080x1920 | |
1:1 | 1440x1440 |
Valores de tamaño de Wan 2.6
| Nivel de resolución | Relación de aspecto | 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 |
Flujo de tareas
Crear la tarea
id devuelto.Consultar la tarea
status sea completed, failed o error.Descargar el resultado
completed, llama a Recuperar contenido de vídeo de Wan para descargar el archivo MP4.Cuerpo
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://Respuesta
Task created. Store the returned id and poll GET /v1/videos/{task_id}.
{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "wan3.0",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}