# Wan API integration guide (https://wanapi.app/docs/integration)



## Connect to Wan API [#connect-to-wan-api]

Use `https://api.wanapi.app` as the API base URL. Create a key in [API key settings](/settings/apikeys) and send it as `Authorization: Bearer YOUR_API_KEY`. Keep keys on your server. Playground uses your website session and charges the same account balance; it does not require pasting a key into the browser.

Access requires an enabled account with sufficient balance. See [pricing](/pricing) for current rates. Each model has its own endpoint and [model page](/models).

`GET /v1/models` lists the models available to your key. Choosing a higher resolution does not automatically change your model.

| Model                                        | Model ID in the URL    | Resolution values       |
| -------------------------------------------- | ---------------------- | ----------------------- |
| [Wan 3.0](/docs/wan-3-0)                     | `wan3.0-video`         | `480p`, `720p`, `1080p` |
| [Wan 3.0 Prime](/docs/wan-3-0-prime)         | `wan3.0-video-prime`   | `480p`, `720p`, `1080p` |
| [Wan 3.0 Pro](/docs/wan-3-0-pro)             | `w3.0-video-pro`       | `1080p`, `2k`, `4k`     |
| [Wan 3.0 Prime Pro](/docs/wan-3-0-prime-pro) | `w3.0-video-prime-pro` | `1080p`, `2k`, `4k`     |

## Request fields [#request-fields]

All four models share these 14 native generation fields, plus the optional `nsfw_checker` parameter. Provide a prompt or at least one media input. Frames cannot be combined with reference inputs, `file` or `link`; `file` and `link` are mutually exclusive.

