全部产品
Search
文档中心

Alibaba Cloud Model Studio:Wan - Referensi API Image-to-Video

更新时间:Feb 11, 2026

Model image-to-video Wan menghasilkan video yang mulus dari gambar first-frame dan prompt teks.

Referensi: Panduan pengguna

Cakupan penggunaan

Untuk memastikan pemanggilan berhasil, pastikan model, URL titik akhir, dan kunci API berada di wilayah yang sama. Pemanggilan lintas wilayah akan gagal.

Catatan

Kode contoh dalam topik ini berlaku untuk wilayah Singapura.

Pemanggilan HTTP

Tugas image-to-video memerlukan waktu untuk diselesaikan—biasanya 1 hingga 5 menit—sehingga API menggunakan pemanggilan asinkron. Proses lengkapnya terdiri dari dua langkah inti: Buat tugas → Polling hasil.

Langkah 1: Buat tugas dan dapatkan ID tugas

Singapura

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Virginia

POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Beijing

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Catatan
  • Setelah tugas dibuat, gunakan task_id yang dikembalikan untuk mengkueri hasilnya. task_id berlaku selama 24 jam. Jangan membuat tugas duplikat. Sebagai gantinya, gunakan polling untuk mengambil hasilnya.

  • Untuk tutorial pemula, lihat Postman.

Parameter permintaan

Narasi multi-shot

Fitur ini hanya didukung oleh model wan2.6.

Aktifkan dengan mengatur "prompt_extend": true dan "shot_type":"multi".

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.6-i2v-flash",
    "input": {
        "prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
        "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
        "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
    },
    "parameters": {
        "resolution": "720P",
        "prompt_extend": true,
        "duration": 10,
        "shot_type":"multi"
    }
}'

Dubbing otomatis

Fitur ini hanya didukung oleh model wan2.6 dan wan2.5.

Jika Anda tidak menyediakan input.audio_url, model secara otomatis menghasilkan musik latar atau efek suara yang sesuai berdasarkan konten video.

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.5-i2v-preview",
    "input": {
        "prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
        "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
    },
    "parameters": {
        "resolution": "480P",
        "prompt_extend": true,
        "duration": 10
    }
}'

Sediakan file audio

Fitur ini hanya didukung oleh model wan2.6 dan wan2.5.

Untuk menentukan musik latar atau sulih suara untuk video Anda, masukkan URL file audio kustom Anda di parameter input.audio_url.

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.5-i2v-preview",
    "input": {
        "prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
        "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
        "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
    },
    "parameters": {
        "resolution": "480P",
        "prompt_extend": true,
        "duration": 10
    }
}'

Hasilkan video tanpa suara

Hanya model-model berikut yang mendukung pembuatan video tanpa suara:

  • wan2.6-i2v-flash: Untuk menghasilkan video tanpa suara, Anda harus secara eksplisit mengatur parameters.audio = false.

  • model wan2.2 dan wan2.1: Video tanpa suara dihasilkan secara default. Tidak diperlukan parameter tambahan.

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.2-i2v-plus",
    "input": {
        "prompt": "A cat running on the grass",
        "img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
    },
    "parameters": {
        "resolution": "480P",
        "prompt_extend": true
    }
}'

Gunakan negative prompt

Gunakan parameter negative_prompt untuk mencegah “bunga” muncul dalam video yang dihasilkan.

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.2-i2v-plus",
    "input": {
        "prompt": "A cat running on the grass",
        "negative_prompt": "flowers",
        "img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
    },
    "parameters": {
        "resolution": "480P",
        "prompt_extend": true
    }
}'
Headers

Content-Type string (Required)

Tipe konten dari permintaan. Harus berupa application/json.

Authorization string (Required)

Kredensial autentikasi menggunakan kunci API Model Studio.

Contoh: Bearer sk-xxxx

X-DashScope-Async string (Wajib)

Mengaktifkan pemrosesan asinkron. Harus diatur ke enable karena permintaan HTTP hanya mendukung pemrosesan asinkron.

Penting

Mengembalikan error "current user api does not support synchronous calls" jika tidak disertakan.

Body permintaan

model string (Required)

Nama model. Untuk informasi selengkapnya mengenai model dan harga, lihat Model pricing.

Contoh: wan2.6-i2v-flash.

input object (Wajib)

Informasi input dasar, seperti prompt.

Properties

prompt string (Opsional)

Prompt teks menggambarkan elemen dan karakteristik visual yang diinginkan untuk gambar yang dihasilkan.

Dukungan tersedia untuk bahasa Tiongkok dan Inggris. Setiap karakter dihitung sebagai satu unit. Teks yang melebihi batas akan dipotong secara otomatis. Batas panjang bervariasi tergantung versi model:

  • Model wan2.6 dan wan2.5: hingga 1.500 karakter.

  • Model wan2.2 dan wan2.1: hingga 800 karakter.

