# Kling AI NEW API Specification

## Table of Contents
- I. General Information
  - API Domain
  - API Authentication
  - Error Code
- II. Image generation
- III. Video Generation
  - 3-0 Capability Map
  - 3-1【Text to Video】Create Task
  - 3-2【Text to Video】Query Task（Single）
  - 3-3【Text to Video】Query Task (List)
  - 3-4【Image to Video】Create Task
  - 3-5【Image to Video】Query Task（Single）
  - 3-6【Image to Video】Query Task (List)
  - 3-7【Multi-Image to Video】Create Task
  - 3-8【Multi-Image to Video】Query Task（Single）
  - 3-9【Multi-Image to Video】Query Task (List)
  - 3-10【Video Extension】Create Task
  - 3-11【Video Extension】Query Task (Single)
  - 3-12【Video Extension】Query Task (List)
  - 3-13【Lip-Sync】Create Task
  - 3-14【Lip-Sync】Query Task (Single)
  - 3-15【Lip-Sync】Query Task (List)
  - 3-16【Video Effects】Create Task
  - 3-17【Video Effects】Query Task（Single）
  - 3-18【Video Effects】Query Task (List)
- IV. Virtual Try-on
  - 4-1【Virtual Try-On】Create Task
  - 4-2【Virtual Try-on】Query Task（Single）
  - 4-3【Virtual Try-on】Query Task (List)
- V. Callback Protocol
- VI. Account Information Inquiry
  - 6-1 Query Resource Package List and Remaining Quantity under the Account

## 3-13【Lip-Sync】Create Task

**Protocol**: https  
**Request URL**: `/v1/videos/lip-sync`  
**Request Method**: POST  
**Request Format**: application/json  
**Response Format**: application/json  

### Request Header
| Field | Value | Description |
|-------|-------|-------------|
| Content-Type | application/json | Data Exchange Format |
| Authorization | Authentication information | Authentication information, refer to API authentication |

### Request Body
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| input | object | Required | None | Contains many fields used to specify video, lip-sync content, etc. |
| input.video_id | string | Optional | None | The ID of the video generated by the Kling AI. Either video_id or video_url must be provided, but not both. Only supports 5-second and 10-second videos generated within the last 30 days. |
| input.video_url | string | Optional | None | Get link for uploaded video. Either video_id or video_url must be provided, but not both. Video files support .mp4/.mov, file size ≤100MB, video length 2-10s, only 720p and 1080p supported, dimensions between 720px and 1920px. |
| input.mode | string | Required | None | Video Generation Mode. Enum values: text2video, audio2video |
| input.text | string | Optional | None | Text Content for Lip-Sync Video Generation. Required when mode is text2video. Max 120 characters. |
| input.voice_id | string | Optional | None | Voice ID. Required when mode is text2video. Various voice options available. |
| input.voice_language | string | Optional | zh | Voice language. Enum values: zh, en. Required when mode is text2video. |
| input.voice_speed | float | Optional | 1.0 | Speech Rate. Valid range: 0.8-2.0, accurate to one decimal place. |
| input.audio_type | string | Optional | None | Method of Transmitting Audio Files. Enum values: file, url. Required when mode is audio2video. |
| input.audio_file | string | Optional | None | Local Path of Audio File (Base64). Required when audio_type is file. Formats: .mp3/.wav/.m4a/.aac, max 5MB. |
| input.audio_url | string | Optional | None | Audio File Download URL. Required when audio_type is url. Formats: .mp3/.wav/.m4a/.aac, max 5MB. |
| callback_url | string | Optional | None | The callback notification address for the results of this task. |

### Response Body
```json
{
  "code": 0, // Error codes; Specific definitions can be found in Error codes
  "message": "string", // Error information
  "request_id": "string", // Request ID, generated by the system, used to track requests and troubleshoot problems
  "data": {
    "task_id": "string", // Task ID, generated by the system
    "task_status": "string", // Task status, Enum values: submitted, processing, succeed, failed
    "created_at": 1722769557708, // Task creation time, Unix timestamp, unit ms
    "updated_at": 1722769557708 // Task update time, Unix timestamp, unit ms
  }
}
```

## Note: This is a partial documentation capture. The complete API documentation includes sections on:
- General Information (API Domain, Authentication, Error Codes)
- Image Generation endpoints
- Complete Video Generation endpoints
- Virtual Try-on endpoints
- Callback Protocol
- Account Information Inquiry