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

# Wan 3.0 Video Generation

> Generate, edit, and extend videos with native synchronized audio using Wan 3.0 All-in-One models

Wan 3.0 uses All-in-One models. Based on media types in `input.media` and the intent in your prompt, one model can handle text-to-video, first-frame or first-last-frame image-to-video, multimodal reference generation, video editing, and video extension. Unlike [Wan 2.7 Video Generation](/docs/en/api-reference/video/wan), you do not select separate text, image, or editing models for these capabilities.

This endpoint uses the Wan video task protocol. The `X-DashScope-Async` header is not required because async task semantics are built into the gateway.

## Request structure

The request body has three parts: `model`, `input`, and `parameters`.

| Field          | Required                                         | Description                                                                                                                                                        |
| -------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model`        | Yes                                              | Platform model identifier: `wan3.0-video` or `wan3.0-video-prime`                                                                                                  |
| `input.prompt` | At least one of `input.prompt` and `input.media` | Text prompt, up to 20,000 characters. In multimodal reference mode, use labels such as "image 1", "video 1", and "audio 1" to refer to assets in their array order |
| `input.media`  | At least one of `input.prompt` and `input.media` | Media asset array. Every item contains `type` and `url`                                                                                                            |
| `parameters`   | No                                               | Output resolution, ratio, duration, audio, random seed, prompt expansion, and watermark settings                                                                   |

`media[].url` accepts a publicly accessible HTTP/HTTPS URL, an OSS temporary URL, or a base64 data URI. For a base64 data URI, the gateway stores the asset before sending it upstream.

## Authentication

Include the `Authorization` header in the format `Bearer YOUR_API_KEY`.

## Supported models

| Model identifier     | Description                                    |
| -------------------- | ---------------------------------------------- |
| `wan3.0-video`       | Wan 3.0 general-purpose All-in-One video model |
| `wan3.0-video-prime` | Wan 3.0 Prime All-in-One video model           |

## Capabilities and media types

Wan 3.0 can generate video with native synchronized audio, up to 30 seconds. Provide assets through `input.media`:

| `type`            | Use                                    | Limits and notes                                                                               |
| ----------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `first_frame`     | First-frame image-to-video             | One image maximum; can be paired with `last_frame` for first-last-frame mode                   |
| `last_frame`      | Last-frame image-to-video              | One image maximum; may only be used with `first_frame`                                         |
| `reference_image` | Reference images                       | Up to 10 images; each image must be 20 MB or smaller                                           |
| `reference_video` | Reference, editing, or extension video | Up to 5 videos; 15 seconds total, 100 MB per video, and at least 16 fps                        |
| `reference_audio` | Reference audio                        | Up to 5 audio files; 15 seconds total and 15 MB per file                                       |
| `file`            | Document reference                     | One file maximum. Supports `docx`, `doc`, `xlsx`, `xls`, `pptx`, `ppt`, `pdf`, `txt`, and `md` |
| `link`            | Public web-page reference              | One public, no-login web page maximum                                                          |

<Note>
  `first_frame` / `last_frame` are mutually exclusive with `reference_image` / `reference_video` / `reference_audio` / `file` / `link`. Choose either `file` or `link`; either can be combined with reference images, video, and audio. The three `reference_*` types can be freely combined.
</Note>

First-frame and first-last-frame mode only accept `first_frame` and an optional `last_frame`; do not add audio or other media types. To drive imagery with audio, use multimodal reference mode, for example `reference_image` plus `reference_audio`.

## Key parameters

| Parameter       | Default    | Description                                                                                                                                                                                     |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resolution`    | `1080P`    | Output resolution: `480P`, `720P`, or `1080P`                                                                                                                                                   |
| `ratio`         | `adaptive` | Aspect ratio: `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, or `adaptive`. `adaptive` recommends a ratio from the input media and intent                                                                 |
| `duration`      | `5`        | Output length in seconds. Without video input, use an integer from `2` to `30`; with video input, input-video length plus output length must not exceed 30 seconds. Use `-1` for smart duration |
| `audio`         | `true`     | Whether to include an audio track. `true` produces native synchronized audio; `false` omits the audio track. Both settings have the same price                                                  |
| `seed`          | `-1`       | Random seed. Use `-1` or an integer from `0` to `2147483647`; omit it or set `-1` for an automatically generated seed. The same seed does not guarantee identical output                        |
| `prompt_extend` | `true`     | Whether to expand the prompt. Enabling it often improves short prompts but adds latency. When using `file` or `link`, enable it or omit it; do not set it to `false`                            |
| `watermark`     | `false`    | Whether to add a watermark                                                                                                                                                                      |

For video editing, use `reference_video` and state the target edit, such as a replacement, removal, or modification, in the prompt. For video extension, explicitly state how to continue or extend the video. For either mode, `ratio: "adaptive"` and `duration: -1` are recommended.

## Quick request

This text-to-video request returns a task ID in `output.task_id`, which you then use to query the result.

<CodeGroup>
  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.haitoken.ai/v1/alibaba/video/generations",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
      },
      json={
          "model": "wan3.0-video",
          "input": {
              "prompt": "A golden retriever runs along the beach at sunset; the camera follows slowly; ocean waves are clearly audible."
          },
          "parameters": {
              "resolution": "720P",
              "ratio": "16:9",
              "duration": 5,
              "prompt_extend": True,
          },
      },
  )
  print(response.json())
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.haitoken.ai/v1/alibaba/video/generations', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      model: 'wan3.0-video',
      input: {
        prompt: 'A golden retriever runs along the beach at sunset; the camera follows slowly; ocean waves are clearly audible.'
      },
      parameters: {
        resolution: '720P',
        ratio: '16:9',
        duration: 5,
        prompt_extend: true
      }
    })
  });

  console.log(await response.json());
  ```

  ```curl cURL theme={null}
  curl -X POST 'https://api.haitoken.ai/v1/alibaba/video/generations' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "model": "wan3.0-video",
      "input": {
        "prompt": "A golden retriever runs along the beach at sunset; the camera follows slowly; ocean waves are clearly audible."
      },
      "parameters": {
        "resolution": "720P",
        "ratio": "16:9",
        "duration": 5,
        "prompt_extend": true
      }
    }'
  ```
