Skip to main content
POST
/
vendors
/
alibaba
/
v1
/
wan2
/
image
/
generation
Wan2 Image Generation
curl --request POST \
  --url https://api.mulerun.com/vendors/alibaba/v1/wan2/image/generation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "wan2.5-t2i-preview",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "size": "1280*1280",
  "n": 4,
  "prompt_extend": false,
  "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>"
    }
  }
}
Beta
This model is currently in public testing. Not everyone has access, and API requests may also be unstable.
This API is compatible with Alibaba’s Tongyi Wanxiang (Wan2) models. Please refer to Alibaba Cloud’s official documentation for more details.

Overview

Generate high-quality images from text descriptions using Alibaba’s Wan2 text-to-image models.

Supported Model

wan2.5-t2i-preview

The latest Wan2.5 model with enhanced capabilities:
  • Support for longer prompts (up to 2000 characters)
  • Flexible resolution and aspect ratio support
  • Higher quality output

Resolution Guidelines

wan2.5-t2i-preview

  • Default: 1280*1280
  • Total pixels: Between 768*768 and 1440*1440
  • Aspect ratio: Between 1:4 and 4:1
  • Example: 768*2700 is valid (meets pixel and ratio requirements)

Common Aspect Ratios

Aspect RatioRecommended Resolution
1:11280*1280 or 1024*1024
2:3800*1200
3:21200*800
3:4960*1280
4:31280*960
9:16720*1280
16:91280*720
21:91344*576

Prompt Tips

For best results:
  • Be specific and descriptive about what you want to see
  • Include details about style, composition, lighting, and mood
  • Use the negative prompt to exclude unwanted elements
  • For short prompts, consider enabling prompt_extend for enhanced results

Example Requests

Basic Text-to-Image

{
  "model": "wan2.5-t2i-preview",
  "prompt": "A sitting orange cat with a joyful expression, lively and cute, realistic and accurate",
  "n": 1
}

With Negative Prompt

{
  "model": "wan2.5-t2i-preview",
  "prompt": "A serene mountain landscape at sunset, dramatic clouds, vibrant colors",
  "negative_prompt": "low resolution, error, worst quality, low quality, incomplete, extra fingers, poor proportions",
  "size": "1280*720",
  "n": 4
}

High-Resolution Portrait

{
  "model": "wan2.5-t2i-preview",
  "prompt": "Professional portrait of a woman in business attire, studio lighting, shallow depth of field, professional photography",
  "size": "960*1280",
  "n": 1,
  "prompt_extend": false
}

With Custom Seed for Reproducibility

{
  "model": "wan2.5-t2i-preview",
  "prompt": "Futuristic cityscape at night, neon lights, cyberpunk style",
  "size": "1344*576",
  "n": 1,
  "seed": 12345
}

Parameters

n (Number of Images)

  • Range: 1-4
  • Default: 4
  • Note: Directly affects cost (cost = unit price × number of images)
  • Recommendation: Set to 1 during testing to minimize costs

prompt_extend (Prompt Rewriting)

  • Default: false for wan2.5-t2i-preview
  • Effect: Uses AI to enhance and expand short prompts
  • Trade-off: Improves results for short prompts but increases processing time

seed (Random Seed)

  • Range: 0 to 2,147,483,647
  • Purpose: Improves reproducibility of results
  • Note: Due to probabilistic nature, same seed doesn’t guarantee identical results
  • Behavior: When n > 1, generates seeds as: seed, seed+1, seed+2, etc.

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-t2i-preview
required

Model name

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

Text description for the image.

  • wan2.5-t2i-preview: Max 2000 characters
  • wan2.2 and earlier: Max 800 characters
Maximum string length: 2000
negative_prompt
string

Negative prompt describing unwanted content (max 500 characters)

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

Image resolution in format "width*height" (e.g., "1280*1280")

  • wan2.5-t2i-preview: Default 1280*1280, total pixels in [768*768, 1440*1440], aspect ratio [1:4, 4:1]
  • wan2.2 and earlier: Default 1024*1024, dimensions [512, 1440], max resolution 1440*1440
n
integer
default:4

Number of images to generate (1-4)

Required range: 1 <= x <= 4
prompt_extend
boolean
default:false

Enable intelligent prompt rewriting (improves short prompts but increases processing time)

seed
integer

Random seed for reproducibility [0, 2147483647]

Required range: 0 <= x <= 2147483647

Response

202 - application/json

Accepted - Task created successfully

task_info
object