Contoh: Seekor anak kucing berlari di atas rumput.

Untuk tips penulisan prompt, lihat Prompt Guide for Text-to-Video and Image-to-Video.

negative_prompt string (Opsional)

Negative prompt menggambarkan konten yang ingin Anda kecualikan dari video. Ini membantu membatasi output.

Dukungan tersedia untuk bahasa Tiongkok dan Inggris. Panjang maksimum adalah 500 karakter. Teks yang melebihi batas akan dipotong secara otomatis.

Contoh: low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions.

img_url string (Wajib)

URL atau data yang dikodekan dalam Base64 dari gambar frame pertama.

Batasan gambar:

  • Format: JPEG, JPG, PNG (tanpa alpha channel), BMP, WEBP.

  • Resolusi: Lebar dan tinggi harus antara 360 hingga 2.000 piksel.

  • Ukuran file: Maksimal 10 MB.

Format input yang didukung:

  1. URL publik:

    • HTTP dan HTTPS didukung.

    • Contoh: https://cdn.translate.alibaba.com/r/wanx-demo-1.png.

  2. String gambar yang dikodekan dalam Base64:

    • Format data: data:{MIME_type};base64,{base64_data}.

    • Contoh: data:image/png;base64,GDU7MtCZzEbTbmRZ...... (dipotong karena panjang).

    • Untuk detail selengkapnya, lihat Input image.

audio_url string (Opsional)

Model yang didukung: model wan2.6 dan wan2.5.

URL file audio. Model menggunakan audio ini untuk menghasilkan video.

Format input yang didukung:

  1. URL publik:

    • HTTP dan HTTPS didukung.

    • Contoh: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp3.

Batasan audio:

  • Format: wav, mp3.

  • Durasi: 3–30 detik.

  • Ukuran file: Maksimal 15 MB.

  • Penanganan overflow: Jika durasi audio melebihi nilai duration (5 atau 10 detik), sistem akan memotongnya menjadi 5 atau 10 detik pertama. Jika durasi audio lebih pendek daripada durasi video, bagian sisanya akan diam. Misalnya, jika audio berdurasi 3 detik dan video berdurasi 5 detik, 3 detik pertama memiliki audio dan 2 detik terakhir diam.

Contoh: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3.

parameters object (Opsional)

Parameter pemrosesan video, seperti resolusi, durasi, penulisan ulang prompt, dan pemberian Watermark.

Properties

resolution string (Opsional)

Penting

resolution berdampak langsung terhadap biaya. Untuk model yang sama: 1080P > 720P > 480P. Konfirmasi harga sebelum melakukan panggilan, lihat Model pricing.

Menentukan tingkat resolusi video yang dihasilkan untuk menyesuaikan kejelasan (jumlah total piksel). Model akan diskalakan ke jumlah total piksel yang serupa berdasarkan tingkat yang dipilih. Rasio aspek video akan sangat mendekati rasio aspek gambar input (img_url). Lihat FAQ.

Nilai default dan opsi bergantung pada parameter model:

  • wan2.6-i2v-flash: Opsi: 720P, 1080P. Default: 1080P.

  • wan2.6-i2v: Opsi: 720P, 1080P. Default: 1080P.

  • wan2.6-i2v-us: Opsi: 720P, 1080P. Default: 1080P.

  • wan2.5-i2v-preview: Opsi: 480P, 720P, 1080P. Default: 1080P.

  • wan2.2-i2v-flash: Opsi: 480P, 720P. Default: 720P.

  • wan2.2-i2v-plus: Opsi: 480P, 1080P. Default: 1080P.

  • wan2.1-i2v-turbo: Opsi: 480P, 720P. Default: 720P.

  • wan2.1-i2v-plus: Opsi: 720P. Default: 720P.

Contoh: 1080P.

duration integer (Opsional)

Penting

Durasi berdampak langsung terhadap biaya. Penagihan dilakukan per detik. Durasi yang lebih panjang berarti biaya lebih tinggi. Konfirmasi harga sebelum melakukan panggilan, lihat Model pricing.

Durasi video yang dihasilkan dalam satuan detik. Nilai yang valid bergantung pada parameter model:

  • wan2.6-i2v-flash: Bilangan bulat dari 2 hingga 15. Default: 5.

  • wan2.6-i2v: Bilangan bulat dari 2 hingga 15. Default: 5.

  • wan2.6-i2v-us: Opsi: 5, 10, 15. Default: 5.

  • wan2.5-i2v-preview: Opsi: 5, 10. Default: 5.

  • wan2.2-i2v-plus: Tetap 5 detik (tidak dapat dikonfigurasi).

  • wan2.2-i2v-flash: Tetap 5 detik (tidak dapat dikonfigurasi).

  • wan2.1-i2v-plus: Tetap 5 detik (tidak dapat dikonfigurasi).

  • wan2.1-i2v-turbo: Opsi: 3, 4, atau 5. Default: 5.

