Create Generation Task
curl --request POST \
--url https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"negative_prompt": "<string>",
"size": "1280*1280",
"n": 4,
"prompt_extend": false,
"seed": 1073741823,
"safety_filter": true
}
'import requests
url = "https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation"
payload = {
"prompt": "<string>",
"negative_prompt": "<string>",
"size": "1280*1280",
"n": 4,
"prompt_extend": False,
"seed": 1073741823,
"safety_filter": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
negative_prompt: '<string>',
size: '1280*1280',
n: 4,
prompt_extend: false,
seed: 1073741823,
safety_filter: true
})
};
fetch('https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'negative_prompt' => '<string>',
'size' => '1280*1280',
'n' => 4,
'prompt_extend' => false,
'seed' => 1073741823,
'safety_filter' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"size\": \"1280*1280\",\n \"n\": 4,\n \"prompt_extend\": false,\n \"seed\": 1073741823,\n \"safety_filter\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"size\": \"1280*1280\",\n \"n\": 4,\n \"prompt_extend\": false,\n \"seed\": 1073741823,\n \"safety_filter\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"size\": \"1280*1280\",\n \"n\": 4,\n \"prompt_extend\": false,\n \"seed\": 1073741823,\n \"safety_filter\": true\n}"
response = http.request(request)
puts response.read_body{
"task_info": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Wan 2.5 Text-To-Image Preview
Wan 2.5 Text-To-Image Preview Generation
Generate images from text prompts using the wan2.5-t2i-preview model.
POST
/
vendors
/
alibaba
/
v1
/
wan2.5-t2i-preview
/
generation
Create Generation Task
curl --request POST \
--url https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"negative_prompt": "<string>",
"size": "1280*1280",
"n": 4,
"prompt_extend": false,
"seed": 1073741823,
"safety_filter": true
}
'import requests
url = "https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation"
payload = {
"prompt": "<string>",
"negative_prompt": "<string>",
"size": "1280*1280",
"n": 4,
"prompt_extend": False,
"seed": 1073741823,
"safety_filter": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
negative_prompt: '<string>',
size: '1280*1280',
n: 4,
prompt_extend: false,
seed: 1073741823,
safety_filter: true
})
};
fetch('https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'negative_prompt' => '<string>',
'size' => '1280*1280',
'n' => 4,
'prompt_extend' => false,
'seed' => 1073741823,
'safety_filter' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"size\": \"1280*1280\",\n \"n\": 4,\n \"prompt_extend\": false,\n \"seed\": 1073741823,\n \"safety_filter\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"size\": \"1280*1280\",\n \"n\": 4,\n \"prompt_extend\": false,\n \"seed\": 1073741823,\n \"safety_filter\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mulerouter.ai/vendors/alibaba/v1/wan2.5-t2i-preview/generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"size\": \"1280*1280\",\n \"n\": 4,\n \"prompt_extend\": false,\n \"seed\": 1073741823,\n \"safety_filter\": true\n}"
response = http.request(request)
puts response.read_body{
"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
Generate high-quality images from text descriptions using the wan2.5-t2i-preview model. This is the latest Wan2.5 text-to-image model with enhanced capabilities.Key Features
- Support for longer prompts (up to 2000 characters)
- Flexible resolution and aspect ratio support
- Higher quality output
Resolution Guidelines
- 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 Ratio | Recommended Resolution |
|---|---|
| 1:1 | 1280*1280 or 1024*1024 |
| 2:3 | 800*1200 |
| 3:2 | 1200*800 |
| 3:4 | 960*1280 |
| 4:3 | 1280*960 |
| 9:16 | 720*1280 |
| 16:9 | 1280*720 |
| 21:9 | 1344*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_extendfor enhanced results
Example Requests
Basic Text-to-Image
{
"prompt": "A sitting orange cat with a joyful expression, lively and cute, realistic and accurate",
"n": 1
}
With Negative Prompt
{
"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
{
"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
{
"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
- 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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Text description for the image (max 2000 characters).
Maximum string length:
2000Negative prompt describing unwanted content (max 500 characters)
Maximum string length:
500Image resolution in format "width*height" (e.g., "1280*1280")
Default: 1280*1280 Total pixels: [768*768, 1440*1440], aspect ratio: [1:4, 4:1]
Number of images to generate (1-4)
Required range:
1 <= x <= 4Enable intelligent prompt rewriting (improves short prompts but increases processing time)
Random seed for reproducibility [0, 2147483647]
Required range:
0 <= x <= 2147483647Enable content safety filter. Defaults to true. Set to false to disable content safety inspection.
Response
202 - application/json
Accepted - Task created successfully
Show child attributes
Show child attributes

