Wan2.2 T2V API Documentation
Generate Text To Video Request - Request Code
POST https://gateway.pixazo.ai/wan-video/v1/generateTextToVideoRequest Content-Type: application/json Cache-Control: no-cache Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY { "model": "wan2.2-t2v-plus", "input": { "prompt": "A kitten running in the moonlight", "negative_prompt": "flowers, people, text" }, "parameters": { "size": "1920*1080" } } import requests url = "https://gateway.pixazo.ai/wan-video/v1/generateTextToVideoRequest" headers = { "Content-Type": "application/json", "Cache-Control": "no-cache", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY" } data = { "model": "wan2.2-t2v-plus", "input": { "prompt": "A kitten running in the moonlight", "negative_prompt": "flowers, people, text" }, "parameters": { "size": "1920*1080" } } response = requests.post(url, json=data, headers=headers) print(response.json()) const url = "https://gateway.pixazo.ai/wan-video/v1/generateTextToVideoRequest"; const headers = { "Content-Type": "application/json", "Cache-Control": "no-cache", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY" }; const data = { "model": "wan2.2-t2v-plus", "input": { "prompt": "A kitten running in the moonlight", "negative_prompt": "flowers, people, text" }, "parameters": { "size": "1920*1080" } }; fetch(url, { method: "POST", headers: headers, 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-video/v1/generateTextToVideoRequest" \ -H "Content-Type: application/json" \ -H "Cache-Control: no-cache" \ -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \ --data-raw '{ "model": "wan2.2-t2v-plus", "input": { "prompt": "A kitten running in the moonlight", "negative_prompt": "flowers, people, text" }, "parameters": { "size": "1920*1080" } }' 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 ApiClient { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); String json = """ { "model": "wan2.2-t2v-plus", "input": { "prompt": "A kitten running in the moonlight", "negative_prompt": "flowers, people, text" }, "parameters": { "size": "1920*1080" } } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://gateway.pixazo.ai/wan-video/v1/generateTextToVideoRequest")) .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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } <?php $url = 'https://gateway.pixazo.ai/wan-video/v1/generateTextToVideoRequest'; $data = json_encode([ 'model' => 'wan2.2-t2v-plus', 'input' => [ 'prompt' => 'A kitten running in the moonlight', 'negative_prompt' => 'flowers, people, text' ], 'parameters' => [ 'size' => '1920*1080' ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $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": "ae89146e-7d12-XXXX-XXXX-XXXXXXXXXXXXXX", "output": { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX", "task_status": "PENDING" } } Request Body - Generate Text To Video Request
Parameters for /generateTextToVideoRequest:
| Parameter | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | Model to use. Available values: "wan2.2-t2v-plus" (recommended), "wanx2.1-t2v-turbo", "wanx2.1-t2v-plus". |
| input.prompt | Yes | string | Text description of the video to generate. Supports English and Chinese. |
| input.negative_prompt | No | string | Default: null. Elements to exclude from the video. |
| parameters.size | No | string | Default: "1280*720". Available resolutions vary by model: wan2.2-t2v-plus: "640*480" or "1920*1080"; wanx2.1-t2v-turbo: "640*480" or "1280*720"; wanx2.1-t2v-plus: only "1280*720". |
| parameters.n | No | integer | Default: 1. Number of videos to generate. Currently only 1 is supported. |
Example Request - Generate Text To Video Request
JSON
{ "model": "wan2.2-t2v-plus", "input": { "prompt": "A kitten running in the moonlight", "negative_prompt": "flowers, people, text" }, "parameters": { "size": "1920*1080" } } Response - Generate Text To Video Request
JSON
{ "request_id": "ae89146e-7d12-XXXX-XXXX-XXXXXXXXXXXXXX", "output": { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX", "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 Text to Video 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 Results
After submitting your request, use this endpoint to check status and retrieve results.
Endpoint
POST https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult
Request Body
{ "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX" } Code Examples
POST https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult Content-Type: application/json Cache-Control: no-cache Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX" } import requests url = "https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult" headers = { "Content-Type": "application/json", "Cache-Control": "no-cache", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY" } data = { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX" } response = requests.post(url, json=data, headers=headers) print(response.json()) const url = "https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult"; const headers = { "Content-Type": "application/json", "Cache-Control": "no-cache", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY" }; const data = { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX" }; fetch(url, { method: "POST", headers: headers, 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-video-polling/getTextToVideoResult" \ -H "Content-Type: application/json" \ -H "Cache-Control: no-cache" \ -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \ --data-raw '{ "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX" }' 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 PollingClient { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); String json = """ { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX" } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult")) .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 response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } <?php $url = 'https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult'; $data = json_encode([ 'task_id' => '19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXXX' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $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; ?> Example Success Response
{ "request_id": "9b07c1f1-8032-XXXX-XXXX-XXXXXXXXXXXXX", "output": { "task_id": "19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXX", "task_status": "SUCCEEDED", "submit_time": "2025-09-06 18:03:09.999", "scheduled_time": "2025-09-06 18:03:10.017", "end_time": "2025-09-06 18:04:56.637", "video_url": "https://example.com/video123.mp4", "orig_prompt": "A kitten running in the moonlight", "actual_prompt": "A cute kitten running gracefully under the moonlight on a quiet night" }, "usage": { "video_duration": 5, "video_ratio": "1920*1080", "video_count": 1 } } Wan2.2 T2V API Pricing
| Model | CostPerSec | Resolution | Seconds | Price (USD) |
|---|---|---|---|---|
| wan2.2-t2v-plus | 0.12 | 1080*1920 | 5 | $0.6 |
| wan2.1-t2v-turbo | 0.06 | 1280*720 | 5 | $0.3 |
| wan2.1-t2v-plus | 0.12 | 1280*720 | 5 | $0.6 |