Contoh: 5.

prompt_extend boolean (Opsional) Default ke true

Apakah akan mengaktifkan penulisan ulang prompt. Jika diaktifkan, sebuah LLM akan menulis ulang prompt input. Hal ini dapat meningkatkan kualitas generasi secara signifikan untuk prompt yang lebih pendek, tetapi juga meningkatkan waktu pemrosesan.

  • true

  • false

Contoh: true

shot_type string (Opsional)

Model yang didukung: model wan2.6.

Menentukan apakah video yang dihasilkan menggunakan satu shot kontinu atau beberapa shot yang berganti-ganti.

Kondisi aktivasi: Hanya berlaku ketika "prompt_extend": true.

Prioritas parameter: shot_type > prompt. Misalnya, jika Anda mengatur shot_type ke "single", model akan menghasilkan video single-shot meskipun prompt berisi "generate a multi-shot video".

Nilai yang valid:

  • single (default): Menghasilkan video single-shot.

  • multi: Menghasilkan video multi-shot.

Contoh: single.

Catatan

Gunakan parameter ini untuk mengontrol struktur narasi secara ketat—misalnya, single shot untuk demo produk atau multiple shots untuk film pendek.

audio boolean (Opsional)

Penting

Pengaturan audio berdampak langsung terhadap biaya. Video dengan suara dan video tanpa suara memiliki harga yang berbeda. Konfirmasi harga sebelum melakukan panggilan, lihat Model pricing.

Model yang didukung: wan2.6-i2v-flash.

Menentukan apakah akan menghasilkan video dengan suara.

Prioritas parameter: audio > audio_url. Jika audio=false, output-nya akan senyap meskipun audio_url disediakan. Penagihan menggunakan tarif video senyap.

Nilai yang valid:

  • true (default): Menghasilkan video dengan suara.

  • false: Menghasilkan video senyap.

Contoh: true.

watermark boolean (Opsional)

Menentukan apakah akan menambahkan Watermark bertuliskan “AI Generated” di pojok kanan bawah video.

  • false (default): Tidak menambahkan Watermark.

  • true: Menambahkan Watermark.

Contoh: false.

seed integer (Opsional)

Seed bilangan acak. Rentang nilai: [0, 2147483647].

Jika tidak ditentukan, sistem akan menghasilkan seed secara acak. Untuk meningkatkan reproduktibilitas, tetapkan nilai seed tertentu.

Catatan: Karena sifat probabilistik dari generasi model, seed yang identik tidak menjamin hasil yang identik setiap kali.

Contoh: 12345.

Parameter respons

Respons berhasil

Simpan task_id untuk mengkueri status dan hasil task.

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Respons error

Pembuatan task gagal. Lihat kode kesalahan untuk menyelesaikan masalah.

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

output object

Informasi output task.

Properti

task_id string

ID task. Dapat digunakan untuk mengkueri task hingga 24 jam.

task_status string

Status Tugas.

Enumeration

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN: Task tidak ada atau status tidak diketahui

request_id string

Identifier unik untuk permintaan. Gunakan untuk pelacakan dan troubleshooting masalah.

code string

Kode kesalahan. Hanya dikembalikan ketika permintaan gagal. Lihat kode kesalahan untuk detailnya.

message string

Pesan kesalahan detail. Hanya dikembalikan ketika permintaan gagal. Lihat kode kesalahan untuk detailnya.

Langkah 2: Kueri hasil berdasarkan ID task

Singapore

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

Virginia

GET https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}

Beijing

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

Catatan
  • Saran polling: Generasi video dapat memakan waktu beberapa menit. Kami menyarankan Anda menggunakan mekanisme polling dengan interval kueri yang wajar, misalnya 15 detik, untuk mengambil hasilnya.

  • Transisi status task: PENDING → RUNNING → SUCCEEDED atau FAILED.

  • URL hasil: Setelah task berhasil, URL video akan dikembalikan. URL tersebut berlaku selama 24 jam. Setelah Anda mendapatkan URL tersebut, segera unduh dan simpan video ke layanan penyimpanan permanen, seperti Object Storage Service (OSS).

  • Masa berlaku task_id: 24 jam. Setelah periode ini, Anda tidak dapat lagi melakukan kueri terhadap hasil tersebut, dan API akan mengembalikan status task sebagai UNKNOWN.

