Kling AI Avatar v2 Pro API Documentation
Kling AI Avatar v2 Pro generate request - Request Code
POST https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request Content-Type: application/json Cache-Control: no-cache Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY { "image_url": "https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg", "audio_url": "https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3", "prompt": "smiling warmly, slight head turn" } import requests url = "https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request" headers = { "Content-Type": "application/json", "Cache-Control": "no-cache", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY" } data = { "image_url": "https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg", "audio_url": "https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3", "prompt": "smiling warmly, slight head turn" } response = requests.post(url, json=data, headers=headers) print(response.json()) const url = 'https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request'; const data = { image_url: 'https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg', audio_url: 'https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3', prompt: 'smiling warmly, slight head turn' }; 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 -X POST "https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request" \ -H "Content-Type: application/json" \ -H "Cache-Control: no-cache" \ -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \ --data-raw '{ "image_url": "https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg", "audio_url": "https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3", "prompt": "smiling warmly, slight head turn" }' 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 { String url = "https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request"; String json = """ { "image_url": "https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg", "audio_url": "https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3", "prompt": "smiling warmly, slight head turn" } """; HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); 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)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } <?php $url = 'https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request'; $data = json_encode([ 'image_url' => 'https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg', 'audio_url' => 'https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3', 'prompt' => 'smiling warmly, slight head turn' ]); $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:
{ "status": "IN_QUEUE", "request_id": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8", "response_url": "https://gateway-falai-automate.appypie.workers.dev/kling-ai-avatar-v2-pro-request-result" } Request Body - Kling AI Avatar v2 Pro generate request
Parameters for https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request:
| Parameter | Required | Type | Description |
|---|---|---|---|
| image_url | Yes | string | Publicly accessible URL to a static image (face portrait) to be animated. Supported formats: JPEG, PNG. |
| audio_url | Yes | string | Publicly accessible URL to an audio file (MP3, WAV) to drive lip-sync and expression animation. Maximum duration: 60 seconds. |
| prompt | Optional | string | Additional descriptive prompt to guide avatar expression and motion style. Example: "smiling warmly, slight head turn". |
Example Request - Kling AI Avatar v2 Pro generate request
JSON
{ "image_url": "https://storage.googleapis.com/falserverless/example_inputs/kling_ai_avatar_input.jpg", "audio_url": "https://v3.fal.media/files/rabbit/9_0ZG_geiWjZOmn9yscO6_output.mp3", "prompt": "smiling warmly, slight head turn" } Response - Kling AI Avatar v2 Pro generate request
JSON
{ "status": "IN_QUEUE", "request_id": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8", "response_url": "https://gateway-falai-automate.appypie.workers.dev/kling-ai-avatar-v2-pro-request-result" } Request Headers
| Header | Description |
|---|---|
| Content-Type | Must be set to application/json |
| Cache-Control | Must be set to no-cache |
| Ocp-Apim-Subscription-Key | Your subscription key for authentication |
Response Handling
The Kling AI Avatar v2 Pro 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/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request-result
Request Body
{ "request_id": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8" } Example Polling Request
curl -X POST "https://gateway.pixazo.ai/kling-ai-avatar-v2-pro-789/v1/kling-ai-avatar-v2-pro-request-result" \ -H "Content-Type: application/json" \ -H "Cache-Control: no-cache" \ -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \ --data-raw '{ "request_id": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8" }' Response States
| Status | Description |
|---|---|
| IN_QUEUE | Request is queued and waiting to be processed |
| IN_PROGRESS | Request is currently being processed |
| COMPLETED | Request completed successfully, avatar video is ready for download |
| FAILED | Request failed to process; check error message for details |
Example Success Response
{ "status": "COMPLETED", "request_id": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8", "video": { "url": "https://storage.example.com/output_videos/kling_avatar_a1b2c3.mp4", "width": 1080, "height": 1920, "duration": 12.5, "content_type": "video/mp4" } } Example In-Progress Response
{ "status": "IN_PROGRESS", "request_id": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8", "estimated_completion_time": 45, "progress_percent": 67 }