Wan 2.5 API Documentation
Generate Text to Image - Request Code
POST https://gateway.pixazo.ai/wan-image-2-5/v1/generateTextToImage2-5Request HTTP/1.1
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY
{
"prompt": "A beautiful flower shop with exquisite windows, a beautiful wooden door, and flowers on display",
"size": "1024*1024",
"prompt_extend": true,
"watermark": false
} import requests
url = "https://gateway.pixazo.ai/wan-image-2-5/v1/generateTextToImage2-5Request"
headers = {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
"Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
"prompt": "A beautiful flower shop with exquisite windows, a beautiful wooden door, and flowers on display",
"size": "1024*1024",
"prompt_extend": True,
"watermark": False
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = 'https://gateway.pixazo.ai/wan-image-2-5/v1/generateTextToImage2-5Request';
const data = {
prompt: 'A beautiful flower shop with exquisite windows, a beautiful wooden door, and flowers on display',
size: '1024*1024',
prompt_extend: true,
watermark: false
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/wan-image-2-5/v1/generateTextToImage2-5Request" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
--data-raw '{
"prompt": "A beautiful flower shop with exquisite windows, a beautiful wooden door, and flowers on display",
"size": "1024*1024",
"prompt_extend": true,
"watermark": false
}' import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class ApiExample {
public static void main(String[] args) throws Exception {
String json = "{" + "
\"prompt\": \"A beautiful flower shop with exquisite windows, a beautiful wooden door, and flowers on display\"," + "
\"size\": \"1024*1024\"," + "
\"prompt_extend\": true," + "
\"watermark\": false" + "
}";
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://gateway.pixazo.ai/wan-image-2-5/v1/generateTextToImage2-5Request"))
.header("Content-Type", "application/json")
.header("Cache-Control", "no-cache")
.header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} <?php
$url = 'https://gateway.pixazo.ai/wan-image-2-5/v1/generateTextToImage2-5Request';
$data = [
'prompt' => 'A beautiful flower shop with exquisite windows, a beautiful wooden door, and flowers on display',
'size' => '1024*1024',
'prompt_extend' => true,
'watermark' => false
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Cache-Control: no-cache',
'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?> Output
Successful API response:
{ "request_id": "db27ee62-1148-9de4-aab9-xxxxxx", "task_id": "31c13f64-60e3-4822-b255-xxxxxx", "task_status": "PENDING" } Request Body - Generate Text to Image
Parameters for /generateTextToImage2-5Request:
| Parameter | Required | Type | Description |
|---|---|---|---|
| prompt | Yes | string | Text description of the image to generate. Supports English and Chinese. |
| negative_prompt | No | string | Default: null. Elements to exclude from the image. |
| size | No | string | Default: "1024*1024". Image dimensions in width*height format. |
| n | No | integer | Default: 1. Number of images to generate. Currently only 1 is supported. |
| prompt_extend | No | boolean | Default: false. Enable intelligent prompt rewriting |
| watermark | No | boolean | Default: false. Add watermark to image |
| seed | No | integer | Random seed for reproducible results |
Example Request - Generate Text to Image
JSON
{
"prompt": "Abstract digital art, vibrant colors, geometric shapes, modern design",
"size": "1024*1024",
"prompt_extend": true,
"watermark": false,
"seed": 98765
} Response - Generate Text to Image
JSON
{
"request_id": "db27ee62-1148-9de4-aab9-xxxxxx",
"task_id": "31c13f64-60e3-4822-b255-xxxxxx",
"task_status": "PENDING"
} Request Headers
| Header | Description |
|---|---|
| Content-Type | application/json |
| Cache-Control | no-cache |
| Ocp-Apim-Subscription-Key | Your API subscription key for authentication |
Response Handling
The Wan 2.5 Image Generation returns specific HTTP status codes and response bodies to indicate the success or failure of a request. Developers should implement error handling in their applications to manage these responses effectively.
Common Status Codes and Responses
| Status Code | Description | Response Body |
|---|---|---|
| 200 | Success - The request was successfully processed. | { "success": true, ... } |
| 400 | Bad Request - The request contains invalid parameters or missing fields. | { "error": "Invalid request parameters" } |
| 401 | Unauthorized - The provided subscription key is missing or invalid. | { "error": "Invalid or missing authentication" } |
| 403 | Forbidden - The subscription does not have access to this API or action. | { "error": "Access denied for this operation" } |
| 404 | Not Found - The requested resource or endpoint could not be found. | { "error": "Endpoint not found" } |
| 429 | Too Many Requests - The request rate limit has been exceeded. | { "error": "Rate limit exceeded, please retry later" } |
| 500 | Internal Server Error - An unexpected error occurred on the server. | { "error": "An unexpected error occurred, please try again later" } |
Example Error Response
{
"error": "Invalid parameters"
} Retrieving Image Result and URL
After submitting your request, use this endpoint to check status and retrieve results.
Endpoint
POST https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult
Request Body
{ "task_id": "your-task-id-here" } POST https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult HTTP/1.1
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY
{
"task_id": "31c13f64-60e3-4822-b255-xxxxxx"
} import requests
url = "https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult"
headers = {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
"Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
"task_id": "31c13f64-60e3-4822-b255-xxxxxx"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = 'https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult';
const data = {
task_id: '31c13f64-60e3-4822-b255-xxxxxx'
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
--data-raw '{
"task_id": "31c13f64-60e3-4822-b255-xxxxxx"
}' import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class PollingExample {
public static void main(String[] args) throws Exception {
String json = "{" + "
\"task_id\": \"31c13f64-60e3-4822-b255-xxxxxx\"" + "
}";
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult"))
.header("Content-Type", "application/json")
.header("Cache-Control", "no-cache")
.header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
} <?php
$url = 'https://gateway.pixazo.ai/wan-image-polling/getTextToImageResult';
$data = [
'task_id' => '31c13f64-60e3-4822-b255-xxxxxx'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Cache-Control: no-cache',
'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?> Wan 2.5 API Pricing
| Resolution | Price (USD) |
|---|---|
| All Resolution | $0.05 |
Ready to generate Wan 2.5 API assets?
Start with an API key, then automate your pipeline.