Buat video Flux 3
Buat video Flux 3 dari teks, gambar referensi, atau frame pertama dan terakhir dengan preset ukuran 720p atau 1080p.
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 yang dikembalikan untuk memeriksa task dan mengunduh video yang telah selesai.
POST /v1/videos menggunakan multipart/form-data. Kirim kontrol sebagai field formulir. Untuk input gambar, gunakan URL gambar referensi atau frame pembuka dan penutup.
Pisahkan input_reference dari first_frame dan last_frame.
Pilih mode input
| Tujuan | Field wajib | Field opsional |
|---|---|---|
| Teks-ke-video | model=flux-3, prompt | seconds, size |
| Gambar HTTPS-ke-video | model=flux-3, prompt, satu URL input_reference | seconds, size |
| Keyframe berurutan | model=flux-3, prompt, URL input_reference berulang | seconds, size |
| Frame pembuka yang diunggah | model=flux-3, prompt, satu file first_frame | seconds, size |
| Video dengan frame pertama dan terakhir | model=flux-3, prompt, first_frame, last_frame | seconds, size |
Gunakan gambar referensi
Fieldinput_reference hanya menerima URL gambar HTTPS yang dapat diakses publik. Kirim sekali untuk satu gambar, atau ulangi dalam urutan keyframe untuk beberapa gambar. Gunakan satu URL per field, hingga total 10 URL.
Jelaskan gerakan, perilaku kamera, dan detail visual yang harus dipertahankan video yang dihasilkan dari gambar referensi.
Contoh request di bagian atas halaman ini menampilkan input satu gambar dan beberapa gambar. Request berikut menggunakan dua gambar dalam urutan pengirimannya:
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'
Atur frame pertama dan terakhir
Kirimfirst_frame untuk menetapkan gambar pembuka. Untuk juga menetapkan gambar penutup, sertakan last_frame dan jelaskan gerakan di antara kedua frame dalam prompt.
Untuk frame pembuka saja, hilangkan last_frame. Frame penutup memerlukan first_frame dan last_frame.
Setiap field menerima satu URL HTTPS yang dapat diakses publik atau satu file PNG atau JPEG. Kirim setiap field sekali, menggunakan URL atau file. Pastikan setiap file berukuran paling besar 20 MiB (20 × 1024 × 1024 byte).
Contoh frame di bagian atas halaman ini menampilkan input URL dan unggahan file, dengan seconds dan size yang ditetapkan secara eksplisit.
Atur durasi dan ukuran
Tetapkanseconds secara eksplisit ke bilangan bulat dari 5 hingga 20.
Tetapkan size ke salah satu nilai preset WxH berikut yang tepat:
| Tingkat resolusi | Ukuran |
|---|---|
720p | 1280x720 |
1080p | 1920x1080 |
Alur task
Buat task
id yang dikembalikan.Periksa task
status bernilai completed atau failed.Unduh hasil
completed, panggil Unduh konten video Flux 3 untuk menyimpan file MP4.Body
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://Respons
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
}