Wan 2.7 (Reference-to-Video)

This documentation is valid for the following list of our models:

  • alibaba/wan-2-7-r2v

A reference-driven video generation model that uses input images or video files as visual guidance for scene composition, ensuring strong subject and style consistency, with support for synchronized audio generation and high-quality cinematic output at 720p/1080p resolution, typically 5 to 15 seconds in length.

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

How to Make a Call

Step-by-Step Instructions

Generating a video using this model involves sequentially calling two endpoints:

  • The first one is for creating and sending a video generation task to the server (returns a generation ID).

  • The second one is for requesting the generated video from the server using the generation ID received from the first endpoint. Below, you can find both corresponding API schemas.

API Schemas

Create a video generation task and send it to the server

post
Body
modelstring · enumRequiredPossible values:
promptstringRequired

The text description of the scene, subject, or action to generate in the video.

first_frame_imagestring · uriOptional

Optional first frame image URL.

image_urlsstring · uri[] · max: 5Optional

Reference image URLs.

video_urlsstring · uri[] · max: 5Optional

Reference video URLs.

aspect_ratiostring · enumOptional

The aspect ratio of the generated video.

Default: 16:9Possible values:
resolutionstring · enumOptional

An enumeration where the short side of the video frame determines the resolution.

Default: 1080pPossible values:
durationinteger · enumOptional

The length of the output video in seconds.

Default: 10Possible values:
enhance_promptbooleanOptional

Whether to enable prompt expansion.

Default: true
negative_promptstring · max: 500Optional

The description of elements to avoid in the generated video.

seedintegerOptional

Varying the seed integer is a way to get different results for the same other request parameters. Using the same value for an identical request will produce similar results. If unspecified, a random number is chosen.

watermarkbooleanOptional

Whether the video contains a watermark.

Default: false
Responses
200Success
application/json
idstringRequired

The ID of the generated video.

Example: 60ac7c34-3224-4b14-8e7d-0aa0db708325
statusstring · enumRequired

The current status of the generation task.

Example: completedPossible values:
post
/v2/video/generations
200Success

Retrieve the generated video from the server

After sending a request for video generation, this task is added to the queue. This endpoint lets you check the status of a video generation task using its generation_id, obtained from the endpoint described above. If the video generation task status is completed, the response will include the final result — with the generated video URL and additional metadata.

get
Authorizations
AuthorizationstringRequired

Bearer key

Query parameters
generation_idstringRequiredExample: <REPLACE_WITH_YOUR_GENERATION_ID>
Responses
200Success
application/json
idstringRequired

The ID of the generated video.

Example: 60ac7c34-3224-4b14-8e7d-0aa0db708325
statusstring · enumRequired

The current status of the generation task.

Example: completedPossible values:
get
/v2/video/generations
200Success

Code Example

The code below creates a video generation task, then automatically polls the server every 15 seconds until it finally receives the video URL.

Two reference videos are supplied via URLs, and the prompt defines how the model should use them.

Response

Processing time: ~ 8 min 42 sec.

Generated video (1920x1080, with sound):

Last updated

Was this helpful?