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

# Wan 2.7

> Unified video generation with text-to-video, image-to-video, and reference-to-video modes

Generate videos using Wan 2.7 with three modes: text-to-video, image-to-video (first frame, keyframes, continuation, lip-sync), and reference-to-video (character/object consistency).

## Model

```
alibaba/wan-2.7-video
```

## Modes

| Mode  | Description                                                                                                    |
| ----- | -------------------------------------------------------------------------------------------------------------- |
| `t2v` | Generate video from a text prompt. Multi-shot via natural language.                                            |
| `i2v` | Generate video from a first frame, first + last frames, or continue an existing video. Optional driving audio. |
| `r2v` | Generate video from reference images/videos. Use "Image 1"/"Video 1" identifiers in prompt.                    |

## Common Parameters

| Parameter         | Type    | Required | Default   | Description                                                         |
| ----------------- | ------- | -------- | --------- | ------------------------------------------------------------------- |
| `mode`            | string  | No       | `"t2v"`   | `"t2v"`, `"i2v"`, or `"r2v"`                                        |
| `prompt`          | string  | Depends  | `""`      | Text prompt (max 5000 chars). Required for T2V and R2V              |
| `negative_prompt` | string  | No       | `""`      | What to avoid (max 500 chars)                                       |
| `resolution`      | string  | No       | `"1080P"` | `"720P"` or `"1080P"`                                               |
| `duration`        | integer | No       | `5`       | Output duration in seconds (2-15)                                   |
| `prompt_extend`   | boolean | No       | `true`    | LLM-based prompt rewriting. Improves short prompts but adds latency |
| `watermark`       | boolean | No       | `false`   | Add "AI Generated" watermark in lower-right corner                  |
| `seed`            | integer | No       | `null`    | Random seed (0-2147483647)                                          |

***

## T2V Mode

### Parameters

| Parameter   | Type   | Required | Default  | Description                                                                                     |
| ----------- | ------ | -------- | -------- | ----------------------------------------------------------------------------------------------- |
| `audio_url` | string | No       | `null`   | Audio file URL. Formats: WAV, MP3. Duration: 2-30s. Max 15MB. Truncated to `duration` if longer |
| `ratio`     | string | No       | `"16:9"` | Aspect ratio: `"16:9"`, `"9:16"`, `"1:1"`, `"4:3"`, `"3:4"`                                     |

### Multi-shot

Control shot structure using natural language in the prompt:

* **Single shot:** "Generate a single-shot video"
* **Multi-shot:** "Generate a multi-shot video" or describe shots with timestamps (e.g., "Shot 1 \[0-3 seconds] wide shot: Rainy New York street at night")
* **Default:** If unspecified, the model interprets the prompt content

### Example - Basic Text-to-Video

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "t2v",
      "prompt": "A kitten running in the moonlight",
      "resolution": "720P",
      "ratio": "16:9"
    }
  }'
```

### Example - Multi-shot Narrative

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "t2v",
      "prompt": "A tense detective story. Shot 1 [0-3 seconds] wide shot: Rainy New York street at night. Shot 2 [3-6 seconds] medium shot: The detective enters an old building.",
      "resolution": "720P",
      "ratio": "16:9",
      "duration": 6
    }
  }'
```

### Example - With Audio File

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "t2v",
      "prompt": "A cartoon kitten general stands bravely on a cliff",
      "audio_url": "https://example.com/epic.mp3",
      "resolution": "1080P",
      "ratio": "16:9",
      "duration": 10
    }
  }'
```

***

## I2V Mode

### Parameters

| Parameter         | Type   | Required | Default | Description                                                                                               |
| ----------------- | ------ | -------- | ------- | --------------------------------------------------------------------------------------------------------- |
| `first_frame_url` | string | Depends  | `null`  | First frame image URL. Formats: JPEG, JPG, PNG, BMP, WEBP. Resolution: 240-8000px. Max 20MB               |
| `last_frame_url`  | string | No       | `null`  | Last frame image URL. Same format limits. Requires `first_frame_url`                                      |
| `video_url`       | string | Depends  | `null`  | Video to continue (MP4/MOV, 2-10s, max 100MB). Mutually exclusive with `first_frame_url`/`last_frame_url` |
| `audio_url`       | string | No       | `null`  | Driving audio URL for lip-sync / action timing. Formats: WAV, MP3. Duration: 2-30s. Max 15MB              |

### Validation Rules

* At least one of `first_frame_url` or `video_url` is required
* `last_frame_url` requires `first_frame_url`
* `video_url` (continuation) is mutually exclusive with `first_frame_url` / `last_frame_url`

### Example - First Frame to Video

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "i2v",
      "prompt": "A kitten runs across the grass",
      "first_frame_url": "https://example.com/cat.png",
      "resolution": "720P",
      "duration": 10
    }
  }'
```