</CodeGroup>

## Scenario examples

### First-last-frame image to video

In first-last-frame mode, provide only the first and last frames. Do not mix in `reference_*`, `file`, or `link`.

```json theme={null}
{
  "model": "wan3.0-video",
  "input": {
    "prompt": "The camera moves steadily through an empty street at dawn and ends at the entrance to a cafe, with cinematic lighting.",
    "media": [
      {
        "type": "first_frame",
        "url": "https://example.com/first-frame.jpg"
      },
      {
        "type": "last_frame",
        "url": "https://example.com/last-frame.jpg"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "adaptive",
    "duration": 5,
    "prompt_extend": true
  }
}
```

### File-reference generation

Provide at most one `file`, and do not combine it with `link`. This mode must enable or omit `prompt_extend`.

```json theme={null}
{
  "model": "wan3.0-video",
  "input": {
    "prompt": "Create a 10-second premium smart-glasses commercial from the product points in the file, with black, silver gray, and ice blue as the main palette.",
    "media": [
      {
        "type": "file",
        "url": "https://example.com/product-brief.pdf"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 10,
    "prompt_extend": true
  }
}
```

### Web-page and reference-image generation

Use a publicly accessible, no-login page for `link`. It can be combined with reference media such as `reference_image`.

```json theme={null}
{
  "model": "wan3.0-video",
  "input": {
    "prompt": "Use the product information on the web page and the appearance in image 1 to create a concise product-launch video.",
    "media": [
      {
        "type": "link",
        "url": "https://example.com/product-page"
      },
      {
        "type": "reference_image",
        "url": "https://example.com/product-reference.jpg"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 8,
    "prompt_extend": true
  }
}
```

### Multimodal reference generation

Reference images, videos, and audio can be combined. Images, videos, and audio are each numbered in their array order.

```json theme={null}
{
  "model": "wan3.0-video",
  "input": {
    "prompt": "Have the person in image 1 walk toward the camera in the beach setting from video 1, using the voice and rhythm from audio 1. Keep the result natural and realistic.",
    "media": [
      {
        "type": "reference_image",
        "url": "https://example.com/person.jpg"
      },
      {
        "type": "reference_video",
        "url": "https://example.com/beach.mp4"
      },
      {
        "type": "reference_audio",
        "url": "https://example.com/voice.wav"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "adaptive",
    "duration": 5,
    "prompt_extend": true
  }
}
```

### Video editing

Use `reference_video` and state the requested edit directly.

```json theme={null}
{
  "model": "wan3.0-video",
  "input": {
    "prompt": "Change the sky in the video to a sunset tone while preserving the person's movement and original dialogue.",
    "media": [
      {
        "type": "reference_video",
        "url": "https://example.com/input-video.mp4"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "adaptive",
    "duration": -1,
    "prompt_extend": true
  }
}
```

### Video extension

Use `reference_video` and explicitly describe the continuation direction or next scene.

```json theme={null}
{
  "model": "wan3.0-video",
  "input": {
    "prompt": "Extend the video forward. Keep panning right to reveal a broader mountain landscape and add natural ambient sound.",
    "media": [
      {
        "type": "reference_video",
        "url": "https://example.com/input-video.mp4"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "adaptive",
    "duration": -1,
    "prompt_extend": true
  }
}
```

