Wan動画を作成
CometAPIを通じて、テキスト、参照メディア、または最初と最後のフレームからWan動画を作成し、タスクをポーリングして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が必要です。使用できるメディア入力はモデルによって異なります。
| 目的 | モデルID | メディアフィールド |
|---|---|---|
| テキストから動画生成 | 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で5秒間のテキストから動画生成タスクを作成します。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では、公開アクセス可能なHTTPS URLまたはアップロードしたファイルとして、input_referenceを通じて参照画像を送信します。
複数の画像では、画像の順序に従ってフィールドを繰り返し、フィールドごとに1つのURLまたはファイルを指定します。
input_reference内では、すべてURLまたはすべてファイルのいずれかを使用してください。URLをカンマ区切りの値にまとめず、各URLを個別に送信します。
各画像は20 MB以下のPNGまたはJPEGを使用してください。
単一のinput_reference URLまたはファイルでは、画像から動画生成ワークフローを使用します。画像は構図と見た目の指針となります。動きとカメラの挙動はプロンプトで説明してください。
wan3.0およびwan3.0-primeでは、URLまたはアップロードしたファイルのどちらを使用する場合でも、input_referenceを通じて送信する参照画像は最大10枚です。
参照動画と音声を使用する
動画はreference_videos で、音声クリップは reference_audios で送信し、入力ごとに各フィールドを1回ずつ指定します。
各入力には、一般公開されている HTTPS URL またはアップロード済みファイルを使用できます。
動画参照には、H.264 でエンコードされた動画を含む MP4 ファイルを使用します。音声参照には、個別の MP3 ファイルを使用します。
異なるフィールドでは、画像 URL とアップロード済み動画のように、異なる入力タイプを使用できます。reference_videos または reference_audios 内では、すべて URL またはすべてファイルのいずれかを使用してください。
最大5つの動画ファイルをアップロードできます。各ファイルは最大50 MiB(50 × 1024 × 1024 バイト).
最大5つの音声ファイルをアップロードできます。各ファイルは最大15 MiB(15 × 1024 × 1024 バイト).
Wan 2.6 動画参照
2~30秒、最大30 MB、かつ少なくとも16 fpsのreference_videos を1~3件送信します。
これらの制限は URL とアップロード済み動画の両方に適用されます。プロンプト(Prompt)内では、入力順に被写体を @Video1、@Video2、@Video3 として参照します。
このモードでは、input_reference、reference_audios、first_frame、last_frame を省略します。seconds を 5 または 10 に設定します。
これらの例では、2つの動画参照から5秒間の動画を作成します。メディア 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 は省略します。
動画参照とともに、2つの画像 URL または2つのアップロード済み画像を使用します:
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秒となるように、動画参照を最大5件送信します。各動画は少なくとも16 fpsである必要があります。
合計時間が最大15秒となるように、音声参照を最大5件送信します。動画と音声の時間は別々にカウントされます。
出力 seconds を 2 から 30 までの整数に設定します。
1つの動画と2つの音声クリップとともに、2つの画像 URL または2つのアップロード済み画像を使用します:
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 の PNG または JPEG URL を 1 つ、あるいはアップロードした PNG または JPEG ファイルを 1 つ指定できます。
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 を送信します。
| モデル ID | 入力モード | 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
}