### Example - First + Last Frame

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "i2v",
      "prompt": "A small black cat looks up at the sky curiously",
      "first_frame_url": "https://example.com/first.png",
      "last_frame_url": "https://example.com/last.png",
      "duration": 10,
      "prompt_extend": false
    }
  }'
```

### Example - Video Continuation

Continue an existing video clip. If the input is 3s and `duration` is 15, the model generates 12s of new content. The final output is 15s.

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "i2v",
      "prompt": "A girl takes a selfie in the mirror, then leaves with her backpack",
      "video_url": "https://example.com/clip.mp4",
      "duration": 15
    }
  }'
```

***

## R2V Mode

### Parameters

| Parameter              | Type      | Required | Default  | Description                                                                                                                           |
| ---------------------- | --------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `reference_image_urls` | string\[] | Depends  | `null`   | Reference images for characters/objects/scenes. Each must contain a single subject. Formats: JPEG, JPG, PNG, BMP, WEBP. Max 20MB each |
| `reference_video_urls` | string\[] | Depends  | `null`   | Reference videos for characters. Each must contain a single subject. Formats: MP4, MOV. Duration: 1-30s. Max 100MB each               |
| `first_frame_url`      | string    | No       | `null`   | First frame image for scene control. Overrides `ratio`                                                                                |
| `reference_voice_url`  | string    | No       | `null`   | Audio URL for voice timbre override. Formats: WAV, MP3. Duration: 1-10s. Max 15MB                                                     |
| `ratio`                | string    | No       | `"16:9"` | Aspect ratio: `"16:9"`, `"9:16"`, `"1:1"`, `"4:3"`, `"3:4"`. Ignored when `first_frame_url` is set                                    |

### Prompt Identifiers

Use "Image 1", "Image 2" to reference images and "Video 1", "Video 2" to reference videos. Images and videos are numbered separately based on array order. If there is only one reference, you can use "the reference image" or "the reference video".

### Validation Rules

* At least 1 `reference_image_urls` or `reference_video_urls` is required
* Total images + videos must not exceed 5

### Example - Multi-Reference

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "r2v",
      "prompt": "Video 2 holds Image 3 and plays a soothing country ballad, while Video 1 smiles and watches",
      "reference_video_urls": [
        "https://example.com/person1.mp4",
        "https://example.com/person2.mp4"
      ],
      "reference_image_urls": [
        "https://example.com/guitar.png"
      ],
      "resolution": "720P",
      "duration": 10,
      "prompt_extend": false
    }
  }'
```

### Example - Single Reference Image

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "alibaba/wan-2.7-video",
    "input": {
      "mode": "r2v",
      "prompt": "The reference image character walks through a sunlit garden",
      "reference_image_urls": ["https://example.com/person.png"],
      "resolution": "1080P",
      "ratio": "16:9",
      "duration": 5
    }
  }'
```

***

## Input Limits

| Asset                          | Formats                   | Resolution                   | Duration | File Size |
| ------------------------------ | ------------------------- | ---------------------------- | -------- | --------- |
| Audio (T2V / I2V driving)      | WAV, MP3                  | —                            | 2-30s    | 15MB      |
| Voice timbre (R2V)             | WAV, MP3                  | —                            | 1-10s    | 15MB      |
| First/last frame image         | JPEG, JPG, PNG, BMP, WEBP | 240-8000px, ratio 1:8 to 8:1 | —        | 20MB      |
| Input video (I2V continuation) | MP4, MOV                  | 240-4096px, ratio 1:8 to 8:1 | 2-10s    | 100MB     |
| Reference video (R2V)          | MP4, MOV                  | 240-4096px, ratio 1:8 to 8:1 | 1-30s    | 100MB     |
| Reference image (R2V)          | JPEG, JPG, PNG, BMP, WEBP | 240-8000px, ratio 1:8 to 8:1 | —        | 20MB      |

## Response

```json theme={null}
{
  "code": 200,
  "success": true,
  "data": {
    "task_id": "abc123def456",
    "status": "processing"
  }
}
```