Parameter permintaan

Hasil Kueri Tugas

Ganti {task_id} dengan nilai task_id yang dikembalikan oleh panggilan API sebelumnya.

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
Header

Authorization string (Wajib)

Kredensial otentikasi menggunakan kunci API Model Studio.

Contoh: Bearer sk-xxxx

Parameter path URL

task_id string (Wajib)

ID task yang akan dikueri.

Parameter respons

Task berhasil

URL video hanya disimpan selama 24 jam, lalu secara otomatis dipurge. Segera simpan video yang dihasilkan.

{
    "request_id": "2ca1c497-f9e0-449d-9a3f-xxxxxx",
    "output": {
        "task_id": "af6efbc0-4bef-4194-8246-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2025-09-25 11:07:28.590",
        "scheduled_time": "2025-09-25 11:07:35.349",
        "end_time": "2025-09-25 11:17:11.650",
        "orig_prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
        "video_url": "https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.mp4?Expires=xxx"
    },
    "usage": {
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "video_count": 1,
        "SR": 720
    }
}

Task gagal

Jika task gagal, task_status diatur menjadi FAILED beserta kode kesalahan dan pesannya. Lihat kode kesalahan untuk menyelesaikan masalah tersebut.

{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The size is not match xxxxxx"
    }
}

Kueri task kedaluwarsa

task_id berlaku selama 24 jam. Setelah periode ini, kueri akan gagal dan mengembalikan pesan kesalahan berikut.

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

output object

Informasi output task.

Properti

task_id string

ID task. Dapat digunakan untuk mengkueri task hingga 24 jam.

task_status string

Status task.

Enumerasi

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN: Task tidak ada atau status tidak diketahui

Transisi status selama polling:

  • PENDING → RUNNING → SUCCEEDED atau FAILED

  • Kueri pertama biasanya mengembalikan PENDING atau RUNNING

  • Status SUCCEEDED menyertakan URL video yang dihasilkan dalam respons

  • Status FAILED memerlukan pemeriksaan pesan kesalahan dan percobaan ulang

submit_time string

Waktu saat task diajukan. Waktu dalam UTC+8. Format: YYYY-MM-DD HH:mm:ss.SSS.

scheduled_time string

Waktu saat task mulai berjalan. Waktu dalam UTC+8. Format: YYYY-MM-DD HH:mm:ss.SSS.

end_time string

Waktu saat task selesai. Waktu dalam UTC+8. Format: YYYY-MM-DD HH:mm:ss.SSS.

video_url string

URL video yang dihasilkan. Hanya dikembalikan ketika task_status bernilai SUCCEEDED.

URL berlaku selama 24 jam. Gunakan untuk mengunduh video dalam format MP4 dengan encoding H.264.

orig_prompt string

Prompt input asli. Ini adalah nilai dari parameter permintaan prompt.

actual_prompt string

Ketika prompt_extend=true, sistem menulis ulang prompt input secara cerdas. Bidang ini mengembalikan prompt yang dioptimalkan untuk generasi.

  • Jika prompt_extend=false, bidang ini tidak dikembalikan.

  • Catatan: Model wan2.6 tidak pernah mengembalikan bidang ini, terlepas dari nilai prompt_extend.

code string

Kode kesalahan. Hanya dikembalikan ketika permintaan gagal. Lihat kode kesalahan untuk detailnya.

message string

Pesan kesalahan detail. Hanya dikembalikan ketika permintaan gagal. Lihat kode kesalahan untuk detailnya.

usage object

Statistik output. Hanya dihitung untuk hasil yang berhasil.

Properti

Parameter yang dikembalikan oleh model wan2.6

input_video_duration integer

Durasi video input dalam detik. Video input tidak didukung, sehingga nilainya tetap 0.

output_video_duration integer

Hanya dikembalikan untuk model wan2.6.

Durasi video output dalam detik. Sama dengan nilai input.duration.

duration integer

Total durasi video, digunakan untuk penagihan.

Rumus penagihan: duration=input_video_duration+output_video_duration.

SR integer

Hanya dikembalikan untuk model wan2.6. Tingkat resolusi video yang dihasilkan. Contoh: 720.

video_count integer

Jumlah video yang dihasilkan. Tetap bernilai 1.

audioboolean

Hanya dikembalikan untuk model wan2.6-i2v-flash. Menunjukkan apakah video output memiliki suara.

Parameter yang dikembalikan oleh model wan2.2 dan wan2.5

duration integer

Durasi video yang dihasilkan dalam detik. Nilai valid: 5, 10.

Rumus penagihan: Biaya = Detik video × Harga satuan.

SR integer

Resolusi video yang dihasilkan. Nilai valid: 480, 720, 1080.

