Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Wan 2.6 e anteriores – Recuperar resultado de texto para vídeo
Verifique o status da tarefa de vídeo (wan2.6 e anteriores)
Estratégia de votação
- Envie uma tarefa via Gerar um vídeo a partir de texto e salve o retornado
task_id. - Faça pesquisas a cada 15 segundos até
task_statusalcançaSUCCEEDEDouFAILED. - Em caso de sucesso, recupere o vídeo de
video_url.
Notas
- Expiração do URL: download em 24 horas —
video_urlexpira depois disso. - Fluxo de status:
PENDING→RUNNING→SUCCEEDED/FAILED.
OpenAPI
openapi: 3.1.0
info:
title: Wan Text-to-Video API
description: Wan text-to-video generation API. Supports multimodal input (text, images, audio) and generates videos up to 15 seconds at 1080P resolution. Uses asynchronous task submission — submit a task, then poll for results.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/tasks/{task_id}:
get:
operationId: getTextToVideoTaskStatus
summary: Query task result
description: Query the status and result of the video generation task.
parameters:
- name: task_id
in: path
required: true
description: Task ID returned by the POST submission endpoint.
schema:
type: string
responses:
"200":
description: Task status retrieved successfully
content:
application/json:
schema:
$ref: "#/components/schemas/TaskStatusResponse"
examples:
SUCCEEDED:
summary: Task succeeded
value:
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
task_metrics:
TOTAL: 1
SUCCEEDED: 1
FAILED: 0
usage:
video_count: 1
video_duration: 10
FAILED:
summary: Task failed
value:
request_id: c1209113-8437-424f-a386-xxxxxx
output:
task_id: 966cebcd-dedc-4962-af88-xxxxxx
task_status: FAILED
code: InvalidParameter
message: The specified parameter is not valid.
task_metrics:
TOTAL: 1
SUCCEEDED: 0
FAILED: 1
RUNNING:
summary: Task running
value:
request_id: c1209113-8437-424f-a386-xxxxxx
output:
task_id: 966cebcd-dedc-4962-af88-xxxxxx
task_status: RUNNING
task_metrics:
TOTAL: 1
SUCCEEDED: 0
FAILED: 0
"400":
description: Invalid request parameters
content:
application/json:
schema:
$ref: "#/components/schemas/DashScopeErrorResponse"
x-codeSamples:
- lang: curl
label: cURL - Query task result
source: |-
# Replace {task_id} with the actual task ID from the submit response
curl -X GET 'https://maas.qwencloudapi.com/api/v1/tasks/{task_id}' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: DashScope API Key. Get one from the [QwenCloud console](https://home.qwencloud.com/api-keys).
schemas:
TextToVideoRequest:
type: object
required:
- model
- input
properties:
model:
type: string
description: Model name. See the model table in the endpoint description for supported models and their capabilities.
enum:
- wan2.6-t2v
- wan2.5-t2v-preview
- wan2.2-t2v-plus
- wan2.1-t2v-turbo
- wan2.1-t2v-plus
example: wan2.6-t2v
input:
type: object
required:
- prompt
description: Input data for video generation.
properties:
prompt:
type: string
description: "Text prompt describing the desired video content. Maximum length: 1,500 characters for wan2.6 and wan2.5 series; 800 characters for wan2.2 and wan2.1 series. Text beyond the limit is auto-truncated. For multi-shot videos (wan2.6), use the format: `Shot 1 [0–3 s]: description. Shot 2 [3–6 s]: description.` etc."
example: A thrilling detective chase story with cinematic storytelling.
audio_url:
type: string
format: uri
description: "URL of an audio file for audio-video synchronization. The model aligns mouth movements and actions to the audio. Supports HTTP/HTTPS URLs. **Supported by wan2.5 and wan2.6 series only.** If omitted on wan2.5/wan2.6, the model auto-generates background audio (automatic dubbing). Audio limits: Format: wav, mp3. Duration: 3 to 30 seconds. File size: up to 15 MB."
parameters:
$ref: "#/components/schemas/TextToVideoParameters"
TextToVideoParameters:
type: object
description: Video generation parameters.
properties:
size:
type: string
description: |-
Output video resolution as `width*height`. Available sizes depend on the model:
- **wan2.6-t2v**: `1280*720` (720P), `1920*1080` (1080P)
- **wan2.5-t2v-preview**: `832*480` (480P), `1280*720` (720P), `1920*1080` (1080P)
- **wan2.2-t2v-plus**: `832*480` (480P), `1920*1080` (1080P)
- **wan2.1-t2v-turbo**: `832*480` (480P), `1280*720` (720P)
- **wan2.1-t2v-plus**: `1280*720` (720P)
example: 1280*720
duration:
type: integer
description: |-
Video duration in seconds. Available durations depend on the model:
- **wan2.6-t2v**: Integer from 2 to 15
- **wan2.5-t2v-preview**: 5 or 10
- **wan2.2-t2v-plus, wan2.1 series**: Fixed at 5
example: 15
shot_type:
type: string
description: Shot composition mode. `"single"` (default) outputs a single-shot video; `"multi"` enables multi-shot narrative with automatic shot transitions. **Supported by wan2.6 series only.**
default: single
enum:
- single
- multi
prompt_extend:
type: boolean
description: "Enable prompt rewriting. `true` (default): the model optimizes your prompt for better results. `false`: use your prompt as-is. Recommended to enable for multi-shot videos."
default: true
watermark:
type: boolean
description: "Add a watermark to the generated video. Default: `false`."
default: false
negative_prompt:
type: string
description: Describes content you do NOT want in the video.
seed:
type: integer
description: "Random number seed for reproducibility. Range: [0, 2147483647]. Same seed with the same parameters produces more consistent (but not identical) results."
minimum: 0
maximum: 2147483647
AsyncTaskSubmitResponse:
type: object
description: Response from an asynchronous task submission.
properties:
request_id:
type: string
description: Unique request identifier for tracing and troubleshooting.
example: c1209113-8437-424f-a386-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: Task ID for polling status. Use with `GET /tasks/{task_id}`.
example: 966cebcd-dedc-4962-af88-xxxxxx
task_status:
type: string
description: Initial task status, typically `PENDING`.
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
TaskStatusResponse:
type: object
description: Response from querying the status of an asynchronous task.
properties:
request_id:
type: string
description: Unique request identifier.
example: c1209113-8437-424f-a386-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: The task ID.
example: 966cebcd-dedc-4962-af88-xxxxxx
task_status:
type: string
description: Current task status.
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
video_url:
type: string
format: uri
description: URL of the generated video (MP4). Only present when `task_status` is `SUCCEEDED`. **Valid for 24 hours** — download promptly.
example: https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx
submit_time:
type: string
description: "The time the task was submitted (UTC+8, format: YYYY-MM-DD HH:mm:ss.SSS)."
scheduled_time:
type: string
description: "The time the task started running (UTC+8, format: YYYY-MM-DD HH:mm:ss.SSS)."
end_time:
type: string
description: "The time the task completed (UTC+8, format: YYYY-MM-DD HH:mm:ss.SSS)."
orig_prompt:
type: string
description: The original input prompt, corresponding to the request parameter `prompt`.
actual_prompt:
type: string
description: When `prompt_extend=true`, the system rewrites the input prompt. This field returns the optimized prompt used for generation. Not returned if `prompt_extend=false`. The wan2.6 model does not return this field regardless of `prompt_extend`.
code:
type: string
description: Error code. Only present when `task_status` is `FAILED`.
message:
type: string
description: Error message. Only present when `task_status` is `FAILED`.
task_metrics:
type: object
description: Task result metrics.
properties:
TOTAL:
type: integer
description: Total number of tasks.
SUCCEEDED:
type: integer
description: Number of successful tasks.
FAILED:
type: integer
description: Number of failed tasks.
usage:
type: object
description: Usage statistics. Only present when task succeeds.
properties:
video_count:
type: integer
description: Number of videos generated. Always 1.
video_duration:
type: integer
description: Total duration of generated video in seconds.
duration:
type: number
description: Returned only for the wan2.6 model. Used for billing. Total video duration, where `duration = input_video_duration + output_video_duration`.
input_video_duration:
type: integer
description: Returned only for the wan2.6 model. Fixed at 0.
output_video_duration:
type: integer
description: Returned only for the wan2.6 model. Duration of the output video in seconds. Same value as `input.duration`.
resolution_tier:
type: integer
description: "Resolution tier of the output video. Returned only for wan2.6 series. Example: `720`."
size:
type: string
description: "Output resolution in `width*height` format. Returned only for wan2.6 series. Example: `1920*1080`."
video_ratio:
type: string
description: "Output resolution in `width*height` format. Returned only for wan2.5 and earlier models. Example: `832*480`."
DashScopeErrorResponse:
type: object
description: DashScope API error response.
properties:
request_id:
type: string
description: Unique request identifier.
code:
type: string
description: Error code (e.g., `InvalidParameter`, `Throttling`, `Unauthorized`).
example: InvalidParameter
message:
type: string
description: Human-readable error message.
example: Invalid model name