A successful creation returns the task ID:

```json theme={null}
{
  "request_id": "8f3d2c1a-9b7e-4f5a-8c2d-1e6f0a9b3c5d",
  "output": {
    "task_id": "cgt-20260730120000-a1b2c3",
    "task_status": "PENDING"
  }
}
```

## Next steps

* See [Query Wan video task](/docs/en/api-reference/video/wan-status) to retrieve generation results
* Compare [Wan 2.7 Video Generation](/docs/en/api-reference/video/wan) for version differences
* See [Video generation](/docs/en/api-reference/video/generation) for the unified protocol
* See the [model list](/docs/en/api-reference/models/list-models) for available video models


## OpenAPI

````yaml en/api-reference/video/wan3/openapi.json POST /v1/alibaba/video/generations
openapi: 3.0.1
info:
  title: Wan 3.0 Video Generation
  version: 1.0.0
servers:
  - url: https://api.haitoken.ai
security: []
paths:
  /v1/alibaba/video/generations:
    post:
      summary: Create Wan 3.0 video task
      description: >-
        Create an async video task using Wan 3.0 All-in-One models. The
        X-DashScope-Async header is not required; async task semantics are built
        into the gateway.
      parameters:
        - name: Authorization
          in: header
          description: API key in the format Bearer YOUR_API_KEY
          required: true
          schema:
            type: string
            example: Bearer YOUR_API_KEY
        - name: Content-Type
          in: header
          description: Request body type
          required: true
          schema:
            type: string
            example: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlibabaCreateTaskRequest'
      responses:
        '200':
          description: Task created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlibabaCreateTaskResponse'
              example:
                request_id: 8f3d2c1a-9b7e-4f5a-8c2d-1e6f0a9b3c5d
                output:
                  task_id: cgt-20260730120000-a1b2c3
                  task_status: PENDING
components:
  schemas:
    AlibabaCreateTaskRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: >-
            Wan 3.0 All-in-One model identifier: wan3.0-video or
            wan3.0-video-prime
        input:
          $ref: '#/components/schemas/Input'
          description: Input content (prompt and media elements)
        parameters:
          $ref: '#/components/schemas/Parameters'
          description: Generation parameters
    AlibabaCreateTaskResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Gateway request ID
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task ID for querying task status
            task_status:
              type: string
              enum:
                - PENDING
              description: Task status
    Input:
      type: object
      anyOf:
        - required:
            - prompt
        - required:
            - media
      properties:
        prompt:
          type: string
          maxLength: 20000
          description: >-
            Text prompt describing the video to generate, edit, or extend;
            provide prompt or media at minimum. In multimodal reference mode,
            use labels such as image 1, video 1, and audio 1 to refer to assets
            in array order
        media:
          type: array
          description: >-
            Media element list (first frame / last frame / reference image /
            reference video / reference audio / file / link)
          items:
            $ref: '#/components/schemas/MediaItem'
    Parameters:
      type: object
      properties:
        resolution:
          type: string
          enum:
            - 480P
            - 720P
            - 1080P
          default: 1080P
          description: Output resolution
        ratio:
          type: string
          enum:
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
            - adaptive
          default: adaptive
          description: Output aspect ratio. Use adaptive when providing input media
        duration:
          type: integer
          oneOf:
            - enum:
                - -1
            - minimum: 2
              maximum: 30
          default: 5
          description: >-
            Output duration in seconds. Without video input, use 2 to 30; with
            video input, total input-video plus output duration cannot exceed
            30. Use -1 for smart duration
        prompt_extend:
          type: boolean
          default: true
          description: >-
            Whether to automatically expand the prompt. It can improve short
            prompts but adds latency. Do not set it to false when using file or
            link
        audio:
          type: boolean
          default: true
          description: >-
            Whether to output native synchronized audio. Enabled by default; set
            to false to disable (toggling audio does not change the price)
        watermark:
          type: boolean
          default: false
          description: Whether to add a watermark
        seed:
          type: integer
          format: int64
          minimum: -1
          maximum: 2147483647
          default: -1
          description: >-
            Random seed. Use -1 or 0 to 2147483647; omit it or use -1 for an
            automatically generated seed. The same seed does not guarantee
            identical output
    MediaItem:
      type: object
      required:
        - type
        - url
      properties:
        type:
          type: string
          description: >-
            Media type. first_frame / last_frame / reference_image /
            reference_video (reference, editing, or extension) / reference_audio
            / file (mutually exclusive with link) / link (mutually exclusive
            with file)
        url:
          type: string
          format: uri
          description: >-
            Media URL or base64 data URI (base64 is uploaded to OBS by the
            gateway and replaced with a URL)

````