Flux 3動画を作成する
テキスト、参照画像、または最初と最後のフレームから、720pまたは1080pのサイズプリセットでFlux 3動画を作成します。
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
--form-string 'model=flux-3' \
--form-string 'prompt=A paper boat glides across a still pond while the camera moves forward.' \
--form-string 'seconds=5' \
--form-string 'size=1280x720'{
"id": "<task_id>",
"task_id": "<task_id>",
"object": "video",
"model": "flux-3",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}idを保存してタスクをポーリングし、完成した動画をダウンロードします。
POST /v1/videos multipart/form-dataを使用します。コントロールはフォームフィールドとして送信します。画像入力には、参照画像URLまたは開始フレームと終了フレームを使用します。
input_referenceは、first_frameおよびlast_frameとは分けて管理してください。
入力モードを選択する
| 目的 | 必須フィールド | 任意フィールド |
|---|---|---|
| テキストから動画へ | model=flux-3, prompt | seconds, size |
| HTTPS画像から動画へ | model=flux-3, prompt、input_reference URL 1件 | seconds, size |
| 順序付きキーフレーム | model=flux-3, prompt、input_reference URLを繰り返し指定 | seconds, size |
| アップロードした開始フレーム | model=flux-3, prompt、first_frameファイル1件 | seconds, size |
| 最初と最後のフレームによる動画生成 | model=flux-3, prompt, first_frame, last_frame | seconds, size |
参照画像を使用する
input_referenceフィールドで受け付けるのは、公開アクセス可能なHTTPS画像URLのみです。画像が1枚の場合は1回送信し、複数画像の場合はキーフレーム順に繰り返し送信します。各フィールドにはURLを1件ずつ指定でき、合計で最大10件のURLを指定できます。
生成する動画で参照画像から維持すべき動き、カメラの挙動、視覚的な詳細を記述します。
このページ上部のリクエストサンプルでは、単一画像および複数画像の入力を示しています。次のリクエストでは、送信した順序で2枚の画像を使用します。
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
--form-string 'model=flux-3' \
--form-string 'prompt=Move smoothly through the supplied reference images in their given order. Preserve recognizable subjects and visual details as the scene changes. Keep the camera movement gentle.' \
--form-string 'seconds=5' \
--form-string 'size=1280x720' \
--form-string 'input_reference=https://apidoc.cometapi.com/images/image/gemini/6100640_569429.png' \
--form-string 'input_reference=https://apidoc.cometapi.com/images/image/gemini/6100640_569420.png'
最初と最後のフレームを設定する
開始画像を設定するにはfirst_frameを送信します。終了画像も設定するには、last_frameを含め、2つのフレーム間の動きをpromptで記述します。
開始フレームのみの場合は、last_frameを省略します。終了フレームには、first_frameとlast_frameの両方が必要です。
各フィールドには、公開アクセス可能なHTTPS URLを1件、またはPNGもしくはJPEGファイルを1件指定できます。各フィールドはURLまたはファイルのいずれかを使用して1回だけ送信します。各ファイルは20 MiB以下(20 × 1024 × 1024バイト).
このページ上部のフレームの例では、URL入力とファイルアップロードを示し、secondsとsizeを明示的に設定しています。
長さとサイズを設定する
secondsを、5から20までの整数として明示的に設定します。
sizeを、以下のいずれかの正確なWxHプリセット値に設定します。
| 解像度階層 | サイズ |
|---|---|
720p | 1280x720 |
1080p | 1920x1080 |
タスクフロー
タスクを作成する
idを保存します。タスクをポーリングする
statusがcompletedまたはfailedになるまで繰り返します。結果をダウンロードする
completedになったら、次を呼び出します。 Flux 3動画コンテンツをダウンロードする MP4ファイルを保存します。ボディ
Flux 3 multipart request. Choose text, input_reference URLs, or first_frame and last_frame inputs. Keep reference-image and frame inputs separate.
Reference image URLs. Send one publicly accessible HTTPS image URL per input_reference field. For multiple images, repeat the field in keyframe order, up to 10 URLs. This field accepts URLs only. Keep it separate from first_frame and last_frame.
^https://Opening-frame image as one publicly accessible HTTPS URL or one PNG or JPEG file. Keep each file at or below 20 MiB (20 × 1024 × 1024 bytes). Send the field once, using either a URL or a file. Pair with last_frame to set both boundaries. Keep frame inputs separate from input_reference.
^https://Closing-frame image as one publicly accessible HTTPS URL or one PNG or JPEG file. Keep each file at or below 20 MiB (20 × 1024 × 1024 bytes). Send the field once, using either a URL or a file. To specify the closing image through this endpoint, send last_frame together with first_frame. Keep frame inputs separate from input_reference.
^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" \
--form-string 'model=flux-3' \
--form-string 'prompt=A paper boat glides across a still pond while the camera moves forward.' \
--form-string 'seconds=5' \
--form-string 'size=1280x720'{
"id": "<task_id>",
"task_id": "<task_id>",
"object": "video",
"model": "flux-3",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}