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

# wan2.7

> Wan2.7 text-to-video, image-to-video, and reference-to-video API.

Create Wan2.7 video tasks through `POST /v1/video/generations`. Choose a workflow below; each workflow uses the same endpoint with a different model ID and input media structure.

<Tabs sync={false}>
  <Tab title="Text to video">
    ## Create task

    `POST /v1/video/generations`

    <div className="kling-api-example-panel wan-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "wan2.7-t2v",
          "input": {
            "prompt": "A paper boat sails through a neon-lit rainy city, cinematic tracking shot.",
            "negative_prompt": "blurry, distorted, low quality",
            "audio_url": "https://example.com/music.mp3"
          },
          "parameters": {
            "resolution": "720P",
            "ratio": "16:9",
            "duration": 5,
            "prompt_extend": true,
            "watermark": false,
            "seed": 42
          }
        }'
      ```

      ```json 200 theme={null}
      {
        "id": "asyntask_example123",
        "task_id": "asyntask_example123",
        "object": "video",
        "model": "wan2.7-t2v",
        "status": "queued",
        "progress": 0,
        "created_at": 1784520000
      }
      ```
    </div>

    ## Request headers

    <ParamField header="Authorization" type="string" required>Bearer authentication in the form `Bearer YOUR_API_KEY`.</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>Request body format.</ParamField>

    ## Request parameters

    <ParamField body="model" type="string" required>Must be `wan2.7-t2v`.</ParamField>
    <ParamField body="input.prompt" type="string" required>Video description in Chinese or English. Maximum 5,000 non-Chinese or 2,500 Chinese characters.</ParamField>
    <ParamField body="input.negative_prompt" type="string">Content to exclude from the video. Maximum 500 characters.</ParamField>
    <ParamField body="input.audio_url" type="string">Public WAV or MP3 URL. The audio must be 2-30 seconds and no larger than 15 MB.</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">Output resolution: `720P` or `1080P`.</ParamField>
    <ParamField body="parameters.ratio" type="string" default="16:9">Output aspect ratio: `16:9`, `9:16`, `1:1`, `4:3`, or `3:4`.</ParamField>
    <ParamField body="parameters.duration" type="integer" default={5}>Video duration from 2 to 15 seconds.</ParamField>
    <ParamField body="parameters.prompt_extend" type="boolean" default={true}>Whether to rewrite and enrich the prompt. For specific content requests, select the `Special-Ns` resource group and set this parameter to `false`.</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={false}>Whether to add an AI Generated watermark.</ParamField>
    <ParamField body="parameters.seed" type="integer">Random seed in `[0, 2147483647]`.</ParamField>
  </Tab>

  <Tab title="Image to video">
    ## Create task

    `POST /v1/video/generations`

    <div className="kling-api-example-panel wan-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "wan2.7-i2v",
          "input": {
            "prompt": "The camera moves closer as the lanterns begin to glow.",
            "negative_prompt": "blurry, distorted, low quality",
            "media": [
              {
                "type": "first_frame",
                "url": "https://example.com/first-frame.png"
              },
              {
                "type": "driving_audio",
                "url": "https://example.com/driving-audio.mp3"
              }
            ]
          },
          "parameters": {
            "resolution": "720P",
            "duration": 5,
            "prompt_extend": true,
            "watermark": false,
            "seed": 42
          }
        }'
      ```

      ```json 200 theme={null}
      {
        "id": "asyntask_example123",
        "task_id": "asyntask_example123",
        "object": "video",
        "model": "wan2.7-i2v",
        "status": "queued",
        "progress": 0,
        "created_at": 1784520000
      }
      ```
    </div>

    ## Request headers

    <ParamField header="Authorization" type="string" required>Bearer authentication in the form `Bearer YOUR_API_KEY`.</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>Request body format.</ParamField>

    ## Request parameters

    <ParamField body="model" type="string" required>Must be `wan2.7-i2v`.</ParamField>
    <ParamField body="input.prompt" type="string">Motion and scene description. Maximum 5,000 non-Chinese or 2,500 Chinese characters.</ParamField>
    <ParamField body="input.negative_prompt" type="string">Content to exclude from the video. Maximum 500 characters.</ParamField>
    <ParamField body="input.media" type="object[]" required>One to three media objects. Use only one object for each media type.</ParamField>
    <ParamField body="input.media[].type" type="string" required>Media type: `first_frame`, `last_frame`, `driving_audio`, or `first_clip`.</ParamField>
    <ParamField body="input.media[].url" type="string" required>Public media URL. `first_frame` and `last_frame` also accept Base64 data URLs.</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">Output resolution: `720P` or `1080P`.</ParamField>
    <ParamField body="parameters.duration" type="integer" default={5}>Final output duration from 2 to 15 seconds. For continuation, this includes the input clip.</ParamField>
    <ParamField body="parameters.prompt_extend" type="boolean" default={true}>Whether to rewrite and enrich the prompt. For specific content requests, select the `Special-Ns` resource group and set this parameter to `false`.</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={false}>Whether to add an AI Generated watermark.</ParamField>
    <ParamField body="parameters.seed" type="integer">Random seed in `[0, 2147483647]`.</ParamField>
  </Tab>

  <Tab title="Reference to video">
    ## Create task

    `POST /v1/video/generations`

    <div className="kling-api-example-panel wan-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "wan2.7-r2v",
          "input": {
            "prompt": "The character from Image 1 walks through the street from Video 1.",
            "negative_prompt": "blurry, distorted, low quality",
            "media": [
              {
                "type": "reference_image",
                "url": "https://example.com/character.png",
                "reference_voice": "https://example.com/voice.mp3"
              },
              {
                "type": "reference_video",
                "url": "https://example.com/street.mp4"
              }
            ]
          },
          "parameters": {
            "resolution": "720P",
            "ratio": "16:9",
            "duration": 5,
            "prompt_extend": true,
            "watermark": false,
            "seed": 42
          }
        }'
      ```

      ```json 200 theme={null}
      {
        "id": "asyntask_example123",
        "task_id": "asyntask_example123",
        "object": "video",
        "model": "wan2.7-r2v",
        "status": "queued",
        "progress": 0,
        "created_at": 1784520000
      }
      ```
    </div>

    ## Request headers

    <ParamField header="Authorization" type="string" required>Bearer authentication in the form `Bearer YOUR_API_KEY`.</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>Request body format.</ParamField>

    ## Request parameters

    <ParamField body="model" type="string" required>Must be `wan2.7-r2v`.</ParamField>
    <ParamField body="input.prompt" type="string" required>Describe the scene and refer to assets as `Image 1`, `Image 2`, `Video 1`, and `Video 2`. Maximum 5,000 non-Chinese or 2,500 Chinese characters.</ParamField>
    <ParamField body="input.negative_prompt" type="string">Content to exclude from the video. Maximum 500 characters.</ParamField>
    <ParamField body="input.media" type="object[]" required>One to six media objects. Reference images and videos together must not exceed five.</ParamField>
    <ParamField body="input.media[].type" type="string" required>Media type: `reference_image`, `reference_video`, or `first_frame`.</ParamField>
    <ParamField body="input.media[].url" type="string" required>Reference media URL. Images also accept Base64 data URLs.</ParamField>
    <ParamField body="input.media[].reference_voice" type="string">Optional public WAV or MP3 voice-reference URL for a reference image or video.</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">Output resolution: `720P` or `1080P`.</ParamField>
    <ParamField body="parameters.ratio" type="string" default="16:9">Output aspect ratio: `16:9`, `9:16`, `1:1`, `4:3`, or `3:4`. Ignored when a `first_frame` is provided.</ParamField>
    <ParamField body="parameters.duration" type="integer" default={5}>Video duration from 2 to 15 seconds. When a reference video is present, the maximum is 10 seconds.</ParamField>
    <ParamField body="parameters.prompt_extend" type="boolean" default={true}>Whether to rewrite and enrich the prompt. For specific content requests, select the `Special-Ns` resource group and set this parameter to `false`.</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={false}>Whether to add an AI Generated watermark.</ParamField>
    <ParamField body="parameters.seed" type="integer">Random seed in `[0, 2147483647]`.</ParamField>
  </Tab>
</Tabs>

## Response

<ResponseField name="id" type="string">Created task ID.</ResponseField>
<ResponseField name="task_id" type="string">Created task ID; use it for task queries.</ResponseField>
<ResponseField name="object" type="string">Response object type, returned as `video`.</ResponseField>
<ResponseField name="model" type="string">Model used for task creation.</ResponseField>
<ResponseField name="status" type="string">Initial task status, normally `queued`.</ResponseField>
<ResponseField name="progress" type="integer">Initial task progress, normally `0`.</ResponseField>
<ResponseField name="created_at" type="integer">Task creation time as a Unix timestamp.</ResponseField>

## Error responses

* `400 Bad Request` - Invalid input or unsupported parameter or media combination.
* `401 Unauthorized` - API key is missing or invalid.
* `429 Rate limit exceeded` - Request rate exceeded the applicable limit.

<script src="/public/feedback.js" />
