# Wan 2.7 Video API

> Wan 2.7 Video — high-quality AI video generation.

- **Provider**: Wan
- **Model id**: `wan-2-7-r2v`
- **Modality**: video
- **Price**: 9.28–13.92 credits /sec

## Overview

Wan 2.7 Video is called in two steps: create a generation task, then poll the task until the result is ready.

## Authentication

All requests require a Bearer Token in the request header:

```
Authorization: Bearer YOUR_API_KEY
```

## Create Task

`POST https://you.bot/api/v1/generate`

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| modelId | string | Yes | Model id: `wan-2-7-r2v` |
| input | object | Yes | Input parameters object (see below) |
| callbackUrl | string | No | https URL we POST the finished task to. Signed with `X-Webhook-Signature` once you create a webhook signing key in Dashboard → Settings |

### input object parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| prompt | string | Yes | The positive prompt for the generation Max 5000 characters. (example: Bring the reference scene to life: drift the camera slowly forward as low fog creeps across an alpine wildflower meadow, blossoms swaying in a faint breeze and… — full value in the request example) |
| negative_prompt | string | No | The negative prompt for the generation Max 500 characters. |
| reference_image | string[] | No | An array of reference image URLs. At least one of the following must be provided: a reference image or a reference video; the total number of images and videos cannot exceed 5. (image URL) |
| reference_video | string[] | No | An array of reference video URLs. At least one of the reference images and reference videos must be passed in; the total number of images and videos cannot exceed 5 (image URL) |
| first_frame | string | No | The URL of the first frame image; a maximum of one image can be passed. The aspect_ratio will be automatically ignored after passing the URL, and an approximate aspect ratio video will be generated based on the aspect ratio of the first frame image. (image URL) |
| reference_voice | string | No | Audio URL. Used to specify the timbre of the main character in the reference material. (image URL) |
| resolution | string | No | The resolution of output (options: 720p \| 1080p) (default: 1080p) |
| aspect_ratio | string | No | Output Video Aspect Ratio. If first_frame is not passed: the video will be generated according to the specified aspect_ratio. First_frame has been passed in: Aspect_ratio is automatically ignored, and an approximate aspect ratio video is generated based on the aspect ratio of the first frame. (options: 16:9 \| 9:16 \| 1:1 \| 4:3 \| 3:4) (default: 16:9) |
| duration | number | No | Output video duration, in seconds. Values ​​must be integers between 2 and 10, with a default value of 5 (range 2-10) (default: 9) |
| prompt_extend | boolean | No | Enable intelligent prompt rewriting. Enabling it uses a larger model to expand the input prompt, which works better for short prompts, but increases processing time (true/false) (default: true) |
| watermark | boolean | No | Add a watermark. The watermark is located in the bottom right corner of the video, and the text is fixed as "AI generated". (true/false) (default: false) |
| seed | number | No | The random seed to use for the generation(>=0,<=2147483647) (default: 0) |
| nsfw_checker | boolean | No | A configurable parameter. Defaults to true in the Playground. (true/false) (default: true) |

### Request example

```json
{
  "modelId": "wan-2-7-r2v",
  "input": {
    "prompt": "Bring the reference scene to life: drift the camera slowly forward as low fog creeps across an alpine wildflower meadow, blossoms swaying in a faint breeze and shafts of dawn light gradually brightening the frame.",
    "negative_prompt": "blurry, low quality, distorted, watermark, text",
    "reference_image": [
      "https://you.bot/examples/grok-imagine-text-to-image.jpg"
    ],
    "reference_video": [
      "https://you.bot/examples/gemini-omni.mp4"
    ],
    "first_frame": "https://you.bot/examples/grok-imagine-text-to-image.jpg",
    "reference_voice": "https://you.bot/examples/suno-v4-5.mp3",
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "duration": 5,
    "prompt_extend": true,
    "watermark": false,
    "seed": 0,
    "nsfw_checker": true
  }
}
```

### Response example

```json
{
  "taskId": "281e5b0…f39b9",
  "creditsCharged": 46.4
}
```

## Query Task

`GET https://you.bot/api/v1/task/{taskId}?model=wan-2-7-r2v`

When `state` is `success`, the output is in `resultUrls`: `{ "state": "success", "resultUrls": [ ... ] }`. (Text models return inline in the create response.)

## Error Codes

| Code | Description |
|------|-------------|
| 200 | Request successful |
| 400 | Invalid request parameters |
| 401 | Authentication failed — check API Key |
| 402 | Insufficient account balance |
| 403 | IP not allowed for this key, or the key is restricted to other models |
| 404 | Task not found, or it has expired |
| 409 | Duplicate request — an identical submit arrived moments ago. Nothing was charged; retry is safe |
| 413 | Payload too large — see the character and file-size limits for this model |
| 429 | Rate limit exceeded — retry after the Retry-After header |
| 500 | Internal server error |
| 504 | Upstream timed out — nothing was delivered; retry is safe |
