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

Overview

Edit and transform images using the wan2.6-image model with text prompts and reference images.

Image Requirements

PropertyRequirement
FormatsJPEG, JPG, PNG, BMP, WEBP
Dimensions[384, 5000] pixels for both width and height
Max file size10MB per image
Max images2 images
InputPublic URL or Base64 encoded data

Resolution Guidelines

  • Default: 1280*1280
  • Total pixels: Between 768*768 and 1440*1440
  • Aspect ratio: Between 1:4 and 4:1

Example Requests

Basic Image Editing

{
  "prompt": "Replace the character's clothing with traditional Chinese Hanfu",
  "images": ["https://example.com/portrait.jpg"],
  "n": 1
}

With Negative Prompt

{
  "prompt": "Transform the image into an oil painting style",
  "negative_prompt": "blurry, low quality, distorted",
  "images": ["https://example.com/photo.jpg"],
  "size": "1280*1280",
  "n": 1
}

With Custom Seed

{
  "prompt": "Add a colorful sunset background",
  "images": ["https://example.com/portrait.jpg"],
  "size": "1280*720",
  "n": 1,
  "seed": 42
}

Parameters

images

  • Required: Yes
  • Max items: 2
  • Description: Array of image URLs or Base64 encoded data

n (Number of Images)

  • Range: 1-4
  • Default: 4
  • Note: Directly affects cost

prompt_extend (Prompt Rewriting)

  • Default: false
  • Effect: Uses AI to enhance and expand short prompts

seed (Random Seed)

  • Range: 0 to 2,147,483,647
  • Purpose: Improves reproducibility of results

Authorizations

Authorization
string
header
required

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

Body

application/json
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 3 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: 3
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
prompt_extend
boolean
default:false

Enable intelligent prompt rewriting

Response

202 - application/json

Accepted - Task created successfully

task_info
object