video_count integer

Jumlah video yang dihasilkan. Tetap bernilai 1.

Parameter yang dikembalikan oleh model wan2.1

video_duration integer

Durasi video yang dihasilkan dalam detik. Nilai valid: 3, 4, 5.

Rumus penagihan: Biaya = Detik video × Harga satuan.

video_ratio string

Rasio aspek video yang dihasilkan. Tetap bernilai standard.

video_count integer

Jumlah video yang dihasilkan. Tetap bernilai 1.

request_id string

Identifikasi unik untuk permintaan. Gunakan untuk pelacakan dan troubleshooting masalah.

Pemanggilan SDK DashScope

Nama parameter SDK sebagian besar sesuai dengan API HTTP. Struktur parameter disesuaikan dengan konvensi spesifik bahasa.

Karena tugas image-to-video memerlukan waktu untuk diselesaikan—biasanya 1 hingga 5 menit—SDK membungkus alur pemanggilan asinkron HTTP dan mendukung metode pemanggilan sinkron maupun asinkron.

Waktu pemrosesan aktual tergantung pada panjang antrian dan eksekusi layanan. Tunggu hasilnya dengan sabar.

Pemanggilan SDK Python

Penting

Pastikan versi SDK Python DashScope Anda minimal 1.25.8 sebelum menjalankan kode di bawah ini.

Jika versinya terlalu lama, kesalahan seperti “url error, please check url!” dapat terjadi. Perbarui SDK seperti yang dijelaskan di Instal SDK.

Atur base_http_api_url berdasarkan wilayah model:

Singapura

dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

Virginia

dashscope.base_http_api_url = 'https://dashscope-us.aliyuncs.com/api/v1'

Beijing

dashscope.base_http_api_url = 'https://dashscope.aliyuncs.com/api/v1'

Kode contoh

Pemanggilan sinkron

Pemanggilan sinkron memblokir hingga video dihasilkan dan hasil dikembalikan. Contoh ini menunjukkan tiga metode input gambar: URL publik, encoding Base64, dan jalur file lokal.

Contoh permintaan
import base64
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import mimetypes
import dashscope

# URL wilayah Singapura. Dapatkan URL: https://www.alibabacloud.com/help/en/model-studio/image-to-video-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'


# Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan kunci API Model Studio Anda: api_key="sk-xxx"
# Dapatkan kunci API Anda: https://www.alibabacloud.com/help/zh/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

