Wan 2.7 API
Referensi API lengkap untuk model pembuatan video Wan 2.7 oleh Alibaba.
Varian Model
API ini mendukung empat varian model:
Perbandingan Cepat
Wan 2.7 Text to Video
Endpoint
POST /api/v1/video/task
Parameter Permintaan
Wajib
Opsional
Contoh Permintaan
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'wan-2.7-text-to-video',
prompt: 'A cat playing with a ball of yarn in a sunlit room',
duration: 6,
resolution: '720p',
aspect_ratio: '16:9',
negative_prompt: 'blur, low quality',
seed: 42
})
});
const { data } = await response.json();
const taskId = data.task_id;
Wan 2.7 Image to Video
Parameter Permintaan
Wajib
Opsional
Contoh Permintaan
{
model_name: 'wan-2.7-image-to-video',
image_url: 'https://example.com/first-frame.jpg',
image_end_url: 'https://example.com/last-frame.jpg',
video_url: 'https://example.com/reference-continuation.mp4',
audio_url: 'https://example.com/driving-audio.mp3',
prompt: 'Gentle camera push-in; leaves rustle softly in the breeze',
duration: 6,
resolution: '720p',
negative_prompt: 'blur, low quality',
seed: 42
}
Wan 2.7 Video Edit
Parameter Permintaan
Wajib
Opsional
Contoh Permintaan
{
model_name: 'wan-2.7-video-edit',
prompt: 'Replace the sky with warm sunset colors, keep subjects natural',
negative_prompt: 'artifacts, flicker',
seed: 42,
video_url: 'https://example.com/source.mp4',
images: ['https://example.com/ref-a.jpg', 'https://example.com/ref-b.jpg'],
audio_setting: 'auto'
}
Wan 2.7 Referensi ke Video
Buat video baru dari referensi gambar dan video yang berurutan, dengan panduan suara opsional dari satu klip audio.
Parameter Permintaan
Wajib
Media Referensi
Setidaknya satu gambar atau video referensi diperlukan. Gabungan images dan videos tidak boleh berisi lebih dari 5 item.
Opsional
Placeholder Referensi @ (AT)
Fitur referensi @ (AT) menghubungkan media referensi ke prompt melalui placeholder <<<...>>> bernomor. Penomoran dimulai dari 1 secara terpisah untuk setiap jenis media dan mengikuti urutan array terkait.
Contoh Permintaan
{
model_name: 'wan-2.7-reference-to-video',
prompt: 'Use image one for the hero and video one for the motion; keep the hero voice consistent with audio one',
resolution: '1080p',
duration: 8,
aspect_ratio: '16:9',
images: ['https://example.com/hero-reference.jpg'],
videos: ['https://example.com/motion-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3'],
negative_prompt: 'flicker, distorted hands, duplicate subjects',
seed: 42
}
Contoh Permintaan Reference-to-Video @ (AT)
{
model_name: 'wan-2.7-reference-to-video',
prompt: 'Place the presenter from <<<image_1>>> in the studio from <<<image_2>>>, follow the camera path in <<<video_1>>>, and use the reference voice from <<<audio_1>>>',
resolution: '1080p',
duration: 8,
aspect_ratio: '16:9',
images: [
'https://example.com/presenter-reference.jpg',
'https://example.com/studio-reference.jpg'
],
videos: ['https://example.com/camera-path-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3'],
negative_prompt: 'flicker, distorted hands, duplicate subjects',
seed: 42
}
Respons Awal
Semua model mengembalikan task_id untuk polling:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
Respons Polling
Lakukan polling ke GET /api/v1/video/{taskId} untuk memeriksa status:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
Nilai Status
submitted: Tugas diterima dan menunggu diproses
processing: Pembuatan video sedang berlangsung
succeed: Pembuatan video selesai
failed: Pembuatan video gagal
Waktu Pemrosesan
Waktu pemrosesan umum: 2-5 menit tergantung pada pengaturan durasi dan resolusi.
Video yang lebih panjang (10-15 detik) pada 1080p dapat memakan waktu hingga 8 menit.
Praktik Terbaik
- Deskripsikan Adegan & Gerakan: Sertakan konten adegan dan pergerakan kamera dalam prompt
- Pemilihan Resolusi: Gunakan 720p untuk pemrosesan lebih cepat, 1080p untuk kualitas tertinggi
- Perencanaan Durasi: Video yang lebih panjang memerlukan biaya lebih tinggi (harga per detik)
- Integrasi Audio: Tambahkan audio kustom melalui parameter
audio_url
- Kualitas Gambar: Untuk image-to-video, gunakan gambar input berkualitas tinggi demi hasil terbaik
- Prompt Video Edit: Jelaskan secara spesifik apa yang ingin diubah dan apa yang ingin dipertahankan
- Jumlah Aset Referensi: Untuk Reference-to-Video, batasi jumlah gabungan item
images dan videos hingga 5 atau kurang
- Suara Referensi: Gunakan
audios hanya untuk panduan identitas suara; jelaskan konten ucapan yang diinginkan dalam prompt