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

# Wan 2.7 Video Edit API

> Edit a video with Wan 2.7 using an optional text prompt and reference image, with configurable output and audio settings.

## Billing Introduction

> [!NOTE]
>
> The credit rate is determined by the output video resolution. The total credit cost is calculated based on the output video's duration. See the [Billing Introduction](https://ailabtools.mintlify.site/docs/billing-introduction.md#2-7-video-edit) for current credit rates.

## File Storage Policy

<table><thead><tr><th>Data Type</th>
<th>Stored</th>
<th>Retention</th>
<th>Training</th>
<th>Deletion</th></tr></thead>
<tbody><tr><td>Uploaded Files</td>
<td>No</td>
<td>N/A</td>
<td>No</td>
<td>Immediate</td></tr></tbody></table>

> [!TIP]
>
> For more information, see the [File Storage Policy](https://ailabtools.mintlify.site/docs/file-storage-policy.md) and [Privacy Policy](https://www.ailabtools.com/privacy-policy).

## Query Task

> [!NOTE]
>
> This API creates an asynchronous task. Save the returned `task_id`, then use [Querying Async Task Results](https://ailabtools.mintlify.site/docs/ai-common/async-task-results/api.md) to retrieve its final result. Results remain available for 24 hours; wait at least 5 seconds between queries.

| Field | Type | Description |
| :- | :- | :- |
| `data` | `object` | |
| +`result_json` | `object` | |
| ++`result_urls` | `array` | Result video URLs. |
| +++`result_urls[]` | `string` | Result video URL. |

```json theme={null}
{
  "data": {
    "result_urls": [""]
  }
}
```

> [!WARNING]
>
> All result URLs are temporarily available and will expire after 24 hours.

## Submit Task


## OpenAPI

````yaml docs/ai-model/video/wan/27/video-edit-openapi.json POST /api/model/task/create
openapi: 3.2.1
info:
  title: AILabTools API
  termsOfService: https://www.ailabtools.com/term-of-use
  contact:
    name: AILabTools Support Team
    url: https://www.ailabtools.com/support
    email: support@ailabtools.com
  version: 1.0.0
servers:
  - url: https://www.ailabapi.com
security:
  - apiKeyAuth: []
paths:
  /api/model/task/create:
    post:
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - model
                - video
              properties:
                model:
                  type: string
                  enum:
                    - wan-27/video-edit
                  example: wan-27/video-edit
                  description: Model.
                video:
                  type: string
                  contentMediaType: application/octet-stream
                  description: |-
                    Source video for editing. 
                    - Supported formats: `MP4` `MOV`. 
                    - Maximum file size: `100 MB`. 
                    - Duration: `1–30 seconds`. 
                    - Minimum resolution: `256 × 256 px`. 
                    - Maximum resolution: `4096 × 4096 px`. 
                    - Aspect ratio: From `1:8` to `8:1`.
                reference_image:
                  type: string
                  contentMediaType: application/octet-stream
                  description: >-
                    Reference image for guiding character appearance, clothing,
                    or visual style. 

                    - Supported formats: `JPEG` `JPG` `PNG` `WEBP` `BMP` 

                    - Maximum file size: No more than 20 MB. 

                    - Minimum resolution: `256 × 256 px`. 

                    - Maximum resolution: `8000 × 8000 px`. 

                    - Aspect ratio: From `1:8` to `8:1`.
                prompt:
                  type: string
                  maxLength: 5000
                  example: >-
                    Change the scene to a warm sunset while preserving the
                    original subjects and camera movement.
                  description: Prompt.
                negative_prompt:
                  type: string
                  maxLength: 500
                  example: >-
                    Blurry details, flickering, distorted shapes, abrupt camera
                    movement.
                  description: Negative prompt.
                resolution:
                  type: string
                  enum:
                    - 720p
                    - 1080p
                  default: 720p
                  description: Output video resolution.
                duration:
                  type: integer
                  enum:
                    - 0
                    - 2
                    - 3
                    - 4
                    - 5
                    - 6
                    - 7
                    - 8
                    - 9
                    - 10
                  default: 0
                  description: >-
                    Output video duration in seconds. 

                    - `0`: Uses the full duration of the input video without
                    truncation. 

                    - `2 - 10`: Trims the input video from the beginning to the
                    specified duration.
                aspect_ratio:
                  type: string
                  enum:
                    - '1:1'
                    - '3:4'
                    - '4:3'
                    - '9:16'
                    - '16:9'
                  default: '16:9'
                  description: Output video aspect ratio.
                audio_setting:
                  type: string
                  enum:
                    - auto
                    - origin
                  default: auto
                  description: >-
                    Audio handling for the output video. 

                    - `auto`: The model decides whether to regenerate audio
                    based on the `prompt`. 

                    - `origin`: Preserves the original audio from the input
                    video.
                seed:
                  type: integer
                  format: int32
                  minimum: 0
                  maximum: 2147483647
                  description: >-
                    Random seed. Using the same parameters and seed helps
                    improve result reproducibility.
                prompt_extend:
                  type: boolean
                  default: true
                  description: Whether to enable intelligent prompt rewriting.
                watermark:
                  type: boolean
                  default: false
                  description: Whether to add an AI-generated watermark.
                nsfw_checker:
                  type: boolean
                  default: false
                  description: >-
                    Whether to enable additional NSFW content filtering for
                    model-generated results.
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/commonResponseData'
                  - $ref: '#/components/schemas/asyncTaskId'
              example:
                request_id: 01A1E397-AF68-53D9-8CFD-6831D8F108BD
                log_id: '100000000'
                error_detail:
                  code: ''
                  code_message: ''
                  message: ''
                task_id: 1794820417.b515cde0-d9c8-4ad2-206a-bcdu0613bbb1
        4XX:
          $ref: '#/components/responses/4XX'
        5XX:
          $ref: '#/components/responses/5XX'
components:
  schemas:
    commonResponseData:
      type: object
      required:
        - request_id
        - log_id
        - error_detail
      properties:
        request_id:
          type: string
          description: Request ID for debugging.
        log_id:
          type: string
          description: Log ID for debugging.
        error_detail:
          type: object
          required:
            - code
            - code_message
            - message
          properties:
            code:
              type: string
              description: >-
                Error Code. See [Error
                Codes](/docs/response-description#error-codes).
            code_message:
              type: string
              description: Error summary.
            message:
              type: string
              description: Error message.
    asyncTaskId:
      type: object
      required:
        - task_id
      properties:
        task_id:
          type: string
          description: >-
            Task ID for querying [Querying Async Task
            Results](/docs/ai-common/async-task-results/api).
  responses:
    4XX:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/commonResponseData'
          example:
            request_id: 01A1E397-AF68-53D9-8CFD-6831D8F108BD
            log_id: '100000000'
            error_detail:
              code: ERROR_PARAMETERS
              code_message: Invalid parameters.
              message: 'Invalid parameters. - image: Cannot be empty.'
    5XX:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/commonResponseData'
          example:
            request_id: 01A1E397-AF68-53D9-8CFD-6831D8F108BD
            log_id: '100000000'
            error_detail:
              code: ERROR_INTERNAL_SERVER_ERROR
              code_message: >-
                Internal server error. Please try again later. If not resolved
                promptly, contact the platform.
              message: >-
                Internal server error. Please try again later. If not resolved
                promptly, contact the platform.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: ailabapi-api-key
      description: API KEY for authentication. See [Get API KEY](/docs/get-api-key).

````

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