Wan 2.1-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 import json 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, headers=headers, data=json.dumps(data)) 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 ApiExample { public static void main(String[] args) throws Exception { String url = "https://gateway.pixazo.ai/wan-video/v1/generateTextToVideoRequest"; String json = "{\n" + " \"model\": \"wan2.2-t2v-plus\",\n" + " \"input\": {\n" + " \"prompt\": \"A kitten running in the moonlight\",\n" + " \"negative_prompt\": \"flowers, people, text\"\n" + " },\n" + " \"parameters\": {\n" + " \"size\": \"1920*1080\"\n" + " }\n" + "}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Content-Type", "application/json") .header("Cache-Control", "no-cache") .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY") .POST(HttpRequest.BodyPublishers.ofString(json)) .timeout(Duration.ofSeconds(10)) .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 = [ 'model' => 'wan2.2-t2v-plus', 'input' => [ 'prompt' => 'A kitten running in the moonlight', 'negative_prompt' => 'flowers, people, text' ], 'parameters' => [ 'size' => '1920*1080' ] ]; $json = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); 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": "" } }

Request Body - Generate Text To Video Request

Parameters for /generateTextToVideoRequest:

ParameterRequiredTypeDescription
modelYesstringModel to use. Available values: "wan2.2-t2v-plus" (recommended), "wanx2.1-t2v-turbo", "wanx2.1-t2v-plus".
input.promptYesstringText description of the video to generate. Supports English and Chinese.
input.negative_promptNostringDefault: null. Elements to exclude from the video.
parameters.sizeNostringDefault: "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.nNointegerDefault: 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": "" } }

Request Headers

HeaderDescription
Content-Typeapplication/json
Cache-Controlno-cache
Ocp-Apim-Subscription-KeyAPI 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 CodeDescriptionResponse Body
200Success - The request was successfully processed.{ "success": true, ... }
Bad Request - The request contains invalid parameters or missing fields.{ "error": "Invalid request parameters" }
401Unauthorized - The provided subscription key is missing or invalid.{ "error": "Invalid or missing authentication" }
403Forbidden - The subscription does not have access to this API or action.{ "error": "Access denied for this operation" }
404Not Found - The requested resource or endpoint could not be found.{ "error": "Endpoint not found" }
Too Many Requests - The request rate limit has been exceeded.{ "error": "Rate limit exceeded, please retry later" }
500Internal 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-XXXXXXXXXXXXX" }

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-XXXXXXXXXXXXX" }
import requests import json 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-XXXXXXXXXXXXX" } response = requests.post(url, headers=headers, data=json.dumps(data)) 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-XXXXXXXXXXXXX' }; 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-XXXXXXXXXXXXX" }'
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 url = "https://gateway.pixazo.ai/wan-video-polling/getTextToVideoResult"; String json = "{\n" + " \"task_id\": \"19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXX\"\n" + "}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Content-Type", "application/json") .header("Cache-Control", "no-cache") .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY") .POST(HttpRequest.BodyPublishers.ofString(json)) .timeout(Duration.ofSeconds(10)) .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 = [ 'task_id' => '19d8e7a6-c652-XXXX-XXXX-XXXXXXXXXXXXX' ]; $json = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); 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": "", "orig_prompt": "A kitten running in the moonlight", "actual_prompt": "" }, "usage": { "video_duration": 5, "video_ratio": "1920*1080", "video_count": 1 } }