| Field              | Type      | Contract                                                                                                                  |
| ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------- |
| `prompt`           | string    | Up to 20,000 characters.                                                                                                  |
| `first_frame`      | string    | Publicly accessible image HTTP(S) URL that you host. Base64 and data URIs are rejected.                                   |
| `last_frame`       | string    | Publicly accessible image HTTP(S) URL that you host. Base64 and data URIs are rejected.                                   |
| `reference_images` | string\[] | Up to 10 images, using the same forms as a frame.                                                                         |
| `reference_videos` | string\[] | Up to 5 public MP4/MOV URLs; 1–15 seconds per clip and at most 15 reference seconds in total.                             |
| `reference_audios` | string\[] | Up to 5 audio HTTP(S) URLs.                                                                                               |
| `file`             | string    | Public document URL.                                                                                                      |
| `link`             | string    | Public web page URL.                                                                                                      |
| `resolution`       | string    | See the model table. Default: `1080p`.                                                                                    |
| `ratio`            | string    | `adaptive`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`. Default: `adaptive`.                                                     |
| `duration`         | integer   | 2–30 output seconds, or `-1` for automatic duration. Default: `5`.                                                        |
| `audio`            | boolean   | Generate audio. Default: `true`. Disabling it does not reduce the rate.                                                   |
| `seed`             | integer   | 0–2147483647. Omit for random generation.                                                                                 |
| `prompt_extend`    | boolean   | Expand the prompt. Default: `true`.                                                                                       |
| `nsfw_checker`     | boolean   | Default: `true` for Wan 3.0 and Wan 3.0 Prime, `false` for Pro variants. `true` does not support `file` or `link` inputs. |

Playground and API requests default to `nsfw_checker: true` for Wan 3.0 and Wan 3.0 Prime. Existing clients do not need to add the parameter. Pro variants support `false` only and default to `false`. Playground content checks apply with either setting. Changing the parameter changes the rate; check the current price for the selected value. Unavailable selections return an error instead of switching to the other setting.

Use stable, directly accessible media URLs that stay available until the task finishes. Video duration checks use bounded HTTP range reads; video servers must support those reads and expose readable MP4/MOV duration metadata. Redirects are not followed by duration checks. Private network URLs are not supported. The combined reference and output duration must not exceed 30 seconds. Playground accepts a JSON request body up to 32 MiB; use URLs for larger inputs.

### Content filtering and review errors [#content-filtering-and-review-errors]

`nsfw_checker` selects the level of content review for Wan 3.0 and Wan 3.0 Prime:

* `true` (default, including when omitted): strict content filtering.
* `false`: more permissive content filtering. This setting uses a different per-second rate; check the current pricing table.

If a submission is explicitly rejected by content review, or the saved task reaches `failed` with a content-policy error, set `nsfw_checker` to `false` in a new request to use more permissive review. Keep the same public model ID and other supported parameters. For example, add this field to the native request body or the JSON body sent to `/v1/responses`:

```json
{
  "nsfw_checker": false
}
```

This is a request fragment, not a complete generation request. More permissive review does not guarantee acceptance; Playground content checks still apply. This option does not resolve invalid parameters, insufficient balance or other non-review errors. If a submission times out or its outcome is uncertain, retrieve the existing task first; do not automatically submit another paid generation.

Pro variants support `false` only and default to `false`. Historical tasks keep their original setting for status retrieval and billing.

`content_filter` is still accepted as a legacy alias for `nsfw_checker`. Use `nsfw_checker` in new integrations. If both fields are sent, their boolean values must match; conflicting values are rejected.

## Poll and download the video [#poll-and-download-the-video]

Every model's submit endpoint returns a public task ID. Save it before doing anything else.

```json
{
  "task_info": {
    "id": "task_EXAMPLE",
    "status": "pending"
  }
}
```

Use the query example in the matching model chapter. Start with a five-second interval and increase the delay after temporary errors. Keep each task's model ID together with its task ID; do not query it through a different model endpoint.

The native statuses are `pending`, `processing`, `completed` and `failed`. A completed response includes `videos`, an array containing a complete signed Bunny CDN URL.

```json
{
  "task_info": { "id": "task_EXAMPLE", "status": "completed" },
  "videos": ["https://reapiflexible.b-cdn.net/flexible/v1/expires/2026-11/20261113T06/wanapi-task_EXAMPLE/video.mp4?token=HS256_SIGNATURE&expires=1794550071"]
}
```

Use the returned URL directly for playback or download; no API key or Authorization header is required for that URL. Files follow the existing storage retention policy. Querying a task does not generate another video, charge again or extend file availability. Save files you want to keep to your own storage. Task queries require your API key and only return tasks owned by your account.

## Synchronous and background Responses [#synchronous-and-background-responses]

For clients using the Responses API, `POST /v1/responses` accepts a model ID, a string `input` and the same native generation fields. Use `input` instead of `prompt`. Native media fields such as `reference_images` remain top-level fields.

```json
{
  "model": "wan3.0-video",
  "input": "A blue ball rolls across a white table.",
  "resolution": "480p",
  "duration": 2,
  "background": true
}
```

With `background: true`, save the response ID and poll `GET /v1/responses/{response_id}`. Without `background`, the HTTP request waits for completion. `stream: true` uses server-sent events while waiting. The final assistant output contains a signed video URL; treat it as a private capability link and do not publish it accidentally. Native task submission and background Responses are recommended for long generations and restrictive proxy timeouts.

A disconnected or timed-out synchronous request does not cancel generation. The task remains on the server. Do not automatically submit the same generation again.

## Billing and failure handling [#billing-and-failure-handling]

The price is the model's resolution rate multiplied by billable seconds. Reference video seconds and output seconds both count at the same rate, and reusing the same reference video URL is billed on every submission; text, images and audio inputs do not add video seconds. Fixed-duration requests without reference video reserve and settle for the requested output duration. Automatic duration and reference-video requests reserve up to 30 billable seconds, then settle to the exact combined duration measured from the reference and generated video metadata (including fractional seconds, capped at 30 seconds) and return the unused reservation; because generated MP4 containers can include slight frame-alignment padding, measured output duration may slightly exceed the requested integer seconds. Generation failures release the reservation. Polling does not create another generation or charge again.

* **Invalid parameters:** correct the request before resubmitting. Unknown native fields are rejected.
* **Insufficient balance:** add funds before a new paid request. A key's limit does not grant account credit.
* **Rate limits or temporary polling failures:** retry only the query, with backoff and a maximum waiting period.
* **Submission timeout, network interruption or missing task ID:** the outcome may be unknown. Do not automatically repeat the POST; it could create a second paid task.
* **Task failure:** show the failed state separately from an unavailable status query.
* **Download failure:** retry downloading the existing completed task before starting another generation.

Generation submissions are not automatically retried or switched to another model. There is no advertised cancellation, webhook or idempotency-key contract. Keep the task ID and contact [support](/contact) when an uncertain submission needs investigation.
