Skip to main content
Text-to-video

Wan — Generate a video from text

Submit text-to-video task

POST
/services/aigc/video-generation/video-synthesis
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope

dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY", "YOUR_API_KEY")

print('please wait...')
rsp = VideoSynthesis.call(api_key=api_key,
                          model='wan2.6-t2v',
                          prompt='A thrilling detective chase story with cinematic storytelling. Shot 1 [0\u20133 s]: Wide shot of a rainy New York street at night, neon lights flickering, a detective in a black trench coat walking briskly. Shot 2 [3\u20136 s]: Medium shot of the detective entering an old building, rain soaking his coat, the door closing slowly behind him. Shot 3 [6\u20139 s]: Close-up of the detective\'s focused, determined eyes as distant sirens wail and he frowns slightly in thought. Shot 4 [9\u201312 s]: Medium shot of the detective moving carefully down a dim hallway, his flashlight illuminating the path ahead. Shot 5 [12\u201315 s]: Close-up of the detective discovering a key clue, his face lighting up with sudden realization.',
                          size="1280*720",
                          duration=15,
                          shot_type="multi",
                          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))
{
  "request_id": "c1209113-8437-424f-a386-xxxxxx",
  "output": {
    "task_id": "966cebcd-dedc-4962-af88-xxxxxx",
    "task_status": "PENDING"
  }
}
The Wan text-to-video model accepts text, images, and audio as input and generates videos up to 15 seconds long at 1080P resolution.
  • Core capabilities: Integer video durations (2–15 seconds), custom resolutions (480P, 720P, 1080P), prompt rewriting, and watermarking.
  • Audio capabilities: Automatic dubbing or custom audio files for audio-video sync. (Supported by wan2.5 and wan2.6)
  • Multi-shot narrative: Multiple shots with consistent main subject across transitions. (Supported only by wan2.6)

Authorizations

string
header
required

DashScope API Key. Get one from the Qwen Cloud console.

Header Parameters

enum<string>
required

Must be set to enable for asynchronous task submission.

enable

Body

application/json
enum<string>
required

Model name. See the model table in the endpoint description for supported models and their capabilities.

wan2.6-t2v,wan2.5-t2v-preview,wan2.2-t2v-plus,wan2.1-t2v-turbo,wan2.1-t2v-plus
wan2.6-t2v
object
required

Input data for video generation.

object

Video generation parameters.

Response

200-application/json
string

Unique request identifier for tracing and troubleshooting.

c1209113-8437-424f-a386-xxxxxx
object