# --- Fungsi bantu: Untuk encoding Base64 ---
# Format: data:{MIME_type};base64,{base64_data}
def encode_file(file_path):
    mime_type, _ = mimetypes.guess_type(file_path)
    if not mime_type or not mime_type.startswith("image/"):
        raise ValueError("Format gambar tidak didukung atau tidak dikenali")
    with open(file_path, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
    return f"data:{mime_type};base64,{encoded_string}"

"""
Metode input gambar:
Pilih salah satu dari tiga metode berikut,

1. Gunakan URL publik - Cocok untuk gambar yang dapat diakses publik
2. Gunakan file lokal - Cocok untuk pengembangan dan pengujian lokal
3. Gunakan encoding Base64 - Cocok untuk gambar pribadi atau skenario yang memerlukan transmisi terenkripsi
"""

# [Metode 1] Gunakan URL gambar yang dapat diakses publik
# Contoh: Gunakan URL gambar publik
img_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"

# [Metode 2] Gunakan file lokal (mendukung jalur absolut dan relatif)
# Persyaratan format: file:// + jalur file
# Contoh (jalur absolut):
# img_url = "file://" + "/path/to/your/img.png"    # Linux/macOS
# img_url = "file://" + "/C:/path/to/your/img.png"  # Windows
# Contoh (jalur relatif):
# img_url = "file://" + "./img.png"                # Relatif terhadap jalur file yang dapat dieksekusi saat ini

# [Metode 3] Gunakan gambar Base64-encoded
# img_url = encode_file("./img.png")

# Atur URL audio
audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"

def sample_call_i2v():
    # Pemanggilan sinkron, mengembalikan hasil langsung
    print('please wait...')
    rsp = VideoSynthesis.call(api_key=api_key,
                              model='wan2.6-i2v-flash',
                              prompt='A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.',
                              img_url=img_url,
                              audio_url=audio_url,
                              resolution="720P",
                              duration=10,
                              prompt_extend=True,
                              watermark=False,
                              negative_prompt="",
                              seed=12345)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print("video_url:", rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_call_i2v()
Contoh respons
video_url berlaku selama 24 jam. Segera unduh video tersebut.
{
    "status_code": 200,
    "request_id": "2794c7a3-fe8c-4dd4-a1b7-xxxxxx",
    "code": null,
    "message": "",
    "output": {
        "task_id": "c15d5b14-07c4-4af5-b862-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "submit_time": "2026-01-22 23:24:46.527",
        "scheduled_time": "2026-01-22 23:24:46.565",
        "end_time": "2026-01-22 23:25:59.978",
        "orig_prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise."
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "audio": true,
        "SR": 720
    }
}

Pemanggilan asinkron

Contoh ini menunjukkan pemanggilan asinkron. Mengembalikan task ID segera. Anda harus melakukan polling untuk hasil atau menunggu hingga selesai.

Contoh permintaan
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope

# URL wilayah Singapura. Dapatkan URL: https://www.alibabacloud.com/help/en/model-studio/image-to-video-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'


# Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan kunci API Model Studio Anda: api_key="sk-xxx"
# Dapatkan kunci API Anda: https://www.alibabacloud.com/help/zh/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

# Gunakan URL gambar yang dapat diakses publik
img_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"

# Atur URL audio
audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"


def sample_async_call_i2v():
    # Pemanggilan asinkron, mengembalikan task_id
    rsp = VideoSynthesis.async_call(api_key=api_key,
                                    model='wan2.6-i2v-flash',
                                    prompt='A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.',
                                    img_url=img_url,
                                    audio_url=audio_url,
                                    resolution="720P",
                                    duration=10,
                                    prompt_extend=True,
                                    watermark=False,
                                    negative_prompt="",
                                    seed=12345)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print("task_id: %s" % rsp.output.task_id)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

    # Dapatkan informasi tugas asinkron
    status = VideoSynthesis.fetch(task=rsp, api_key=api_key)
    if status.status_code == HTTPStatus.OK:
        print(status.output.task_status)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (status.status_code, status.code, status.message))

    # Tunggu hingga tugas asinkron selesai
    rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_async_call_i2v()
Contoh respons

1. Contoh respons untuk pembuatan tugas

{
    "status_code": 200,
    "request_id": "6dc3bf6c-be18-9268-9c27-xxxxxx",
    "code": "",
    "message": "",
    "output": {
        "task_id": "686391d9-7ecf-4290-a8e9-xxxxxx",
        "task_status": "PENDING",
        "video_url": ""
    },
    "usage": null
}

2. Contoh respons untuk mengkueri hasil tugas

video_url berlaku selama 24 jam. Segera unduh video tersebut.
{
    "status_code": 200,
    "request_id": "2794c7a3-fe8c-4dd4-a1b7-xxxxxx",
    "code": null,
    "message": "",
    "output": {
        "task_id": "c15d5b14-07c4-4af5-b862-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "submit_time": "2026-01-22 23:24:46.527",
        "scheduled_time": "2026-01-22 23:24:46.565",
        "end_time": "2026-01-22 23:25:59.978",
        "orig_prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise."
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "audio": true,
        "SR": 720
    }
}

Pemanggilan SDK Java

Penting

Pastikan versi SDK Java DashScope Anda minimal 2.22.6 sebelum menjalankan kode di bawah ini.

Jika versinya terlalu lama, kesalahan seperti “url error, please check url!” dapat terjadi. Perbarui SDK seperti yang dijelaskan di Instal SDK.

Atur baseHttpApiUrl berdasarkan wilayah model:

Singapura

Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";

Virginia

Constants.baseHttpApiUrl = "https://dashscope-us.aliyuncs.com/api/v1";

Beijing

Constants.baseHttpApiUrl = "https://dashscope.aliyuncs.com/api/v1";

Kode contoh

Pemanggilan sinkron

Pemanggilan sinkron memblokir hingga video dihasilkan dan hasil dikembalikan. Contoh ini menunjukkan tiga metode input gambar: URL publik, encoding Base64, dan jalur file lokal.

Contoh permintaan
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;

 
public class Image2Video {

    static {
        // URL wilayah Singapura. Dapatkan URL: https://www.alibabacloud.com/help/en/model-studio/image-to-video-api-reference
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan kunci API Model Studio Anda: apiKey="sk-xxx"
    // Dapatkan kunci API Anda: https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");
    
    /**
     * Metode input gambar: Pilih salah satu dari tiga berikut
     *
     * 1. Gunakan URL publik - Cocok untuk gambar yang dapat diakses publik
     * 2. Gunakan file lokal - Cocok untuk pengembangan dan pengujian lokal
     * 3. Gunakan encoding Base64 - Cocok untuk gambar pribadi atau skenario yang memerlukan transmisi terenkripsi
     */

    // [Metode 1] URL publik
    static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";

    // [Metode 2] Jalur file lokal (file://+jalur absolut)
    // static String imgUrl = "file://" + "/your/path/to/img.png";    // Linux/macOS
    // static String imgUrl = "file://" + "/C:/your/path/to/img.png";  // Windows

    // [Metode 3] Encoding Base64
    // static String imgUrl = Image2Video.encodeFile("/your/path/to/img.png");
    
    // Atur URL audio
    static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";

    public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
        // Atur parameter
        Map<String, Object> parameters = new HashMap<>();
        parameters.put("prompt_extend", true);
        parameters.put("watermark", false);
        parameters.put("seed", 12345);

        VideoSynthesis vs = new VideoSynthesis();
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.6-i2v-flash")
                        .prompt("A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.")
                        .imgUrl(imgUrl)
                        .audioUrl(audioUrl)
                        .duration(10)
                        .parameters(parameters)
                        .resolution("720P")
                        .negativePrompt("")
                        .build();
        System.out.println("please wait...");
        VideoSynthesisResult result = vs.call(param);
        System.out.println(JsonUtils.toJson(result));
    }
    
     /**
     * Encode file menjadi string Base64
     * @param filePath Jalur file
     * @return String Base64 dalam format: data:{MIME_type};base64,{base64_data}
     */
    public static String encodeFile(String filePath) {
        Path path = Paths.get(filePath);
        if (!Files.exists(path)) {
            throw new IllegalArgumentException("File tidak ada: " + filePath);
        }
        // Deteksi tipe MIME
        String mimeType = null;
        try {
            mimeType = Files.probeContentType(path);
        } catch (IOException e) {
            throw new IllegalArgumentException("Tidak dapat mendeteksi tipe file: " + filePath);
        }
        if (mimeType == null || !mimeType.startsWith("image/")) {
            throw new IllegalArgumentException("Format gambar tidak didukung atau tidak dikenali");
        }
        // Baca konten file dan encode
        byte[] fileBytes = null;
        try{
            fileBytes = Files.readAllBytes(path);
        } catch (IOException e) {
            throw new IllegalArgumentException("Tidak dapat membaca konten file: " + filePath);
        }
    
        String encodedString = Base64.getEncoder().encodeToString(fileBytes);
        return "data:" + mimeType + ";base64," + encodedString;
    }
    

    public static void main(String[] args) {
        try {
            image2video();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}
Contoh respons
video_url berlaku selama 24 jam. Segera unduh video tersebut.
{
    "request_id": "87c091bb-7a3c-4904-8501-xxxxxx",
    "output": {
        "task_id": "413ed6e4-5f3a-4f57-8d58-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "orig_prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
        "submit_time": "2026-01-22 23:25:45.729",
        "scheduled_time": "2026-01-22 23:25:45.771",
        "end_time": "2026-01-22 23:26:44.942"
    },
    "usage": {
        "video_count": 1,
        "duration": 10.0,
        "input_video_duration": 0.0,
        "output_video_duration": 10.0,
        "SR": "720"
    },
    "status_code": 200,
    "code": "",
    "message": ""
}

Pemanggilan asinkron

Contoh ini menunjukkan pemanggilan asinkron. Mengembalikan task ID segera. Anda harus melakukan polling untuk hasil atau menunggu hingga selesai.

Contoh permintaan
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisListResult;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.task.AsyncTaskListParam;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.util.HashMap;
import java.util.Map;

public class Image2Video {

    static {
        // URL wilayah Singapura. Dapatkan URL: https://www.alibabacloud.com/help/en/model-studio/image-to-video-api-reference
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan kunci API Model Studio Anda: api_key="sk-xxx"
    // Dapatkan kunci API Anda: https://www.alibabacloud.com/help/zh/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");
    // Atur URL gambar input
    static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";

    // Atur URL audio
    static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";

    public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
        // Atur parameter
        Map<String, Object> parameters = new HashMap<>();
        parameters.put("prompt_extend", true);
        parameters.put("watermark", false);
        parameters.put("seed", 12345);

        VideoSynthesis vs = new VideoSynthesis();
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.6-i2v-flash")
                        .prompt("A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.")
                        .imgUrl(imgUrl)
                        .audioUrl(audioUrl)
                        .duration(10)
                        .parameters(parameters)
                        .resolution("720P")
                        .negativePrompt("")
                        .build();
        // Pemanggilan asinkron
        VideoSynthesisResult task = vs.asyncCall(param);
        System.out.println(JsonUtils.toJson(task));
        System.out.println("please wait...");

        // Dapatkan hasil
        VideoSynthesisResult result = vs.wait(task, apiKey);
        System.out.println(JsonUtils.toJson(result));
    }

    // Dapatkan daftar tugas
    public static void listTask() throws ApiException, NoApiKeyException {
        VideoSynthesis is = new VideoSynthesis();
        AsyncTaskListParam param = AsyncTaskListParam.builder().build();
        param.setApiKey(apiKey);
        VideoSynthesisListResult result = is.list(param);
        System.out.println(result);
    }

    // Dapatkan hasil tugas tunggal
    public static void fetchTask(String taskId) throws ApiException, NoApiKeyException {
        VideoSynthesis is = new VideoSynthesis();
        // Jika DASHSCOPE_API_KEY diatur sebagai variabel lingkungan, apiKey bisa null
        VideoSynthesisResult result = is.fetch(taskId, apiKey);
        System.out.println(result.getOutput());
        System.out.println(result.getUsage());
    }

    public static void main(String[] args) {
        try {
            image2video();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}
Contoh respons

1. Contoh respons untuk pembuatan tugas

{
    "request_id": "5dbf9dc5-4f4c-9605-85ea-xxxxxxxx",
    "output": {
        "task_id": "7277e20e-aa01-4709-xxxxxxxx",
        "task_status": "PENDING"
    }
}

2. Contoh respons untuk mengkueri hasil tugas

video_url berlaku selama 24 jam. Segera unduh video tersebut.
{
    "request_id": "87c091bb-7a3c-4904-8501-xxxxxx",
    "output": {
        "task_id": "413ed6e4-5f3a-4f57-8d58-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "orig_prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
        "submit_time": "2026-01-22 23:25:45.729",
        "scheduled_time": "2026-01-22 23:25:45.771",
        "end_time": "2026-01-22 23:26:44.942"
    },
    "usage": {
        "video_count": 1,
        "duration": 10.0,
        "input_video_duration": 0.0,
        "output_video_duration": 10.0,
        "SR": "720"
    },
    "status_code": 200,
    "code": "",
    "message": ""
}

Batasan

  • Validitas data: Baik task_id maupun URL video hanya disimpan selama 24 jam. Setelah kedaluwarsa, tidak dapat dikueri atau diunduh.

  • Moderasi konten: Konten input (misalnya, prompt, gambar) dan video output menjalani pemeriksaan keamanan konten. Pelanggaran mengembalikan kesalahan seperti “IPInfringementSuspect” atau “DataInspectionFailed”. Lihat Pesan kesalahan.

  • Konfigurasi akses jaringan: Tautan video disimpan di OSS Alibaba Cloud. Jika sistem bisnis Anda tidak dapat mengakses tautan OSS eksternal karena kebijakan keamanan, tambahkan domain OSS berikut ke daftar putih akses jaringan Anda.

    # Daftar domain OSS
    dashscope-result-bj.oss-cn-beijing.aliyuncs.com
    dashscope-result-hz.oss-cn-hangzhou.aliyuncs.com
    dashscope-result-sh.oss-cn-shanghai.aliyuncs.com
    dashscope-result-wlcb.oss-cn-wulanchabu.aliyuncs.com
    dashscope-result-zjk.oss-cn-zhangjiakou.aliyuncs.com
    dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com
    dashscope-result-hy.oss-cn-heyuan.aliyuncs.com
    dashscope-result-cd.oss-cn-chengdu.aliyuncs.com
    dashscope-result-gz.oss-cn-guangzhou.aliyuncs.com
    dashscope-result-wlcb-acdr-1.oss-cn-wulanchabu-acdr-1.aliyuncs.com

Kode kesalahan

Jika pemanggilan model gagal dan mengembalikan kesalahan, lihat Pesan kesalahan untuk troubleshooting.

FAQ

T: Bagaimana cara menghasilkan video dengan rasio aspek tertentu (misalnya, 3:4)?

J: Rasio aspek video output ditentukan oleh gambar first-frame input (img_url). Namun, rasio eksak (misalnya, tepat 3:4) tidak dijamin—penyimpangan kecil dapat terjadi.

Mengapa terjadi penyimpangan: Model menggunakan rasio gambar input Anda sebagai garis dasar dan menghitung resolusi valid terdekat berdasarkan total piksel target (ditentukan oleh resolusi). Karena lebar dan tinggi harus kelipatan 16, dilakukan penyesuaian kecil. Jadi meskipun rasio output tidak tepat 3:4, akan sangat mendekati.

Contoh: Gambar input 750×1000 (rasio aspek 3:4 = 0,75), dengan resolusi = "720P" (target ~920.000 piksel) menghasilkan output 816×1104 (rasio aspek ≈ 0,739, ~900.000 piksel).

Praktik terbaik:

  1. Kontrol input: Gunakan gambar dengan rasio aspek target sebagai first frame.

  2. Pasca-pemrosesan: Jika rasio ketat diperlukan, potong atau tambahkan padding pada video yang dihasilkan menggunakan alat editing.