> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Wan2.7 R2V

> Generate consistent videos from reference images, videos, voices, and an optional first frame using Wan2.7 R2V.

Wan2.7 R2V is Alibaba Cloud's reference-to-video model, available through the AnyFast asynchronous video API. It preserves characters, objects, scenes, and voices across generated shots by using reference images and videos.

`R2V` means **reference-to-video**. Reference assets define appearance and identity; an optional `first_frame` can separately control the opening frame.

## Key capabilities

* **Mixed references** - Combine reference images and videos, up to 5 assets in total
* **First-frame control** - Add at most one `first_frame`
* **Voice reference** - Attach `reference_voice` to a reference image or video
* **Prompt references** - Refer to assets as `Image 1`, `Image 2`, `Video 1`, and `Video 2`
* **Resolution** - `720P` or `1080P`
* **Duration** - 2-10 seconds when a reference video is used; otherwise 2-15 seconds
* **Output** - 30 fps MP4 video

## Quick example

```bash cURL theme={null}
curl https://www.anyfast.ai/v1/video/generations \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "wan2.7-r2v",
    "input": {
      "prompt": "The character from Image 1 walks through the street from Video 1 and looks toward the camera.",
      "media": [
        {
          "type": "reference_image",
          "url": "https://example.com/character.png"
        },
        {
          "type": "reference_video",
          "url": "https://example.com/street.mp4"
        }
      ]
    },
    "parameters": {
      "resolution": "720P",
      "ratio": "16:9",
      "duration": 5,
      "prompt_extend": true,
      "watermark": false
    }
  }'
```

<Tip>
  Images and videos are numbered independently according to their order in `input.media`. Use exactly `Image N` and `Video N` in prompts. When only one asset of a type is supplied, you can say "the reference image" or "the reference video".
</Tip>

## Enable NSFW generation

1. Select the `Special-Ns` resource group when creating the API token.
2. Set `parameters.prompt_extend` to `false`. Its default value is `true`.

## Input limits

* Reference image: JPEG/JPG/PNG/BMP/WEBP, 240-8,000 px per side, aspect ratio 1:8 to 8:1, up to 20 MB; URL or Base64 data URL
* Reference video: MP4/MOV, 1-30 seconds, 240-4,096 px per side, aspect ratio 1:8 to 8:1, up to 100 MB; public URL
* Reference voice: WAV/MP3, 1-10 seconds, up to 15 MB; public URL
* Asset count: at least one reference image or video; reference images plus reference videos must not exceed 5

## Parameters

| Parameter                       | Type    | Required | Description                                                                   |
| ------------------------------- | ------- | -------- | ----------------------------------------------------------------------------- |
| `model`                         | string  | Yes      | Must be `wan2.7-r2v`                                                          |
| `input.prompt`                  | string  | Yes      | Video description, up to 5,000 characters                                     |
| `input.negative_prompt`         | string  | No       | Content to exclude, up to 500 characters                                      |
| `input.media`                   | array   | Yes      | Reference media plus an optional first frame                                  |
| `input.media[].type`            | string  | Yes      | `reference_image`, `reference_video`, or `first_frame`                        |
| `input.media[].url`             | string  | Yes      | Reference image or video URL; images also support Base64 data URLs            |
| `input.media[].reference_voice` | string  | No       | Public WAV/MP3 URL used as the subject's voice reference                      |
| `parameters.resolution`         | string  | No       | `720P` or `1080P`. Default: `1080P`                                           |
| `parameters.ratio`              | string  | No       | `16:9`, `9:16`, `1:1`, `4:3`, or `3:4`. Ignored when `first_frame` is present |
| `parameters.duration`           | integer | No       | Default: `5`; range depends on whether a reference video is used              |
| `parameters.prompt_extend`      | boolean | No       | Rewrite and enrich the prompt. Default: `true`                                |
| `parameters.watermark`          | boolean | No       | Add an "AI Generated" watermark. Default: `false`                             |
| `parameters.seed`               | integer | No       | Random seed in `[0, 2147483647]`                                              |

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/model-api/alibaba/wan2.7-r2v">View the complete request schema.</Card>
  <Card title="Task Query" icon="magnifying-glass" href="/guides/model-api/alibaba/wan2-task-query">Poll the task and retrieve the result URL.</Card>
</CardGroup>

## Official reference

See the [Alibaba Cloud Model Studio Wan reference-to-video API reference](https://www.alibabacloud.com/help/en/model-studio/wan-video-to-video-api-reference).

<script src="/feedback.js" />
