Model text-to-video Wan menerima input multimodal (teks, gambar, dan audio) serta menghasilkan video berdurasi hingga 15 detik dengan resolusi maksimal 1080P.
-
Kemampuan inti: Menghasilkan video berdurasi 2 hingga 15 detik dengan resolusi 480P, 720P, atau 1080P. Mendukung penulisan ulang prompt cerdas dan pemberian watermark.
-
Kemampuan audio: Secara otomatis memberikan dubbing pada video atau menerima file audio kustom untuk sinkronisasi audio dan video. (wan2.7/wan2.6/wan2.5)
-
Narasi multi-shot: Membuat video dengan beberapa shot sekaligus menjaga konsistensi subjek utama di seluruh transisi. (wan2.7/wan2.6)
Akses cepat: Coba secara online (Singapura | AS (Virginia) | Tiongkok (Beijing)) | Referensi API | Panduan prompt
Mulai
|
Masukan prompt |
Video output (multi-shot, audio aktif) |
|
Shot 1 Adegan dibuka dengan extreme long shot. Kamera mulai dari sudut rendah dekat tanah dan bergerak maju melewati padang rumput sambil mengarah ke atas. Saat kamera naik dari permukaan tanah ke posisi yang sedikit lebih tinggi, cheetah masuk ke dalam frame dari kiri. Shot ini menetapkan hubungan spasial yang jelas dengan menempatkan cheetah dan antelope yang sedang melarikan diri pada jalur yang sama. Shot 2 Kamera turun ke posisi dekat permukaan tanah dan mengikuti ke kanan, sejajar dengan cheetah. Cheetah tetap konsisten di sebelah kiri tengah frame, menciptakan pergeseran lateral berkelanjutan pada latar belakang. Untuk periode tertentu, gerakan kamera tetap stabil guna meningkatkan rasa kecepatan dan kontinuitas spasial. Shot 3 Sambil tetap bergerak ke kanan, kamera melakukan gerakan busur ringan di sepanjang sisi dalam jalur cheetah. Gerakan ini menciptakan efek orbit halus dalam frame saat kamera terus mengikuti subjek. Shot 4 Kamera secara bertahap memperlambat gerakan lateralnya dan menjadi relatif stabil sambil melakukan zoom in. Aksi ini mempersempit fokus ke jarak yang semakin mengecil antara cheetah dan antelope. Shot 5 Kamera kembali bergerak maju dan sedikit ke bawah, mendekati permukaan tanah untuk memperpendek jarak antara kedua hewan tersebut. Shot berhenti pada titik kritis tepat saat kaki depan cheetah hampir menyentuh bagian belakang antelope, menciptakan tekanan dan ketegangan yang intens. Aksi ini disinkronkan dengan alunan musik simfoni yang menguat, dentuman drum yang semakin rapat, serta suara angin dan langkah kaki yang mengatur ritme. Di momen terakhir, volume musik turun, hanya menyisakan suara ambient dan ritmis untuk menciptakan jeda singkat. |
Sebelum melakukan panggilan API, dapatkan Kunci API dan tetapkan sebagai Variabel lingkungan. Untuk menggunakan SDK, instal DashScope SDK. Semua contoh menggunakan pemanggilan asinkron yang mengirimkan tugas pembuatan video dan melakukan polling untuk hasilnya.
Python SDK
Pastikan versi DashScope SDK untuk Python Anda adalah 1.25.16 atau lebih baru sebelum menjalankan kode berikut.
Jika versi terlalu rendah, kesalahan seperti "url error, please check url!" dapat terjadi. Untuk memperbarui SDK, lihat Instal SDK.
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY", "YOUR_API_KEY")
print('please wait...')
rsp = VideoSynthesis.call(api_key=api_key,
model='wan2.7-t2v-2026-06-12',
prompt='Shot 1: Opening with a long shot. The camera starts from a low angle close to the ground and moves forward across the grassland. At the same time, the camera moves upward, gradually raising the point of view from ground level to a slightly elevated position. A cheetah enters the frame from the left, on the same chase path as a fleeing antelope in front of it, establishing a clear foreground-background spatial relationship. Shot 2: The camera moves downward, returning to a position close to the ground, and pans right to follow the cheetah\'s movement, steadily tracking it from a parallel side view. The subject remains consistently positioned slightly to the left of the frame\'s center, creating a continuous lateral movement effect in the background. The camera movement stays stable for a while to enhance the sense of speed and spatial continuity. Shot 3: While maintaining the rightward movement, the camera moves in a slight arc along the inside of the cheetah\'s path. This creates a subtle circling effect in the shot, but the camera always moves in the same direction as the subject. Shot 4: Gradually slow down the lateral movement and transition to a relatively stable camera position. At the same time, execute a zoom-in, progressively narrowing the visual focus onto the shrinking distance between the cheetah and the antelope. Shot 5: The camera moves forward again and slightly downward, closing in on the space between the two animals near the ground. It holds the shot at the critical moment when the cheetah\'s forelimbs are about to reach the antelope\'s rear, creating intense pressure and tension. This is accompanied by a crescendoing symphonic score, an increasingly intense drumbeat, and the sounds of wind and footsteps to drive the rhythm. In the final moments, the music volume drops, leaving only ambient and rhythmic sounds for a brief pause.',
resolution="720P",
ratio="16:9",
duration=15,
prompt_extend=True,
watermark=True)
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))
Java SDK
Pastikan versi DashScope SDK untuk Java Anda adalah 2.22.14 atau lebih baru sebelum menjalankan kode berikut.
Jika versi terlalu rendah, dapat muncul error seperti "url error, please check url!". Untuk memperbarui SDK, lihat Instal SDK.
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;
public class Text2Video {
static {
// URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan Kunci API Model Studio Anda: apiKey="sk-xxx"
// Kunci API berbeda-beda tergantung wilayah. Untuk mendapatkan Kunci API, kunjungi: https://www.alibabacloud.com/help/en/model-studio/get-api-key
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void text2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.7-t2v-2026-06-12")
.prompt("Shot 1: Open with a long shot. The camera starts at a low angle near the ground, dollying forward across the grassland while simultaneously craning up. The perspective lifts from ground level to a slightly elevated position, allowing a cheetah to enter the frame from the left, on the same chase path as a fleeing antelope ahead, establishing a clear spatial depth. Shot 2: The camera moves down to near ground level and tracks right, following the cheetah's movement. It maintains a stable, parallel tracking shot. The subject remains just left of the frame's center, creating a continuous lateral movement in the background. The camera motion stays steady for a period to enhance the sense of speed and spatial continuity. Shot 3: While maintaining the rightward track, the camera executes a slight arc along the inner side of the cheetah's path. This creates a subtle orbiting effect in the shot, while the camera continues to point in the same direction as the subject. Shot 4: Gradually slow the lateral movement, transitioning to a relatively stable camera position. Simultaneously, execute a zoom-in, progressively narrowing the visual focus onto the shrinking distance between the cheetah and the antelope. Shot 5: The camera moves forward and slightly downward again, staying close to the ground to close in on the space between the two. It stops at the critical moment just as the cheetah's forelimbs are about to reach the antelope's rear, creating intense pressure and tension. This is accompanied by a gradually intensifying orchestral score, increasingly dense drumbeats, and the sounds of wind and footsteps to drive the rhythm. In the final stage, the music volume is lowered, leaving only ambient and rhythmic sounds for a brief pause.")
.duration(15)
.resolution("720P")
.ratio("16:9")
.promptExtend(true)
.watermark(true)
.build();
System.out.println("please wait...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
text2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}
curl
Langkah 1: Buat tugas untuk mendapatkan ID tugas
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.7-t2v-2026-06-12",
"input": {
"prompt": "Shot 1: An extreme long shot opens the scene. The camera starts from a low angle near the ground and moves forward across the grassland. It simultaneously tilts up, raising the perspective from ground level to a slightly higher position. This brings a cheetah into the frame from the left, placing it on the same chase path as a fleeing antelope ahead and establishing a clear spatial relationship. Shot 2: The camera moves down, returning to near ground level, and tracks right along the cheetahs path of motion. It maintains a stable, parallel side-on follow shot, keeping the subject in the left-center of the frame as the background scrolls horizontally. The camera movement remains steady for a period to enhance the sense of speed and spatial continuity. Shot 3: While continuing to track right, the camera makes a slight arc along the inner side of the cheetahs path, creating a subtle orbiting effect while always moving in the same direction as the subject. Shot 4: The camera gradually slows its horizontal movement and transitions to a relatively stable position while zooming in. This progressively compresses the visual focus onto the shrinking distance between the cheetah and the antelope. Shot 5: The camera moves forward again and slightly down, closing in on the space between them near the ground. It stops at the critical moment when the cheetahs forelimbs are about to reach the antelopes rear, creating intense pressure and tension. This is accompanied by a crescendo of symphonic music, an accelerating drumbeat, and the sounds of wind and paws hitting the ground to drive the rhythm. In the final stage, the music fades, leaving only ambient sounds and the rhythmic beat for a brief pause."
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"prompt_extend": true,
"watermark": true,
"duration": 15
}
}'
Langkah 2: Ambil hasil menggunakan ID tugas
Ganti {task_id} dengan nilai task_id yang dikembalikan oleh panggilan API sebelumnya. task_id berlaku untuk kueri selama 24 jam.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"Contoh output
video_url berlaku selama 24 jam. Unduh video segera.{
"request_id": "c1209113-8437-424f-a386-xxxxxx",
"output": {
"task_id": "966cebcd-dedc-4962-af88-xxxxxx",
"task_status": "SUCCEEDED",
"video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
...
},
...
}
Ketersediaan
Model yang didukung berbeda-beda tergantung wilayah. Sumber daya diisolasi antar-wilayah. Saat melakukan panggilan, pastikan model, URL endpoint, dan Kunci API Anda semuanya berasal dari wilayah yang sama. Panggilan lintas wilayah akan gagal.
Model yang didukung:
Global
Jika Anda memilih cakupan Penerapan Global, sumber daya komputasi inferensi model dijadwalkan secara dinamis di seluruh dunia. Data statis disimpan di wilayah yang Anda pilih. Wilayah yang didukung: AS (Virginia), Jerman (Frankfurt) Tiongkok (Hong Kong).
|
Model |
Fitur |
Modalitas input |
Spesifikasi video output |
|
wan2.6-t2v |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: 5s, 10s, 15s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
Internasional
Jika Anda memilih cakupan Penerapan Internasional, sumber daya komputasi inferensi model dijadwalkan secara dinamis di seluruh dunia, tidak termasuk Tiongkok daratan. Data statis disimpan di wilayah yang Anda pilih. Wilayah yang didukung: Singapura.
|
Model |
Fitur |
Modalitas input |
Spesifikasi video output |
|
wan2.7-t2v-2026-04-25 |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: [2s, 15s] (integer) Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.7-t2v |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: [2s, 15s] (integer) Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.6-t2v |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: [2s, 15s] (integer) Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.5-t2v-preview |
Video dengan audio Sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 480P, 720P, 1080P Durasi video: 5s, 10s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.2-t2v-plus |
Video tanpa suara Stabilitas dan tingkat keberhasilan lebih baik dibandingkan model 2.1. |
Teks |
Opsi resolusi: 480P, 1080P Durasi video: 5s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.1-t2v-turbo |
Video tanpa suara |
Teks |
Opsi resolusi: 480P, 720P Durasi video: 5s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.1-t2v-plus |
Video tanpa suara |
Teks |
Opsi resolusi: 720P Durasi video: 5s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
AS
Jika Anda memilih cakupan Penerapan AS, sumber daya komputasi inferensi model dibatasi hanya untuk Amerika Serikat. Data statis disimpan di wilayah yang Anda pilih. Wilayah yang didukung: AS (Virginia).
|
Model |
Fitur |
Modalitas input |
Spesifikasi video output |
|
wan2.6-t2v-us |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: 5s, 10s, 15s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
Tiongkok daratan
Jika Anda memilih cakupan Penerapan Tiongkok daratan, sumber daya komputasi inferensi model dibatasi hanya untuk Tiongkok daratan. Data statis disimpan di wilayah yang Anda pilih. Wilayah yang didukung: Tiongkok (Beijing).
|
Model |
Fitur |
Modalitas input |
Spesifikasi video output |
|
wan2.7-t2v-2026-04-25 |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: [2s, 15s] (integer) Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.7-t2v |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: [2s, 15s] (integer) Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.6-t2v |
Video dengan audio Narasi multi-shot, sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 720P, 1080P Durasi video: [2s, 15s] (integer) Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.5-t2v-preview |
Video dengan audio Sinkronisasi audio-video |
Teks, audio |
Opsi resolusi: 480P, 720P, 1080P Durasi video: 5s, 10s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wan2.2-t2v-plus |
Video tanpa suara Stabilitas dan tingkat keberhasilan lebih baik dibandingkan model 2.1. |
Teks |
Opsi resolusi: 480P, 1080P Durasi video: 5s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wanx2.1-t2v-turbo |
Video tanpa suara |
Teks |
Opsi resolusi: 480P, 720P Durasi video: 5s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
|
wanx2.1-t2v-plus |
Video tanpa suara |
Teks |
Opsi resolusi: 720P Durasi video: 5s Spesifikasi tetap: 30 fps, MP4 (encoding H.264) |
Kode contoh dalam topik ini berlaku untuk wilayah Singapura.
Kemampuan inti
Buat video multi-shot
Model yang didukung: seri wan2.7 dan wan2.6.
Deskripsi: Secara otomatis beralih antar-shot — misalnya, dari wide shot ke close-up. Ideal untuk video musik dan narasi sinematik.
Parameter:
-
wan2.7: Parameter
shot_typetidak diperlukan. Jelaskan struktur shot dalampromptmenggunakan bahasa alami, seperti timestamp untuk menentukan shot. Jikaprompttidak berisi deskripsi struktur shot, model akan menganalisis semantik dan secara otomatis menentukan apakah akan menghasilkan video single-shot atau multi-shot. -
wan2.6: Parameter
shot_typeharus diatur ke"multi", dan parameterprompt_extendharus diatur ketrueuntuk mengaktifkan penulisan ulang cerdas guna mengoptimalkan deskripsi shot.
|
Input prompt |
Video output (wan2.7) |
|
Visi harmoni antara teknologi masa depan dan alam. Shot 1 [0-2s]: Wide shot taman udara di kota futuristik, tanaman mengambang bergoyang lembut tertiup angin. Shot 2 [2-4s]: Tukang kebun robot memangkas tanaman dengan gerakan presisi dan anggun. Shot 3 [4-7s]: Sinar matahari menembus kubah transparan, menerangi seluruh taman dan menunjukkan perpaduan sempurna antara teknologi dan alam. Shot 4 [7-10s]: Kamera mundur untuk mengungkap skala megah seluruh kota futuristik, dengan taman udara sebagai salah satu bagiannya. |
|
|
Ini adalah cuplikan film seni bela diri yang berpusat pada duel keras. Di area batu terbuka di bawah terik matahari siang, dua pria saling menyerang. Salah satunya menyerang dengan telapak tangannya, tetapi lawannya berputar dan memblokir dengan lengannya, benturan tersebut mengangkat debu dari tanah. Mereka kemudian saling bertukar pukulan dan serangan telapak tangan secara cepat dalam ruang sempit. Salah satunya melompat ke udara untuk melakukan serangkaian tendangan keras, memaksa lawannya menyilangkan lengannya untuk memblokir dan tergelincir mundur beberapa meter, meninggalkan bekas putih jelas di permukaan batu. Akhirnya, mereka berdiri terpisah, bernapas berat dan saling menatap. Adegan ini menghadirkan tekstur aksi realistis dengan pencahayaan tajam, menciptakan nada yang berubah dari ledakan kuat menjadi ketegangan. |
Python SDK
Pastikan SDK DashScope untuk Python Anda berada pada versi 1.25.16 atau lebih baru. Untuk memperbarui SDK, lihat 安装SDK.import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan api_key="sk-xxx". Gunakan Kunci API Model Studio Anda.
# Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key.
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_t2v():
# Pemanggilan asinkron yang mengembalikan task_id.
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.7-t2v-2026-06-12',
prompt='A vision of harmony between future technology and nature. Shot 1 [0-2s]: Wide shot of an aerial garden in a futuristic city, floating plants swaying gently in the breeze. Shot 2 [2-4s]: A robot gardener carefully trims plants with precise, graceful movements. Shot 3 [4-7s]: Sunlight streams through a transparent dome, illuminating the entire garden and showcasing the perfect fusion of technology and nature. Shot 4 [7-10s]: The camera pulls back to reveal the grand scale of the entire futuristic city, with the aerial garden as just one part of it.',
resolution='720P',
ratio='16:9',
duration=10,
prompt_extend=True,
watermark=True,
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))
# 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_t2v()
Java SDK
Pastikan SDK DashScope untuk Java Anda menggunakan versi 2.22.14 atau yang lebih baru. Untuk memperbarui SDK, lihat Instal SDK.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;
public class Text2Video {
static {
// URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan apiKey="sk-xxx". Gunakan Kunci API Model Studio Anda.
// Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key.
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void text2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.7-t2v-2026-06-12")
.prompt("A vision of harmony between future technology and nature. Shot 1 [0-2s]: Wide shot of an aerial garden in a futuristic city, floating plants swaying gently in the breeze. Shot 2 [2-4s]: A robot gardener carefully trims plants with precise, graceful movements. Shot 3 [4-7s]: Sunlight streams through a transparent dome, illuminating the entire garden and showcasing the perfect fusion of technology and nature. Shot 4 [7-10s]: The camera pulls back to reveal the grand scale of the entire futuristic city, with the aerial garden as just one part of it.")
.negativePrompt("")
.resolution("720P")
.ratio("16:9")
.duration(10)
.promptExtend(true)
.watermark(true)
.seed(12345)
.build();
// Pemanggilan asinkron
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
// Dapatkan hasilnya
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
text2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}
curl
Langkah 1: Buat tugas untuk mendapatkan ID tugas
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.7-t2v-2026-06-12",
"input": {
"prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: \"The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them \".",
"audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3"
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"prompt_extend": true,
"duration": 10
}
}'
Langkah 2: Ambil hasil menggunakan ID tugas
Ganti {task_id} dengan nilai task_id yang dikembalikan oleh panggilan API sebelumnya. task_id berlaku untuk kueri selama 24 jam.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"Sinkronisasi audio dan video
Model yang didukung: seri wan2.7, wan2.6, dan wan2.5.
Deskripsi: Karakter dalam foto dapat "berbicara" atau menyanyi, dengan gerakan mulut yang sesuai dengan audio. Untuk contoh lainnya, lihat Pembuatan video audio.
Parameter:
-
Sediakan file audio: Atur
audio_url. Model akan menyinkronkan gerakan mulut dengan file audio tersebut. -
Dubbing otomatis: Tanpa
audio_url, model secara default menghasilkan video dengan audio — menambahkan efek suara latar, musik, atau suara berdasarkan konten visual.
|
Contoh input |
Video output (video dengan audio) |
|
Prompt input: Diambil dari sudut rendah, dalam medium close-up, dengan nada hangat, pencahayaan campuran (cahaya praktis dari lampu meja menyatu dengan cahaya mendung dari jendela), pencahayaan samping, dan komposisi sentral. Di kantor detektif klasik, rak buku kayu penuh dengan berkas kasus lama dan asbak. Lampu meja hijau menerangi berkas kasus yang tersebar di tengah meja. Seekor rubah, mengenakan mantel hujan coklat tua dan fedora abu-abu muda, duduk di kursi kulit, bulunya merah tua, ekornya bertumpu ringan di tepi, jarinya perlahan membalik halaman-halaman yang menguning. Di luar, hujan gerimis turun di bawah langit biru, menggores kaca dengan garis-garis berkelok. Perlahan ia mengangkat kepalanya, telinganya bergerak sedikit, matanya yang kuning keemasan menatap langsung ke kamera, mulutnya jelas bergerak saat berbicara dengan suara halus dan sinis: 'Kasus ini dingin, lebih dingin dari ikan di musim dingin. Tapi setiap ayam punya rahasia, dan saya, untuk satu, berniat menemukannya '. Audio masukan: |
Python SDK
Pastikan SDK DashScope untuk Python Anda menggunakan versi 1.25.16 atau yang lebih baru. Untuk memperbarui SDK, lihat Instal SDK.import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan api_key="sk-xxx". Gunakan Kunci API Model Studio Anda.
# Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key.
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_t2v():
# Pemanggilan asinkron yang mengembalikan task_id.
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.7-t2v-2026-06-12',
prompt="Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '.",
audio_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3',
resolution='720P',
ratio='16:9',
duration=10,
prompt_extend=True,
watermark=True,
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))
# 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_t2v()
Java SDK
Pastikan versi DashScope SDK untuk Java Anda adalah 2.22.14 atau lebih baru. Untuk memperbarui SDK, lihat 安装SDK.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;
public class Text2Video {
static {
// URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan apiKey="sk-xxx". Gunakan Kunci API Model Studio Anda.
// Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key.
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void text2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.7-t2v-2026-06-12")
.prompt("Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '.")
.audioUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3")
.negativePrompt("")
.resolution("720P")
.ratio("16:9")
.duration(10)
.promptExtend(true)
.watermark(true)
.seed(12345)
.build();
// Pemanggilan asinkron
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
// Dapatkan hasilnya
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
text2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}
curl
Langkah 1: Buat tugas untuk mendapatkan ID tugas
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.7-t2v-2026-06-12",
"input": {
"prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: \"The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them \". ",
"audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3"
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"watermark": true,
"prompt_extend": true,
"duration": 10
}
}'
Langkah 2: Ambil hasil menggunakan ID tugas
Ganti {task_id} dengan nilai task_id yang dikembalikan oleh panggilan API sebelumnya. task_id berlaku untuk kueri selama 24 jam.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"Hasilkan video tanpa suara
Model yang didukung: seri wan2.2, seri wan2.1.
Deskripsi: Paling cocok untuk skenario yang hanya membutuhkan konten visual, seperti poster dinamis dan video pendek tanpa suara.
Parameter: Model wan2.2 dan versi sebelumnya menghasilkan video tanpa suara secara default. Tidak diperlukan konfigurasi tambahan.
|
Prompt masukan |
Video output (video tanpa suara) |
|
Rim light, kontras rendah, medium close-up, siang hari, komposisi condong kiri, shot tunggal bersih, nada hangat, cahaya lembut, cahaya siang cerah, pencahayaan samping, siang hari. Seorang gadis muda duduk di ladang rumput tinggi dengan dua keledai berbulu lembut berdiri di belakangnya. Gadis itu, sekitar sebelas atau dua belas tahun, mengenakan gaun bunga sederhana, rambutnya dikepang dua, dan memiliki senyum polos. Ia duduk bersila, dengan lembut menyentuh bunga liar di sampingnya. Keledai-keledai itu kokoh, telinganya tegak, dengan rasa ingin tahu melihat ke arah kamera. Sinar matahari memandikan ladang, menciptakan pemandangan hangat dan alami. |
Python SDK
Pastikan SDK DashScope untuk Python Anda menggunakan versi 1.25.16 atau yang lebih baru. Untuk memperbarui SDK, lihat Instal SDK.import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'
# Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan api_key="sk-xxx". Gunakan Kunci API Model Studio Anda.
# Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key.
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_t2v():
# Pemanggilan asinkron yang mengembalikan task_id.
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.2-t2v-plus',
prompt='Rim light, low contrast, medium close-up, daylight, left-heavy composition, clean single-person shot, warm tones, soft light, sunny day light, side light, daytime. A young girl sits in a field of tall grass with two fluffy donkeys standing behind her. The girl, about eleven or twelve, wears a simple floral dress, her hair in two braids, and has an innocent smile. She sits cross-legged, gently touching the wildflowers beside her. The donkeys are sturdy, their ears pricked up, curiously looking toward the camera. Sunlight bathes the field, creating a warm and natural scene.',
prompt_extend=True,
size='832*480',
negative_prompt="",
watermark=True,
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))
# 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_t2v()
Java SDK
Pastikan versi DashScope SDK untuk Java Anda adalah 2.22.14 atau lebih baru. Untuk memperbarui SDK, lihat 安装SDK.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;
public class Text2Video {
static {
// URL berikut untuk wilayah Singapura. URL berbeda-beda tergantung wilayah. Untuk mendapatkan URL wilayah Anda, kunjungi: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// Jika Anda belum mengonfigurasi variabel lingkungan, ganti baris berikut dengan apiKey="sk-xxx". Gunakan Kunci API Model Studio Anda.
// Kunci API berbeda-beda tergantung wilayah. Untuk informasi lebih lanjut tentang cara mendapatkan Kunci API, lihat https://www.alibabacloud.com/help/en/model-studio/get-api-key.
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void text2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.2-t2v-plus")
.prompt("Rim light, low contrast, medium close-up, daylight, left-heavy composition, clean single-person shot, warm tones, soft light, sunny day light, side light, daytime. A young girl sits in a field of tall grass with two fluffy donkeys standing behind her. The girl, about eleven or twelve, wears a simple floral dress, her hair in two braids, and has an innocent smile. She sits cross-legged, gently touching the wildflowers beside her. The donkeys are sturdy, their ears pricked up, curiously looking toward the camera. Sunlight bathes the field, creating a warm and natural scene.")
.size("832*480")
.promptExtend(true)
.watermark(true)
.seed(12345)
.build();
// Pemanggilan asinkron
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
// Dapatkan hasilnya
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
text2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}
curl
Langkah 1: Buat tugas untuk mendapatkan ID tugas
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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-t2v-plus",
"input": {
"prompt": "Rim light, low contrast, medium close-up, daylight, left-heavy composition, clean single-person shot, warm tones, soft light, sunny day light, side light, daytime. A young girl sits in a field of tall grass with two fluffy donkeys standing behind her. The girl, about eleven or twelve, wears a simple floral dress, her hair in two braids, and has an innocent smile. She sits cross-legged, gently touching the wildflowers beside her. The donkeys are sturdy, their ears pricked up, curiously looking toward the camera. Sunlight bathes the field, creating a warm and natural scene."
},
"parameters": {
"size": "832*480",
"prompt_extend": true,
"watermark": true
}
}'
Langkah 2: Ambil hasil menggunakan ID tugas
Ganti {task_id} dengan nilai task_id yang dikembalikan oleh panggilan API sebelumnya. task_id berlaku untuk kueri selama 24 jam.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"Input audio
-
Jumlah file: Satu.
-
Metode input:
-
URL publik: HTTP atau HTTPS.
-
Video output
-
Jumlah video: Satu.
-
Format: MP4. Untuk informasi lebih lanjut, lihat Spesifikasi video.
-
Kadaluarsa URL: 24 jam.
-
Dimensi video:
-
Model wan2.7 menggunakan parameter
resolutiondanratio. -
Model wan2.6 dan versi sebelumnya menggunakan parameter
size.
-
Penagihan dan pembatasan laju
-
Untuk kuota gratis dan detail harga, lihat Wanx-Text-to-Video.
-
Untuk pembatasan laju model, lihat Seri Wanxiang.
-
Detail penagihan:
-
Input gratis. Output ditagih per detik video yang berhasil dihasilkan.
-
Panggilan model yang gagal atau kesalahan pemrosesan tidak dikenai biaya atau menghabiskan kuota gratis.
-
Text-to-video juga mendukung rencana penghematan.
-
Referensi API
FAQ
T: Perubahan kode apa yang diperlukan untuk upgrade dari wan2.6 ke wan2.7?
-
Kontrol resolusi: Model wan2.7 mengganti field
sizedenganresolution(seperti 720p atau 1080p) danratio(seperti 16:9 atau 9:16). -
Kontrol multi-shot: Model wan2.7 mengganti field
shot_typedengan deskripsi bahasa alami dalam prompt. Contohnya:-
Beberapa shot: Masukkan "Generate a multi-shot video" atau gunakan timestamp untuk menggambarkan adegan, seperti "Shot 1 [0-3s] Wide shot: A rainy New York street at night".
-
Single shot: Masukkan "Generate a single-shot video".
-
Jika
prompttidak menyertakan instruksi ini, model akan menginterpretasikan semantik dan secara otomatis menentukan apakah akan menghasilkan video single-shot atau multi-shot.
-