Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Wan 2.6 — Recuperar resultado de referência ao vídeo
Verifique o status da tarefa de vídeo
Estratégia de votação
- Crie uma tarefa para receber um
task_id. - Pesquise este endpoint a cada 15 segundos até
task_statuséSUCCEEDEDouFAILED. - Em caso de sucesso, recupere o vídeo de
video_url.
Notas importantes
- Expiração de URL: URLs de vídeo expiram após 24 horas. Baixe imediatamente.
- Fluxo de status da tarefa:
PENDING→RUNNING→SUCCEEDEDouFAILED.
OpenAPI
openapi: 3.1.0
info:
title: Wan Reference-to-Video API
description: Wan reference-to-video API. Generates performance videos from reference images or videos with multimodal input (text, image, video). Supports single or multi-character interactions, multi-shot narrative, and audio-video sync.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/tasks/{task_id}:
get:
operationId: getRefToVideoTaskStatus
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 identifier returned by the video creation 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: 5
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. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
schemas:
RefToVideoRequest:
type: object
required:
- model
- input
properties:
model:
type: string
description: Model name.
enum:
- wan2.6-r2v-flash
- wan2.6-r2v
example: wan2.6-r2v-flash
input:
$ref: "#/components/schemas/RefToVideoInput"
parameters:
$ref: "#/components/schemas/RefToVideoParameters"
RefToVideoInput:
type: object
required:
- prompt
- reference_urls
description: Input data for reference-to-video generation.
properties:
prompt:
type: string
description: Text prompt describing the desired video content. Use `character1`, `character2`, etc. to reference characters from the `reference_urls` array in order. Each reference must contain only a single character.
example: 'Character1 says to Character2: "that sounds great"'
reference_urls:
type: array
description: Array of reference image or video URLs. Up to 5 URLs total (up to 5 images, up to 3 videos). Each reference must contain a single character. The order determines character identifiers (`character1`, `character2`, etc.).
items:
type: string
format: uri
minItems: 1
maxItems: 5
example:
- https://example.com/person1.mp4
- https://example.com/person2.mp4
- https://example.com/object.png
RefToVideoParameters:
type: object
description: Generation parameters for reference-to-video.
properties:
size:
type: string
description: Output resolution as `width*height`. Determines the video aspect ratio (e.g., `1280*720` for 16:9, `720*1280` for 9:16).
enum:
- 1280*720
- 720*1280
- 960*960
- 1920*1080
- 1080*1920
example: 1280*720
duration:
type: integer
description: Video duration in seconds. Integer from 2 to 10 for both models.
minimum: 2
maximum: 10
example: 10
audio:
type: boolean
description: "Generate audio in the video. `true` (default): generate video with audio. `false`: generate silent video. Silent video is only supported by `wan2.6-r2v-flash`."
default: true
shot_type:
type: string
description: "Shot mode. `multi`: multi-shot switching for enhanced expressiveness with natural dialogue and scene transitions. `single`: fixed single-shot perspective."
enum:
- multi
- single
example: multi
watermark:
type: boolean
description: Add watermark to the output video.
default: false
AsyncTaskSubmitResponse:
type: object
description: Response returned when an asynchronous task is created successfully.
properties:
request_id:
type: string
description: Unique request identifier.
output:
type: object
properties:
task_id:
type: string
description: Task identifier. Use this with `GET /tasks/{task_id}` to poll for results.
task_status:
type: string
description: Initial task status, typically `PENDING`.
enum:
- PENDING
TaskStatusResponse:
type: object
description: Response containing the current status and results of a reference-to-video task.
properties:
request_id:
type: string
description: Unique request identifier.
output:
type: object
properties:
task_id:
type: string
description: Task identifier.
task_status:
type: string
description: Current task status.
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
video_url:
type: string
format: uri
description: Generated video URL. Only present when `task_status` is `SUCCEEDED`. Valid for 24 hours — download promptly.
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`.
usage:
type: object
description: Usage statistics (only present when task succeeds).
properties:
video_count:
type: integer
description: Number of videos generated.
video_duration:
type: integer
description: Duration of the generated video in seconds.
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 parameter: size"