MaaS_KL Interface Documentation
This document only applies to the following models
- MaaS_KeLing_V1.6
- MaaS_KeLing_V2.1
- MaaS_KeLing_V2.1_master
- MaaS_KeLing_V2.5_turbo
- MaaS_KeLing_V2.6
Request Protocol
Http
Header
| Parameter Name | Type | Description |
|---|---|---|
| Authorization | string | Authentication |
Text to Video - Create Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpoinPath}/kling/videos/text2video
Request Method
POST
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model_name | string | Optional | kling-v1 | Model name, enum values: MaaS_KL_V1.6,MaaS_KL_V2.1_Master,MaaS_KeLing_V2.6 |
| prompt | string | Required | None | Positive text prompt, cannot exceed 2500 characters |
| sound | string | Optional | off | Enumeration value for whether to generate sound simultaneously when generating a video: on, off. Only the MaaS_KeLing_V2.6 model and its subsequent versions support this parameter. |
| negative_prompt | string | Optional | Empty | Negative text prompt, cannot exceed 2500 characters |
| cfg_scale | float | Optional | 0.5 | Freedom of video generation; higher value means less model freedom and stronger correlation with user input prompt, range: [0, 1].MaaS_KL_V2.1,MaaS_KL_V2.1_Master,MaaS_KeLing_V2.6 does not support this parameter. |
| mode | string | Optional | std | Video generation mode - enum values: std, pro. std: standard mode (standard), basic mode, cost-effective; pro: expert mode (high quality), high-performance mode, better video quality. Different model versions and video modes support different ranges. MaaS_KL_V2.1_Master does not support this parameter,MaaS_KeLing_V2.6 is currently only available for Pro. |
| camera_control | object | Optional | Empty | Protocol for controlling camera movement (if not specified, the model will intelligently match based on input text/image). Different model versions and video modes support different ranges |
| camera_control - type | string | Optional | None | Predefined camera movement type - enum values: "simple", "down_back", "forward_up", "right_turn_forward", "left_turn_forward". simple: simple camera movement, choose one of six in "config" for this type; down_back: camera moves down and back ➡ down and away, no config parameters needed; forward_up: camera moves forward and up ➡ push forward and up, no config parameters needed; right_turn_forward: first turn right then move forward ➡ right turn and push, no config parameters needed; left_turn_forward: first turn left then move forward ➡ left turn and push, no config parameters needed |
| camera_control - config | object | Optional | None | Contains six fields to specify camera movement or changes in different directions. Required when camera movement type is set to simple, not filled for other types. Choose 1 out of 6 parameters, i.e., only one parameter can be non-zero, the rest must be zero |
| camera_control - horizontal | float | Optional | None | Horizontal camera movement, controls camera movement in horizontal direction (along x-axis), range: [-10, 10], negative values indicate left movement, positive values indicate right movement |
| camera_control - vertical | float | Optional | None | Vertical camera movement, controls camera movement in vertical direction (along y-axis), range: [-10, 10], negative values indicate downward movement, positive values indicate upward movement |
| camera_control - pan | float | Optional | None | Horizontal pan, controls camera rotation in horizontal plane (around y-axis), range: [-10, 10], negative values indicate left rotation around y-axis, positive values indicate right rotation around y-axis |
| camera_control - tilt | float | Optional | None | Vertical tilt, controls camera rotation in vertical plane (along x-axis), range: [-10, 10], negative values indicate downward rotation around x-axis, positive values indicate upward rotation around x-axis |
| camera_control - roll | float | Optional | None | Camera roll, controls camera roll amount (rotation around z-axis), range: [-10, 10], negative values indicate counterclockwise rotation around z-axis, positive values indicate clockwise rotation around z-axis |
| camera_control - zoom | float | Optional | None | Zoom, controls camera focal length change, affecting field of view, range: [-10, 10], negative values indicate longer focal length and smaller field of view, positive values indicate shorter focal length and larger field of view |
| camera_control - aspect_ratio | string | Optional | 16:9 | Aspect ratio of generated video (width:height), enum values: 16:9, 9:16, 1:1 |
| duration | string | Optional | 5 | Generated video duration, unit: seconds, enum values: 5, 10 |
| external_task_id | string | Optional | None | Custom task ID - User-defined task ID, input will not override system-generated task ID, but supports task query through this ID. Please note, must be unique within a single user |
Request Example
curl --location 'https://genaiapi.cloudsway.net/v1/ai/XXX/kling/videos/text2video' \
--header 'Authorization: Bearer XXX' \
--header 'Content-Type: application/json' \
--data '{ "model_name":"kling-v1",
"prompt":"A dog running on the grass"
}'
Response Body
{
"request_id": "string", // Request ID, system-generated, used for tracking requests and troubleshooting
"code": 0, // Error code; see specific definitions in error codes
"message": "string", // Error message
"data": {
"task_id": "string", // Task ID, system-generated
"task_info": {
// Task creation parameter information
"external_task_id": "string" // Customer-defined task ID
},
"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
}
}
Text to Video - Query Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/kling/videos/text2video/{id}
Request Method
GET
Request Path Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| task_id | string | Optional | None | Text-to-video task ID, request path parameter, directly fill the value in the request path, choose one between this and external_task_id |
| external_task_id | string | Optional | None | Custom task ID for text-to-video, filled in when creating the task, choose one between this and task_id |
Response Body
{
"code": 0, // Error code; see specific definitions in error codes
"message": "string", // Error message
"request_id": "string", // Request ID, system-generated, used for tracking requests and troubleshooting
"data":{
"task_status": "string", // Task status, enum values: submitted, processing, succeed, failed
"task_status_msg": "string", // Task status information, displays failure reason when task fails (e.g., triggering platform's content risk control)
"task_info": { // Task creation parameter information
"task_id": "string", // Task ID, system-generated
"external_task_id": "string" // Customer-defined task ID
},
"task_result":{
"videos":[
{
"id": "string", // Generated video ID; globally unique
"url": "string", // Generated video URL, e.g., https://p1.a.kwimgs.com/bs2/upload-ylab-stunt/special-effect/
"duration": "string" // Total video duration, unit s
}
],
"created_at": 1722769557708, // Task creation time, Unix timestamp, unit ms
"updated_at": 1722769557708 // Task update time, Unix timestamp, unit ms
}
}
Image to Video - Create Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpoinPath}/kling/videos/image2video
Request Method
POST
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model_name | string | Optional | kling-v1 | Model name, enum values: MaaS_KL_V1.6, MaaS_KL_V2.1,MaaS_KL_V2.1_Master,MaaS_KeLing_V2.6 |
| image | string | Required | Empty | Reference image - Supports image Base64 encoding or image URL (ensure accessibility). Note: If using base64, ensure all image data parameters are correctly Base64 encoded, i.e., provide only the Base64 encoded string part, without the data: prefix. Supported image formats: .jpg / .jpeg / .png, image file size cannot exceed 10MB, image resolution not less than 300*300px. At least one of image or image_tail parameters must be provided, they cannot both be empty. The support range for image + image_tail parameters, dynamic_masks/static_mask parameters, and camera_control varies for different model versions and video modes, see the current document 3-0 capability map for details |
| image_tail | string | Optional | Empty | Reference image - Tail frame control. Supports image Base64 encoding or image URL (ensure accessibility), parameter format requirements same as image. Supported image formats: .jpg / .jpeg / .png, image file size cannot exceed 10MB, image resolution not less than 300*300px. At least one of image or image_tail parameters must be provided, they cannot both be empty. The support range for image + image_tail parameters, dynamic_masks/static_mask parameters, and camera_control varies for different model versions and video modes |
| sound | string | Optional | off | Enumeration value for whether to generate sound simultaneously when generating a video: on, off. Only the MaaS_KeLing_V2.6 model and its subsequent versions support this parameter. |
| prompt | string | Optional | None | Positive text prompt, cannot exceed 2500 characters |
| negative_prompt | string | Optional | Empty | Negative text prompt, cannot exceed 2500 characters |
| cfg_scale | float | Optional | 0.5 | Freedom of video generation; higher value means less model freedom and stronger correlation with user input prompt, range: [0, 1] |
| mode | string | Optional | std | Video generation mode - enum values: std, pro. std: standard mode (standard), basic mode, cost-effective; pro: expert mode (high quality), high-performance mode, better video quality. Different model versions and video modes support different ranges.MaaS_KL_V2.1_Master does not support this parameter,MaaS_KeLing_V2.6 is currently only available for Pro. |
| static_mask | string | Optional | None | Static brush smear area (mask image smeared by user using motion brush). "Motion brush" capability includes "dynamic brush dynamic_masks" and "static brush static_mask". Supports image Base64 encoding or image URL (ensure accessibility, format requirements same as image). Supported image formats: .jpg / .jpeg / .png, image aspect ratio must be the same as the input image (i.e., image field), otherwise the task fails. The resolution of static_mask and dynamic_masks.mask must be consistent. Different model versions and video modes support different ranges |
| dynamic_masks | array | Optional | None | Dynamic brush configuration list, can configure multiple groups (up to 6), each group includes "smear area mask" and "motion trajectory trajectories" |
| dynamic_masks - mask | string | Optional | None | Dynamic brush smear area (mask image smeared by user using motion brush). Supports image Base64 encoding or image URL (ensure accessibility, format requirements same as image). Supported image formats: .jpg / .jpeg / .png, image aspect ratio must be the same as the input image (i.e., image field), otherwise the task fails. The resolution of static_mask and dynamic_masks.mask must be consistent |
| dynamic_masks - trajectories | array | Optional | None | Motion trajectory coordinate sequence. For generating 5s video, trajectory length should not exceed 77, i.e., coordinate count range: [2, 77]. Trajectory coordinate system, with the bottom left corner of the image as the coordinate origin. Note 1: More trajectory points result in more accurate trajectory depiction, if only 2 trajectory points are provided, it will be a line connecting these two points. Note 2: Trajectory direction is based on the order of input, with the first input coordinate as the trajectory start point, connecting in sequence |
| dynamic_masks - trajectories - x | int | Optional | None | Trajectory point x-coordinate (pixel coordinate in 2D coordinate system with the bottom left of the input image as the origin) |
| dynamic_masks - trajectories - y | int | Optional | None | Trajectory point y-coordinate (pixel coordinate in 2D coordinate system with the bottom left of the input image as the origin) |
| camera_control | object | Optional | Empty | Protocol for controlling camera movement (if not specified, the model will intelligently match based on input text/image). Different model versions and video modes support different ranges |
| camera_control - type | string | Optional | None | Predefined camera movement type - enum values: "simple", "down_back", "forward_up", "right_turn_forward", "left_turn_forward". simple: simple camera movement, choose one of six in "config" for this type; down_back: camera moves down and back ➡ down and away, no config parameters needed; forward_up: camera moves forward and up ➡ push forward and up, no config parameters needed; right_turn_forward: first turn right then move forward ➡ right turn and push, no config parameters needed; left_turn_forward: first turn left then move forward ➡ left turn and push, no config parameters needed |
| camera_control - config | object | Optional | None | Contains six fields to specify camera movement or changes in different directions. Required when camera movement type is set to simple, not filled for other types. Choose 1 out of 6 parameters, i.e., only one parameter can be non-zero, the rest must be zero |
| camera_control - horizontal | float | Optional | None | Horizontal camera movement, controls camera movement in horizontal direction (along x-axis), range: [-10, 10], negative values indicate left movement, positive values indicate right movement |
| camera_control - vertical | float | Optional | None | Vertical camera movement, controls camera movement in vertical direction (along y-axis), range: [-10, 10], negative values indicate downward movement, positive values indicate upward movement |
| camera_control - pan | float | Optional | None | Horizontal pan, controls camera rotation in horizontal plane (around y-axis), range: [-10, 10], negative values indicate left rotation around y-axis, positive values indicate right rotation around y-axis |
| camera_control - tilt | float | Optional | None | Vertical tilt, controls camera rotation in vertical plane (along x-axis), range: [-10, 10], negative values indicate downward rotation around x-axis, positive values indicate upward rotation around x-axis |
| camera_control - roll | float | Optional | None | Camera roll, controls camera roll amount (rotation around z-axis), range: [-10, 10], negative values indicate counterclockwise rotation around z-axis, positive values indicate clockwise rotation around z-axis |
| camera_control - zoom | float | Optional | None | Zoom, controls camera focal length change, affecting field of view, range: [-10, 10], negative values indicate longer focal length and smaller field of view, positive values indicate shorter focal length and larger field of view |
| duration | string | Optional | 5 | Generated video duration, unit: seconds, enum values: 5, 10 |
| external_task_id | string | Optional | None | Custom task ID - User-defined task ID, input will not override system-generated task ID, but supports task query through this ID. Please note, must be unique within a single user |
Request Example
curl --location 'https://genaiapi.cloudsway.net/v1/ai/xxx/kling/videos/image2video' \
--header 'Authorization: Bearer xxx' \
--header 'Content-Type: application/json' \
--data '{ "model_name":"kling-v1",
"image":"https://pic1.zhimg.com/v2-0cbb2efa5a55f2e716eebe2d6a6eef67_r.jpg?source=12a79843",
"prompt":"Nezha practicing martial arts"
}'
Response Body
{
"code": 0, // Error code; see specific definitions in error codes
"message": "string", // Error message
"request_id": "string", // Request ID, system-generated, used for tracking requests and troubleshooting
"data": {
"task_id": "string", // Task ID, system-generated
"task_info": {
// Task creation parameter information
"external_task_id": "string" // Customer-defined task ID
},
"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
}
}
Image to Video - Query Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/kling/videos/image2video/{id}
Request Method
GET
Request Path Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| task_id | string | Optional | None | Image-to-video task ID Request path parameter, directly fill the value in the request path, choose one between this and external_task_id |
| external_task_id | string | Optional | None | Custom task ID for image-to-video Filled in when creating the task, choose one between this and task_id |
Response Body
{
"code": 0, // Error code; see specific definitions in error codes
"message": "string", // Error message
"request_id": "string", // Request ID, system-generated, used for tracking requests and troubleshooting
"data":{
"task_id": "string", // Task ID, system-generated
"task_status": "string", // Task status, enum values: submitted, processing, succeed, failed
"task_status_msg": "string", // Task status information, displays failure reason when task fails (e.g., triggering platform's content risk control)
"task_info": { // Task creation parameter information
"external_task_id": "string" // Customer-defined task ID
},
"task_result":{
"videos":[
{
"id": "string", // Generated video ID; globally unique
"url": "string", // Generated video URL, e.g., https://p1.a.kwimgs.com/bs2/upload-ylab-stunt/special-effect/
"duration": "string" // Total video duration, unit s
}
]
}
"created_at": 1722769557708, // Task creation time, Unix timestamp, unit ms
"updated_at": 1722769557708, // Task update time, Unix timestamp, unit ms
}
}
Video Extension - Create Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpoinPath}/kling/videos/video-extend
Request Method:
POST
Request Body
Video ID
- Supports video IDs generated by the text-to-video interface (Versions 2.1 do not support this.)
- Supports video IDs generated by the image-to-video interface (Versions 2.1 do not support this.)
- Supports video IDs generated by the video extension interface (note: cannot exceed 3 minutes)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| video_id | string | Required | None | Video ID - Supports video IDs generated by the text-to-video interface (Versions 2.1 do not support this.) - Supports video IDs generated by the image-to-video interface (Versions 2.1 do not support this.) - Supports video IDs generated by the video extension interface (note: cannot exceed 3 minutes) Please note that based on the current cleanup strategy, videos will be cleaned up after 30 days of generation, and cannot be extended after that |
| prompt | string | Optional | None | Positive text prompt Cannot exceed 2500 characters |
Request Example
curl --location 'https://genaiapi.cloudsway.net/v1/ai/xxx/kling/videos/video-extend' \
--header 'Authorization: Bearer xxx' \
--header 'Content-Type: application/json' \
--data '{
"video_id": "51bc9fb8-8068-44af-9e35-121212",
"prompt": "Nezha pulls out a red-marked spear from behind, standing on the wind-fire wheels"
}'
Response Body
Here's the English translation of the content, maintaining the original format:
{
"code": 0, //Error code; see specific definitions in error codes
"message": "string", //Error message
"request_id": "string", //Request ID, system-generated, used for tracking requests and troubleshooting
"data": {
"task_id": "string", //Task ID, system-generated
"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
}
}
Video Extension - Query Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/kling/videos/video-extend/{task_id}
Request Method:
GET
Request Path Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| task_id | string | Required | None | Video extension task ID Request path parameter, directly fill the value in the request path |
Response Body
{
"code": 0, //Error code; see specific definitions in 1.1 error codes
"message": "string", //Error message; see specific definitions in 1.1 error codes
"request_id": "string", //Request ID, system-generated, used for tracking requests and troubleshooting; globally unique
"data":{
"task_id": "string", //Task ID, system-generated; globally unique
"task_status": "string", //Task status, enum values: submitted, processing, succeed, failed
"task_status_msg": "string", //Task status information, displays failure reason when task fails (e.g., triggering platform's content risk control)
"task_info":{ //Task creation parameter information
"parent_video": {
"id": "string", //Video ID before extension; globally unique
"url": "string", //URL of the video before extension (Please note, for information security, generated images/videos will be cleaned up after 30 days, please transfer them in time)
"duration": "string" //Total duration of the video before extension, unit s
}
}, //Detailed information filled by the user when creating the task
"task_result":{
"videos":[ //Array is for maintaining extensibility, in case of future support for n
{
"id": "string", //Complete video ID after extension; globally unique
"url": "string", //URL of the video after extension
"duration": "string" //Total video duration, unit s
}
]
}
"created_at": 1722769557708, //Task creation time, Unix timestamp, unit ms
"updated_at": 1722769557708, //Task update time, Unix timestamp, unit ms
}
}
Multi-Image Reference to Video
Supported model: MaaS_KeLing_V1.6
Multi-Image Reference - Create Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/kling/videos/multi-image2video
Request Method
POST
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| model_name | string | Optional | MaaS_KeLing_V1.6 | Enumerated value of model name: MaaS_KeLing_V1.6 |
| image_list | array | Required | Empty | Supports up to 4 images, carried by key:value. There is no cropping logic on the API side, please upload directly. Images after selecting the subject support passing in image Base64 encoding or image URL (ensure accessibility). Please note that if you use base64, ensure all your image data parameters are in Base64 encoding format. When submitting data, do not add any prefix to the Base64 encoded string; the correct parameter format should be the Base64 encoded string directly for the system to process and parse your data correctly. Supported image formats: .jpg / .jpeg / .png Image file size cannot exceed 10MB, image width and height are not less than 300px, and the aspect ratio is between 1:2.5 and 2.5:1 |
| prompt | string | Required | None | Positive text prompt cannot exceed 2500 characters |
| negative_prompt | string | Optional | Empty | Negative text prompt cannot exceed 2500 characters |
| mode | string | Optional | std | Enumerated values for video generation mode: std, pro. std: standard mode (basic), cost-effective. pro: expert mode (high quality), high-performance mode, generating better quality videos. The support range varies by model version and video mode, see "3-0 Capability Map" in the current document |
| duration | string | Optional | 5 | Generated video duration, unit: s. Enumerated values: 5, 10 |
| aspect_ratio | string | Optional | 16:09 | Aspect ratio of the generated image (width:height). Enumerated values: 16:9, 9:16, 1:1 |
| callback_url | string | None | Callback notification address for the task result. If configured, the server will actively notify when the task status changes. See "Callback Protocol" for the specific notification message schema | |
| external_task_id | string | Optional | None | Custom task ID. User-defined task ID, which will not overwrite the system-generated task ID but supports task query through this ID. Please note that uniqueness must be ensured under a single user |
Request Example
curl 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/multi-image2video' \
-H 'Authorization: Bearer ${Your AK}' \
-H 'Content-Type: application/json' \
-d '{
"model_name": "MaaS_KeLing_V1.6",
"image_list": [
{
"image": "${Your image1}"
},
{
"image": "${Your image2}"
},
{
"image": "${Your image3}"
},
{
"image": "${Your image4}"
}
],
"prompt": "${Your prompt}",
"negative_prompt": "No negative energy content",
"mode": "std",
"duration": "10",
"aspect_ratio": "9:16",
"external_task_id": "xiaosuvideo03013018412"
}'
Response
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "xiaoshuvideo03013018412",
"task_status": "submitted",
"created_at": 1761532694501,
"updated_at": 1761532694501,
"task_info": {
"external_task_id": "xiaoshuvideo03013018412"
}
},
"request_id": "ba150df0-c007-4938-9a47-24ea2b561d6d"
}
Multi-Image Reference - Query Task (Single) Interface
Request URL
https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/kling/videos/multi-image2video/{task_id}
Request Method
GET
Request Example
curl 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/multi-image2video/xiaoshuvideo03013018412' \
-H 'Authorization: Bearer ${Your AK}' \
-H 'Content-Type: application/json'
Response
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "xiaoshuvideo03013018412",
"task_status": "succeed",
"created_at": 1761532694501,
"updated_at": 1761532868356,
"task_status_msg": "",
"task_info": {
"external_task_id": "xiaoshuvideo03013018412"
},
"task_result": {
"videos": [
{
"id": "$videoId",
"url": "$videoUrl",
"duration": "10.433"
}
]
}
},
"request_id": "7b9cf699-3f13-4727-93da-a64faf0e1ab4"
}
Lip Sync
Face Recognition - Create Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/identify-face
Request Method
POST
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| video_id | string | Optional | None | ID of the video generated by Kling AI Used to specify the video and determine if it can be used for lip-sync service. Choose one between video_id and video_url parameters, cannot be both empty or both have values. Only supports videos generated within 30 days with duration not exceeding 60 seconds |
| video_url | string | Optional | None | URL for obtaining the uploaded video Used to specify the video and determine if it can be used for lip-sync service. Choose one between video_id and video_url parameters, cannot be both empty or both have values. Video files support .mp4/.mov, file size not exceeding 100MB, video duration not exceeding 60s and not less than 2s, only supports 720p and 1080p, with both length and width between 512px and 2160px. If the above verification fails, error codes and other information will be returned. The system will verify the video content, and if there is a problem, error codes and other information will be returned |
Request Example
curl 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/identify-face' \
-H 'Authorization: Bearer ${Your AK}' \
-H 'Content-Type: application/json' \
-d '{
"video_id": "811673266024099926"
}'
Response
{
"code": 0,
"message": "SUCCEED",
"data": {
"session_id": "811680659520897082",
"face_data": [
{
"face_id": "0",
"face_image": "https://p2-kling.klingai.com/bs2/upload-ylab-stunt/3d61a7fe-6ec2-51c7-976c-a35605783479.jpg?x-kcdn-pid=112452",
"start_time": 0,
"end_time": 5300
}
]
},
"request_id": "91d74957-cdbc-4a85-b51a-c5da7d274203"
}
Lip Sync - Create Task
Request URL
https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/advanced-lip-sync
Request Method
POST
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| session_id | string | Required | None | Session ID, generated based on the lip-sync face recognition interface |
| face_choose | array | Required | None | Specify the face for lip-sync Including face ID, lip reference, etc. Temporarily only supports specifying a single person for lip-sync |
| face_choose face_id |
string | Required | None | Face ID returned by the face recognition interface |
| face_choose audio_id |
string | Optional | Empty | ID of the audio generated by the audition interface Only supports audio generated within 30 days with duration not less than 2 seconds and not more than 60 seconds Choose one between audio_id and sound_file parameters, cannot be both empty or both have values |
| face_choose sound_file |
string | Optional | Empty | Audio file Supports passing in audio Base64 encoding or audio URL (ensure accessibility) Audio files support .mp3/.wav/.m4a, file size not exceeding 5MB. Mismatched format or too large file will return error codes and other information. Only supports audio with duration not less than 2 seconds and not more than 60 seconds. Choose one between audio_id and sound_file parameters, cannot be both empty or both have values. The system will verify the audio content, and if there is a problem, error codes and other information will be returned |
| face_choose sound_start_time |
long | Required | None | Audio clipping start point Time is based on the start time of the original audio, starting at 0 minutes and 0 seconds, unit: ms Audio before the start point will be clipped, and the clipped audio must not be shorter than 2 seconds |
| face_choose sound_end_time |
long | Required | None | Audio clipping end time Based on the start time of the original audio, starting at 0 minutes and 0 seconds, unit: ms Audio after the end point will be clipped, the clipped audio must not be shorter than 2 seconds, and the end time must not be later than the total duration of the original audio |
| face_choose sound_insert_time |
long | Required | None | Insertion time of the clipped audio is based on the start time of the video, with the video start time being 0 minutes and 0 seconds, unit: ms The time range for inserting the audio must overlap with the lip-syncable time interval of the face by at least 2 seconds, the start time of inserting the audio must not be earlier than the video start time, and the end time of inserting the audio must not be later than the video end time |
| face_choose sound_volume |
float | Optional | 1 | Audio volume; the larger the value, the louder the volume Value range: [0, 2] |
| face_choose original_audio_volume |
float | Optional | 1 | Original video volume; the larger the value, the louder the volume Value range: [0, 2] This parameter has no effect when the original video is silent |
| external_task_id | string | Optional | None | Custom task ID User-defined task ID, which will not overwrite the system-generated task ID but supports task query through this ID. Please note that uniqueness must be ensured under a single user |
| callback_url | string | Optional | None | Callback notification address for the task result. If configured, the server will actively notify when the task status changes. See "Callback Protocol" for the specific notification message schema |
Request Example
curl 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/advanced-lip-sync' \
-H 'Authorization: Bearer ${Your AK}' \
-H 'Content-Type: application/json' \
-d '{
"session_id": "811981745335054341",
"face_choose": [{
"face_id": "0",
"audio_id": "811982203088818203",
"sound_start_time": 0,
"sound_end_time": 5000,
"sound_insert_time": 0,
"sound_volume": 1,
"original_audio_volume": 1
}]
,"external_task_id": "xiaosuvideo12315"
}'
Response
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "xiaosuvideo12315",
"task_status": "submitted",
"created_at": 1761622385339,
"updated_at": 1761622385339,
"task_info": {
"external_task_id": "xiaosuvideo12315"
}
},
"request_id": "76edcdda-dfe0-496d-9e22-d52d59def11d"
}
Query Task (Single) Interface
Request URL
https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/advanced-lip-sync/{task_id}
Request Method
GET
Request Example
curl 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/kling/videos/advanced-lip-sync/xiaosuvideo12315' \
-H 'Authorization: Bearer ${Your AK}' \
-H 'Content-Type: application/json'
Response
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "xiaosuvideo12315",
"task_status": "succeed",
"created_at": 1761622385339,
"updated_at": 1761622537187,
"task_status_msg": "",
"task_info": {
"external_task_id": "xiaosuvideo12315",
"parent_video": {
"id": "811980644103909440",
"url": "https://v2-kling.kechuangai.com/bs2/upload-ylab-stunt/special-effect/output/KLingMuse_2647d5b9-1732-4001-a61a-b02cd0b4a98f/-9118050841457038821/outputxzsta.mp4?x-kcdn-pid=112452",
"duration": "5.041"
}
},
"task_result": {
"videos": [
{
"id": "811991528977109066",
"url": "https://v1-kling.kechuangai.com/bs2/upload-ylab-stunt/special-effect/output/KLingMuse_bdbb1df5-aa71-435a-9cb7-c47e06018e73/-9211525537420341420/outputeuog5.mp4?x-kcdn-pid=112452",
"duration": "4.966"
}
]
}
},
"request_id": "2f4952ad-c67a-4828-89e1-094b1d7d368f"
}