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

# Wan

> Alibaba's Wan 3.0 and Wan 2.7 video models: text to video, first/last frame and reference media.

| Model ID | Length | Resolution | Inputs |
| - | - | - | - |
| `wan3.0-video-prime` | 2–30 s, or `-1` (model decides) | `480P`, `720P`, `1080P` | Text, first/last frame, reference images / videos / audio |
| `wan3.0-video` | same as above | same as above | same as above — lower price, lower quality than Prime |
| `wan2.7-t2v` | 2–15 s | `720P`, `1080P` | Text only |
| `wan2.7-i2v` | 2–15 s | `720P`, `1080P` | First frame (required), optional last frame |

* Endpoint: `POST https://refillapi.com/v1/videos` (async task)
* [Prices](https://refillapi.com/pricing)

## Request

**Authorization** `string` *required*

`Bearer YOUR_API_KEY`

**model** `string` *required*

One of the IDs above.

**prompt** `string`

Picture and motion. Required for text to video; recommended otherwise.

**seconds** `integer` (default: 5)

Length in whole seconds — see the table above.

**resolution** `string` (default: 1080P)

See the table above.

**ratio** `string`

`16:9`, `9:16`, `1:1`, `4:3` or `3:4`. Wan 3.0 also accepts `adaptive` (follow the first frame, the default). For `wan2.7-i2v` the ratio always follows the first frame.

**images** `string[]`

Public image URLs: the first is the first frame, the second (optional) is the last frame. Required for `wan2.7-i2v`; not used by `wan2.7-t2v`.

**metadata.input.media** `object[]`

Wan 3.0 only. Reference media, each `{"type": "reference_image", "url": "https://..."}`. `type` is `reference_image` (up to 10), `reference_video` (up to 5) or `reference_audio` (up to 5). Do not combine with `images`.

**negative\_prompt** `string`

What you do not want to see.

**seed** `integer`

Random seed.

**prompt\_extend** `boolean` (default: true)

Let the model rewrite and expand the prompt.

## Text to video

```bash theme={null}
curl https://refillapi.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video-prime",
    "prompt": "A corgi running along the beach at sunrise, the camera slowly tracking it",
    "seconds": 5,
    "resolution": "720P",
    "ratio": "16:9"
  }'
```

## First and last frame

```bash theme={null}
curl https://refillapi.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-i2v",
    "prompt": "The flower goes from bud to full bloom",
    "seconds": 5,
    "resolution": "720P",
    "images": ["https://example.com/first.jpg", "https://example.com/last.jpg"]
  }'
```

## Reference media (Wan 3.0)

```bash theme={null}
curl https://refillapi.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video-prime",
    "prompt": "The person in the reference image dances on a city street, following the moves in the reference video",
    "seconds": 8,
    "resolution": "720P",
    "ratio": "9:16",
    "metadata": {
      "input": {
        "media": [
          {"type": "reference_image", "url": "https://example.com/person.png"},
          {"type": "reference_video", "url": "https://example.com/dance.mp4"}
        ]
      }
    }
  }'
```

Polling and download work as in [Video generation](https://docs.refillapi.com/api/videos/overview.md#2-poll). Wan tasks usually take 1–3 minutes.

## Billing

Per second of output, with one price per resolution. On Wan 3.0, reference videos are billed by their length at the same price; reference images and audio are free.

The requested length is held when you submit — 30 seconds when `seconds` is `-1` or a reference video is attached — and settled when the task finishes. Failed tasks are refunded in full.

## Errors

| Error | Cause |
| - | - |
| `wan3.0-video-prime duration must be -1 or an integer between 2 and 30` | Length out of range |
| `wan2.7-t2v duration must be an integer between 2 and 15` | Length out of range |
| `… resolution must be one of …` | Unsupported resolution |
| `unsupported wan3.0 input.media combination` | Frames and references mixed, or only a last frame |
| `wan2.7-i2v requires first_frame or first_clip with a supported media combination` | No first frame for `wan2.7-i2v` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.