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

# Wan Image Edit

> Calls Ali `wan2.7-image-pro` to perform image editing.

The public calling convention keeps top-level `model`, `input`, `response_format`, and exposes `size`, `n`, `watermark`, `negative_prompt`, `seed`, `bbox_list` as top-level fields. Input images are placed in `input.messages[0].content[].image`, and the editing instruction is in a `text` item within the same array. The request body does not accept a top-level `parameters` field.



## OpenAPI

````yaml api-reference/en/zmodelImage/ali/wan-edit.json POST /v1/images/edits
openapi: 3.0.1
info:
  title: Wan image editing
  version: 1.0.0
  description: >-
    Ali Wan image editing capability documentation. The unified API endpoint is
    `/v1/images/edits`. This document describes the public gateway contract for
    `wan2.7-image-pro`: `input.messages[].content[]` carries images and text
    instructions, while other control fields use top-level OpenAI-style fields
    that the gateway maps to upstream `parameters`.
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API server endpoint
security: []
tags:
  - name: Wan Image
    description: Wan image editing capability
paths:
  /v1/images/edits:
    post:
      tags:
        - Wan Image
      summary: Wan image editing
      description: >-
        Calls Ali `wan2.7-image-pro` to perform image editing.


        The public calling convention keeps top-level `model`, `input`,
        `response_format`, and exposes `size`, `n`, `watermark`,
        `negative_prompt`, `seed`, `bbox_list` as top-level fields. Input images
        are placed in `input.messages[0].content[].image`, and the editing
        instruction is in a `text` item within the same array. The request body
        does not accept a top-level `parameters` field.
      operationId: aliWanImageEdit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WanImageEditRequest'
            examples:
              image_edit:
                summary: Image editing
                value:
                  model: wan2.7-image-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - image: https://example.com/car.webp
                          - image: https://example.com/paint.webp
                          - text: >-
                              Spray the graffiti from image 2 onto the car in
                              image 1
                  size: 2K
                  'n': 1
                  watermark: false
                  negative_prompt: Preserve original car body color
                  seed: 0
              interactive_edit:
                summary: Interactive editing
                value:
                  model: wan2.7-image-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - image: https://example.com/clock.webp
                          - image: https://example.com/room.webp
                          - text: >-
                              Place the alarm clock from image 1 at the selected
                              area in image 2
                  bbox_list:
                    - []
                    - - - 989
                        - 515
                        - 1138
                        - 681
                  size: 2K
                  'n': 1
                  watermark: false
      responses:
        '200':
          description: Success. Returns the image editing result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed, e.g. missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Request body too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit triggered or insufficient account quota.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error while processing the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream provider returned an abnormal response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Upstream provider is temporarily unavailable, or no available
            channel for the current model.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    WanImageEditRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - wan2.7-image-pro
          description: 'Model name. Available value: `wan2.7-image-pro`.'
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: 'Unified response format. Supported values: `url` or `b64_json`.'
          default: url
        input:
          $ref: '#/components/schemas/WanImageInput'
        size:
          type: string
          description: >-
            Controls output image resolution. Supports two modes (do not mix):


            **Mode 1: Resolution preset (recommended)**

            Supported presets: `1K`, `2K` (default), `4K`.

            - Text-to-image (no input image, non-sequential): supports 1K, 2K,
            4K.

            - Other scenarios: supports 1K, 2K.

            - Pixel totals: 1K = 1024×1024, 2K = 2048×2048, 4K = 4096×4096.

            - With input image: output aspect ratio matches the last input
            image, scaled to the selected resolution.

            - Without input image: output is square.


            **Mode 2: Custom width×height**

            Format: `{width}*{height}`, e.g. `1024*768`.

            - Text-to-image: total pixels [768×768, 4096×4096], aspect ratio
            [1:8, 8:1].

            - Other scenarios: total pixels [768×768, 2048×2048], aspect ratio
            [1:8, 8:1].


            Note: actual output dimensions may differ slightly from the
            specified values.
          x-enum:
            - 1K
            - 2K
          default: 1K
        'n':
          type: integer
          minimum: 1
          maximum: 12
          description: >-
            Important: `n` directly affects cost. Cost = unit price × number of
            successfully generated images. Confirm the model pricing before
            calling.


            When group mode is disabled, this value represents the number of
            generated images. Range: 1-4, default: 1.


            When group mode is enabled, this value represents the maximum number
            of generated images. Range: 1-12, default: 12. The actual count is
            determined by the model and will not exceed `n`.
        watermark:
          type: boolean
          description: >-
            Whether to add a watermark. The watermark is positioned at the
            bottom-right corner with the text 'AI生成'. `false` (default): no
            watermark. `true`: add watermark.
          default: false
        negative_prompt:
          type: string
          description: Negative prompt. Describes what should be avoided in the output.
        seed:
          type: integer
          description: >-
            Random seed. Range [0, 2147483647].


            Using the same seed value helps keep generation results relatively
            stable. If not provided, the algorithm automatically uses a random
            seed.


            Note: the generation process is probabilistic; the same seed does
            not guarantee identical results every time.
          default: 0
          minimum: 0
          maximum: 2147483647
        bbox_list:
          type: array
          description: >+
            Interactive editing bounding box regions.


            Correspondence: The list length must match the number of input
            images. If an image does not need editing, pass an empty array `[]`
            at the corresponding position.


            Coordinate format: `[x1, y1, x2, y2]` (top-left x, top-left y,
            bottom-right x, bottom-right y), using absolute pixel coordinates of
            the original image, with (0,0) at the top-left corner.


            Constraint: Maximum 2 bounding boxes per image.


            Example: Input 3 images where the 2nd image has no selection, and
            the 1st has two selections:


            ```

            [
              [[0, 0, 12, 12], [25, 25, 100, 100]],  # Image 1 (2 boxes)
              [],                                    # Image 2 (no box)
              [[10, 10, 50, 50]]                    # Image 3 (1 box)
            ]

            ```

          items:
            type: array
            items:
              type: array
              items:
                type: integer
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          format: int64
          description: Response generation timestamp.
        data:
          type: array
          description: List of generated image results.
          items:
            $ref: '#/components/schemas/ImageData'
        metadata:
          type: object
          description: Pass-through raw response metadata from the upstream provider.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                Error type, e.g. `invalid_request_error`, `api_error`, or an
                upstream-compatible error type.
            code:
              type: string
            param:
              type: string
    WanImageInput:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          minItems: 1
          maxItems: 1
          description: >-
            Message content array. Currently only single-turn conversation is
            supported, i.e. one set of `role`/`content` parameters. Multi-turn
            conversation is not supported.
          items:
            $ref: '#/components/schemas/WanImageMessage'
    ImageData:
      type: object
      properties:
        url:
          type: string
          description: Used when the result is returned as a URL.
        b64_json:
          type: string
          description: Used when the result is returned as Base64.
        revised_prompt:
          type: string
          description: Revised prompt returned by the upstream provider.
    WanImageMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Fixed to `user`.
        content:
          type: array
          description: Message content array. Contains `text` and/or `image` objects.
          items:
            $ref: '#/components/schemas/WanImageContent'
    WanImageContent:
      type: object
      properties:
        image:
          type: string
          description: >-
            Input image URL or Base64 encoded string.


            Image restrictions:


            Image formats: JPEG, JPG, PNG (no alpha channel), BMP, WEBP.


            Image resolution: width and height must both be in the range [240,
            8000] pixels, aspect ratio [1:8, 8:1].


            File size: up to 20MB.


            Image count limits:


            0-9 images can be provided. When inputting multiple images, pass
            multiple `image` objects in the `content` array in sequential order.


            Supported input formats:


            - Publicly accessible URL
              Supports HTTP or HTTPS.
              Example: `http://wanx.alicdn.com/material/xxx.jpeg`.

            - Base64 encoded image string
              Format: `data:{MIME_type};base64,{base64_data}`
              Example: `data:image/jpeg;base64,GDU7MtCZzEbTbmRZ...` (illustration only, actual complete string required).
        text:
          type: string
          maxLength: 5000
          description: >-
            Prompt. Supports Chinese and English, up to 5000 characters (each
            character, letter, digit, or symbol counts as one). Excess
            characters will be automatically truncated.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````