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

# Create a Wan3.0 video task

> Create an asynchronous Wan3.0 video task from text or media. Review request fields, supported inputs, duration limits, billing, and response examples.

Submit a prompt and optional media to the AntiRouter Wan3.0 endpoint to create an asynchronous video task. Save the returned task ID and use [Query Task](https://docs.anti.rs/en/api-reference/wan3/query-task.md) to retrieve its status and finished video.

> [!NOTE]
>
> Use an inference key. Generation reserves account credits. Fixed output durations are 3–14 seconds; use `-1` for automatic duration. Example IDs and resource URLs illustrate the response format only.

## Request body

**model** `string` *required*

Model ID, such as `w3.0-video`. See [Models](https://docs.anti.rs/en/get-started/models.md) for other Wan3.0 variants and check the live list for availability.

**input** `object` *required*

Content to generate, including a prompt and optional source media.

**input fields**

**prompt** `string`

Describe the subject, action, scene, and camera movement. Supply a prompt or media input. Keep the prompt within 20,000 characters.

**media** `object[]`

Optional source-media array. Omit it for text-only generation. Each item has a `type` and `url`; see the media types and limits below.

**media item fields**

**type** `string` *required*

Media type from the table below.

**url** `string` *required*

Public HTTP/HTTPS URL of the source media.

**parameters** `object` *required*

Generation options. Explicitly set duration, resolution, aspect ratio, and the audio and prompt-expansion options you need.

**parameters fields**

**duration** `integer` *required*

Fixed output duration in whole seconds, from 3 to 14, or `-1` for automatic duration. Set this field explicitly; do not omit it or send `0`.

**resolution** `string`

Output resolution. Standard and Prime variants accept `480p`, `720p`, or `1080p`. Pro and Prime Pro variants accept `1080p`, `2k`, or `4k`. Set it explicitly and check that pricing is available for that resolution.

**ratio** `string`

Aspect ratio: `adaptive`, `16:9`, `4:3`, `1:1`, `3:4`, or `9:16`. For example, use `16:9` for landscape output.

**audio** `boolean`

Audio-generation option. Send `true` to request audio.

**seed** `integer`

Optional random seed from 0 to 2147483647. Reusing a seed does not guarantee frame-identical output.

**prompt\_extend** `boolean`

Prompt-expansion option. Send `true` to request expansion; enable it when using `file` or `link`.

## Media types

| `type` | Purpose | Usage |
| - | - | - |
| `first_frame` | Starting image | At most one item. |
| `last_frame` | Ending image | At most one item; use with a first frame. |
| `reference_image` | Reference image | Up to five reference images, videos, and audio items combined. |
| `reference_video` | Reference video | Combined original video duration must be strictly less than 15 seconds. |
| `reference_audio` | Reference audio | Shares the five-item limit with other reference media. |
| `file` | Document URL | At most one; cannot be combined with `link` or reference media. |
| `link` | Public webpage URL | At most one; cannot be combined with `file` or reference media. |

Choose either a first/last-frame workflow or a reference-media workflow. The service fetches your media; keep URLs accessible while the task runs. Image, video, and audio URLs must support HTTP byte-range requests and have a known file size. Local file paths, Base64, data URIs, private-network URLs, and live streams are not accepted for these media inputs.

| Media | Formats | Maximum size | Dimensions |
| - | - | - | - |
| Image | JPEG/JPG, PNG, BMP, WebP | 10 MiB | Width and height each 240–8000 pixels; aspect ratio no greater than 8:1 in either orientation. |
| Video | MP4/MOV container family | 100 MiB | Same dimension limits as images. |
| Audio | WAV, MP3 | 15 MiB | No image-dimension requirement. |

The 15-second reference-video limit uses original duration, before billing rounding. Keep document inputs supplied as `file` within 100 MB. `file` and `link` are content inputs, not file-upload endpoints.

## Image-to-video example

Replace `input` in the full request with the following object and use your own public image URL:

```json theme={null}
{
  "input": {
    "prompt": "The camera slowly moves toward the subject. Preserve the composition and lighting of the first frame.",
    "media": [
      {
        "type": "first_frame",
        "url": "https://example.com/first-frame.jpg"
      }
    ]
  }
}
```

## Successful response

Accepted requests return HTTP `200` and an `X-Request-ID` header. The creation endpoint returns identifiers and status only, without a video URL or final usage.

**request\_id** `string` *required*

Platform request ID for tracking the generation.

**output** `object` *required*

**output fields**

**task\_id** `string` *required*

Task ID to pass as the query endpoint's path parameter.

**task\_status** `string` *required*

Current task state, such as `PENDING`. Even if creation returns `SUCCEEDED`, query the task to get the result.

## Billing and retries

Generation reserves credits before submission. See [Models](https://docs.anti.rs/en/get-started/models.md) for usage calculation. `duration: -1` reserves 30 output seconds plus billable reference-video seconds, then settles on actual usage. The hold is not a promise of the final output duration.

Submit once and save the task ID. A connection timeout does not prove creation failed. Check console task history and query an existing task before resubmitting, since repeated submissions can create separately billed tasks.

## Common errors

| HTTP | `error` | Next action |
| - | - | - |
| `400` | `invalid_model_request` | Check duration is 3–14 or `-1`, and verify media parameters. |
| `400` | `duplicate_media` | Use at most one first frame, last frame, file, and link. |
| `400` | `conflicting_file_and_link` | Keep either file or link. |
| `400` | `conflicting_frames_and_references` | Choose one media workflow and remove conflicting inputs. |
| `400` | `too_many_reference_media` | Reduce reference images, videos, and audio to five items combined. |
| `400` | `reference_video_duration_limit_exceeded` | Keep combined reference-video duration strictly below 15 seconds. |
| `400` | `streaming_media_unsupported` | Provide a direct URL with byte-range support and a known file size. |
| `400` | `invalid_video_media` / `media_metadata_unavailable` | Check media type, URL, and whether the file can be read. |
| `400` | `image_too_large` / `video_too_large` / `audio_too_large` | Reduce file size. |
| `400` | `unsupported_image_format` / `unsupported_video_format` / `unsupported_audio_format` | Convert to a supported format. |
| `400` | `invalid_media_resolution` / `invalid_media_aspect_ratio` | Adjust media dimensions or aspect ratio. |
| `401` | `unauthorized` | Use an enabled, valid inference key. |
| `402` | `insufficient_balance` | Add enough credits for the hold. |
| `404` | `not_found` | Check the model ID exists and is enabled. |
| `502` | `upstream_unavailable` | Check task history before retrying generation. |
| `503` | `metering_unavailable` | Pricing is temporarily unavailable; retry later. |

```bash cURL theme={null}
curl --request POST \
  --url "https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis" \
  --header "Authorization: Bearer $ANTI_API_KEY" \
  --header "Content-Type: application/json" \
  --data '
{
  "model": "w3.0-video",
  "input": {
    "prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light."
  },
  "parameters": {
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "audio": true,
    "prompt_extend": true
  }
}
'
```

```python Python theme={null}
import json
import os
from urllib.request import Request, urlopen

payload = {
    "model": "w3.0-video",
    "input": {
        "prompt": (
            "A paper boat floats along a quiet stream at sunrise. "
            "Slow tracking shot, soft natural light."
        ),
    },
    "parameters": {
        "resolution": "720p",
        "ratio": "16:9",
        "duration": 5,
        "audio": True,
        "prompt_extend": True,
    },
}
request = Request(
    "https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis",
    data=json.dumps(payload).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["ANTI_API_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urlopen(request, timeout=120) as response:
    result = json.load(response)
print(result["output"]["task_id"])
```

```json 200 theme={null}
{
  "request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
  "output": {
    "task_id": "example-task-id",
    "task_status": "PENDING"
  }
}
```

```json 402 theme={null}
{
  "error": "insufficient_balance",
  "message": "insufficient available balance"
}
```


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