Skip to main content
POST
/
vendors
/
alibaba
/
v1
/
wan2
/
image
/
edit
Wan2 Image Edit
curl --request POST \
  --url https://api.mulerouter.ai/vendors/alibaba/v1/wan2/image/edit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "wan2.5-i2i-preview",
  "prompt": "<string>",
  "images": [
    "<string>"
  ],
  "negative_prompt": "<string>",
  "size": "1280*1280",
  "n": 4,
  "seed": 1073741823
}
'
{
  "task_info": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "status": "pending",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "error": {
      "code": 123,
      "title": "<string>",
      "detail": "<string>"
    }
  }
}
This API is compatible with Alibaba’s Tongyi Wanxiang (Wan2) image editing models. Please refer to Alibaba Cloud’s official documentation for more details.

Overview

Edit and transform images using AI with Alibaba’s Wan2.5 image-to-image model. Provide reference images along with a text prompt to guide the editing process.

Supported Model

wan2.5-i2i-preview

Advanced image editing model that supports:
  • Multi-image input (up to 2 images)
  • Flexible output resolution
  • Style transfer and content modification

Input Image Requirements

PropertyRequirement
FormatsJPEG, JPG, PNG, BMP, WEBP
Dimensions[384, 5000] pixels for both width and height
File SizeMax 10MB per image
Max Images2 images

Output Resolution

  • Default: 1280*1280
  • Total pixels: Between 768768 and 14401440
  • Aspect ratio: Between 1:4 and 4:1

Use Cases

  • Style transfer (apply artistic style to photo)
  • Object replacement or modification
  • Background change
  • Color grading and mood adjustment
  • Composition refinement

Example Requests

Basic Image Edit

{
  "model": "wan2.5-i2i-preview",
  "prompt": "Transform the scene into autumn, with golden and orange leaves",
  "images": [
    "https://example.com/input_image.jpg"
  ],
  "n": 1
}

Style Transfer with Base64

{
  "model": "wan2.5-i2i-preview",
  "prompt": "Apply watercolor painting style, soft colors, artistic",
  "images": [
    "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
  ],
  "negative_prompt": "photorealistic, sharp details",
  "n": 4
}

Multi-Image Reference

{
  "model": "wan2.5-i2i-preview",
  "prompt": "Combine the composition from the first image with the color palette of the second",
  "images": [
    "https://example.com/composition_reference.jpg",
    "https://example.com/color_reference.jpg"
  ],
  "size": "1280*720",
  "n": 2
}

Character Redesign

{
  "model": "wan2.5-i2i-preview",
  "prompt": "Change the character's outfit to a formal business suit, maintain the pose and background",
  "images": [
    "https://example.com/character.jpg"
  ],
  "negative_prompt": "casual clothes, distorted proportions",
  "n": 1,
  "seed": 42
}

Input Image Format

Images can be provided as:
  1. Public URL: https://example.com/image.jpg
  2. Base64 encoded: data:image/jpeg;base64,{base64_data}

Parameters

images (Required)

  • Type: Array of strings
  • Max length: 2
  • Description: Reference images for editing
  • Multiple images allow for composition blending or style transfer

n (Number of Outputs)

  • Range: 1-4
  • Default: 4
  • Cost impact: Higher n = higher cost
  • Recommendation: Use n=1 for testing

prompt_extend

  • Default: false
  • Purpose: AI enhancement of short prompts
  • Trade-off: Better results vs. longer processing time

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
default:wan2.5-i2i-preview
required

Model name

Available options:
wan2.5-i2i-preview
prompt
string
required

Text description for the desired edit (max 2000 characters)

Maximum string length: 2000
images
string[]
required

Array of image URLs or Base64 encoded data (max 2 images)

Supported formats: JPEG, JPG, PNG, BMP, WEBP Dimensions: [384, 5000] pixels for both width and height Max file size: 10MB per image

Maximum array length: 2
negative_prompt
string

Negative prompt (max 500 characters)

Maximum string length: 500
size
string | null
default:1280*1280

Output image resolution (format: "width*height")

Default: 1280*1280 Total pixels: [768*768, 1440*1440], aspect ratio: [1:4, 4:1]

n
integer
default:4

Number of images to generate (1-4)

Required range: 1 <= x <= 4
seed
integer

Random seed [0, 2147483647]

Required range: 0 <= x <= 2147483647

Response

202 - application/json

Accepted - Task created successfully

task_info
object