MaaS_KL_v3
Competency Map
| Functional Classification | Subfunction | 3std (3\~15s) | pro (3\~15s) | 4k (3s\~15s) |
|---|---|---|---|---|
| Text-to-Video | Single-shot Video Generation | ✓ | ✓ | ✓ |
| Multi-shot Video Generation | ✓ | ✓ | ✓ | |
| Voice Control (Human Voice Control) | ✗ | ✗ | ✗ | |
| Image to Video | Single-shot video generation (first frame only) | ✓ | ✓ | ✓ |
| Multi-shot Video Generation | ✓ | ✓ | ✓ | |
| First and last frames (one continuous shot) | ✓ | ✓ | ✓ | |
| Subject Control (Video Character Subject + Multi-Image Subject) | ✓ | ✓ | ✓ | |
| Motion Control | ✓ | ✓ | ✗ | |
| Voice Control (Human Voice Control) | ✗ | ✗ | ✗ |
Request Protocol
http
Header
| Parameter Name | Type | Description |
|---|---|---|
| anthorization | string | Authentication |
Text-to-Video
Create Task
POST
https://genaiapi-m2.cloudsway.net/v1/ai/{endpoinPath}/kling/videos/text2video
Request Method
POST
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
model_name |
string | Optional | kling-v1 |
Model Name ● Enumerated Values: MaaS_KeLing_V2.1_master, MaaS_KeLing_V2.5_turbo, MaaS_KeLing_V2.6, MaaS_KeLing_3.0_video |
multi_shot |
boolean | Optional | false |
Whether to generate a multi-shot video ● When the current parameter is true, the prompt parameter is invalid ● When the current parameter is false, the shot_type parameter and the multi_prompt parameter are invalid |
shot_type |
string | Optional | Empty | Storyboard Method ● Enumerated values: customize, intelligence● When the multi_shot parameter is true and the shot_type parameter is customize, the current parameter must be filled in |
prompt |
string | Optional | Empty | Text prompt, which can include positive and negative descriptions ● Prompt templates can be used to meet different video generation needs ● Must not exceed 2500 characters. The Omni model can achieve various capabilities through Prompt with content such as subjects, images, and videos: 1. Specify a certain subject, image, or video in the format of <<<>>>, for example: <<<element_1>>>, <<<image_1>>>, <<<video_1>>>● When the multi_shot parameter is false or the shot_type parameter is intelligence, the current parameter must be filled in |
multi_prompt |
array | Optional | Empty | Each shot prompt may include positive and negative descriptions ● Define the shot number and corresponding prompt and duration through the index, prompt, and duration parameters, where: ○ Supports up to 6 shots and at least 1 shot ○ The maximum length of each shot-related content does not exceed 512 characters. ○ The duration of each shot is no greater than the total duration of the current task and no less than 1 ○ The sum of the durations of all shots equals the total duration of the current task ● Use key:value to carry, as follows: "multi_prompt":[ { "index":int, "prompt": "string", "duration": "5" }, { "index":int, "prompt": "string", "duration": "5" } ] ● When the multi_shot parameter is true and the shot_type parameter is customize, the current parameter must not be empty |
negative_prompt |
string | Optional | Empty | Negative text prompt ● It is recommended to incorporate negative prompts into positive prompts in a negative descriptive manner ● Must not exceed 2,500 characters |
sound |
string | Optional | off |
Whether to generate sound simultaneously when generating a video ● Enumerated values: on, offOnly models of version V2.6 and above support the current parameters |
mode |
string | Optional | std |
Mode for generating videos
|
aspect_ratio |
string | Optional | 16:9 |
Aspect ratio (width:height) of the generated video ● Enumerated values: 16:9, 9:16, 1:1After specifying the first and last frames, aspect_ratio does not take effect, and the ratio is consistent with that of the first frame. |
duration |
string | Optional | 5 |
Generated video duration, unit: s ● Enumerated values: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 Different model versions support different ranges of capabilities. For details, see the capabilities map above. |
watermark_info |
array | Optional | Empty | Whether to generate watermarked results simultaneously ● Defined by the enabled parameter, carried with key:value, as follows: "watermark_info": { "enabled": boolean // true for generation, false for no generation } ● Custom watermarks are not currently supported |
external_task_id |
string | Optional | None | Custom Task ID● User-defined task ID. Passing it in will not overwrite the system-generated task ID, but it supports task querying via this ID● Please note that uniqueness needs to be ensured for a single user |
Request Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/${Your Endpoint}/kling/videos/text2video' \
--header 'Authorization: Bearer ${Your AK}' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v3",
"prompt": "Epic BBC natural history documentary style, 4K ultra-high-definition quality. In the twilight of the African savannah, dust swirls as a brutal struggle for survival unfolds. A massive lion with a disheveled mane unleashes a thunderous roar, its powerful muscles rippling in the golden sunset light as it swings its claws to fend off attackers. Surrounding it are a dozen cunning, relentless spotted hyenas — snarling, eyes gleaming with greed — employing encirclement tactics as they dart, feint, and bite with fluid agility. The scene pulses with raw, untamed tension, capturing flying saliva, drifting dust, the authentic texture of animal fur, and dramatically dramatic lighting and shadow.",
"mode": "pro",
"sound": "on",
"aspect_ratio": "16:9",
"duration": "5"
}'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "868602593017598033",
"task_status": "processing",
"created_at": 1775119514814,
"updated_at": 1775119524744,
"task_status_msg": "",
"task_info": {
"parent_video": null
},
"task_result": {}
},
"request_id": "ea45fa79-c2bf-4545-922f-5647c5d5218d"
}
Query Task
Request URL
https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/kling/videos/text2video/{taskid}
Request Method
GET
Query Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/${Your Endpoint}/kling/videos/text2video/788832073707958348' \
--header 'Authorization: Bearer ${Your AK}' \
--header 'Content-Type: application/json'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "868890153925369900",
"task_status": "succeed",
"created_at": 1775188074674,
"updated_at": 1775188152228,
"task_status_msg": "",
"task_info": {
"parent_video": null
},
"task_result": {
"videos": [
{
"id": "868890154063794228",
"url": "https://v1-fdl.kechuangai.com/ksc2/ZAonwibnVSsBTR4-QxHkB_YKEZYFgoXG7A1Yc_QAHKLPUhcyhqnHwDkXz8SOypZVFWUWmkMV5vgE2_RPLamgd8hbrpSyZMvLD9HNIJgllXd_Os1Pm8FAbZC9U5Vx1oXBagSCUo74dn4qUUxeBY51PsuY9saFYEzqVbF6-Nj7JYEMmaWse-t0Y3HhguP8F94apKw3etnebmgbbPvwnfcLdQ.mp4?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAGNmVFX1dR7C1hY15zrRNFzFjI5aofE-lzF1oDvKvIqM0OhWaD0ipqFMqaI75q8h6ZGomvHttKNOSHbzyUUB783SkDz5C93U9DthHmAe5p-Mk4eO1Ho_-IpPzNHi3CpO0AmA49If-ezk1EojNt60UydPG4UAv-IhaRExr7NmggcQ8H_9hLSwdk2zK3Bl6uvHlXlKigQjXqhqgGHT_satElXetMR4TdWgIPaPZHO09C3wxoSoUWhYgsuBTfVWszBdm10UXP1IiARoGmF2lj1HtncEsVuFUSywo_hctF_p02rvkGmfCq8jigFMAE&x-kcdn-pid=112757&pkey=AAWwW6x4NpkyPyk7rDNAIf_3OgO5G5fpH2EiRAc872uEP3bKL9mQuD0FnoccREcZbsFtOnoVDKY9uwMKewzhSWEsHKlXFWU4NCVCRhypHV4zgbVqnmADqeW_tca0ihiVWs0",
"duration": "5.041",
"watermark_url": null
}
]
},
"final_unit_deduction": "6"
},
"request_id": "21ff9a73-562f-4b7e-9f9a-4e12994cc080"
}
Image to Video
Create Task
Request URL
https://genaiapi-m2.cloudsway.net/v1/ai/{endpoinPath}/kling/videos/image2video
Request Method
POST
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
model_name |
string | Optional | kling-v1 |
Model Name ● 枚举值: kling-v1, kling-v1-5, kling-v1-6, kling-v2-master, kling-v2-1-master, kling-v2-5-turbo, kling-v2-6, kling-v3 |
image |
string | Optional | Empty |
Reference Image ● Supports passing in Base64-encoded images or image URLs (ensure they are accessible) ● Image formats supported:.jpg /.jpeg /.png ● Image file size cannot exceed 10MB ● Image width and height dimensions are not less than 300px ● The aspect ratio of the image should be between 1:2.5 and 2.5:1 ● The image parameter and the image_tail parameter are mutually exclusive, and both cannot be empty at the same time ● Different model versions support different ranges of capabilities; for details, see the capabilities map above. |
image_tail |
string | Optional | Empty | Reference Image: Final Frame Image ● Supports passing in Base64-encoded images or image URLs (ensure they are accessible) ● Image formats supported:.jpg /.jpeg /.png ● Image file size cannot exceed 10MB ● Image width and height dimensions are not less than 300px ● The aspect ratio of the image should be between 1:2.5 and 2.5:1 ● The image parameter and the image_tail parameter are mutually exclusive, and both cannot be empty at the same time ● Different model versions support different ranges of capabilities; for details, see the capabilities map above. |
multi_shot |
boolean | Optional | false |
Whether to generate a multi-shot video ● When the current parameter is true, the prompt parameter is invalid ● When the current parameter is false, the shot_type parameter and the multi_prompt parameter are invalid |
shot_type |
string | Optional | Empty | Storyboard Method ● Enumerated values: customize, intelligence● When the multi_shot parameter is true and the shot_type parameter is customize, the current parameter must be filled in |
prompt |
string | Optional | Empty |
Text prompt, which can include positive and negative descriptions ● Prompt templates can be used to meet different video generation requirements ● Must not exceed 2500 characters. The Omni model can achieve various capabilities through Prompt with content such as subjects, images, and videos: 1. Specify a certain subject, image, or video in the format of <<<>>>, for example: <<<element_1>>>, <<<image_1>>>, <<<video_1>>>● Use <<<voice_id>>> to specify the voice timbre, with the sequence number corresponding to the order of the voice timbres referenced by the voice_list parameter● A single video generation task may reference at most 2 timbres. When specifying timbres, the value of the sound parameter must be on. ● The simpler the grammatical structure, the better, e.g., <man> <<<voice_id>>> says: "Hello"● When the voice_list parameter is not empty and the prompt parameter references a voice ID, the video generation task is billed based on "specified voice". ● When the multi_shot parameter is false or the shot_type parameter is intelligence, the current parameter must be filled in |
multi_prompt |
array | Optional |
Empty | Each shot prompt may include positive and negative descriptions ● Define the shot number, corresponding prompt, and duration through the index, prompt, and duration parameters, where: ○ Supports up to 6 shots and at least 1 shot ○ The maximum length of each shot-related content does not exceed 512 characters. ○ The duration of each shot is no greater than the total duration of the current task and no less than 1 ○ The sum of the durations of all shots equals the total duration of the current task ● Use key:value to carry, as follows: "multi_prompt":[ { "index":int, "prompt": "string", "duration": "5" }, { "index":int, "prompt": "string", "duration": "5" } ] ● When the multi_shot parameter is true and the shot_type parameter is customize, the current parameter must not be empty |
negative_prompt |
string | Optional | Empty | Negative text prompt ● It is recommended to incorporate negative prompts into positive prompts in a negative descriptive manner ● Must not exceed 2,500 characters |
element_list |
array | Optional | Empty | Reference Subject List ● Based on the ID configuration of the entities in the entity library, it is carried by key:value, as follows: "element_list":[ { "element_id":long }, { "element_id":long } ] ● The number of reference subjects is related to the number of reference images, and the sum of the number of reference subjects and the number of reference images shall not exceed 10. |
sound |
string | Optional | off |
Whether to generate sound simultaneously when generating a video ● Enumerated values: on, offOnly models of version V2.6 and above support the current parameters |
mode |
string | Optional | std |
Mode for generating videos
|
aspect_ratio |
string | Optional | 16:9 |
Aspect ratio (width:height) of the generated video ● Enumerated values: 16:9, 9:16, 1:1 |
duration |
string | Optional | 5 |
Generated video duration, unit: s ● Enumerated values: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 Different model versions support different ranges of capabilities. For details, see the capabilities map above. |
watermark_info |
array | Optional | Empty |
Whether to generate watermarked results simultaneously ● Defined by the enabled parameter, carried with key:value, as follows: "watermark_info": { "enabled": boolean // true for generation, false for no generation } ● Custom watermarks are not currently supported |
external_task_id |
string | Optional | None | Custom Task ID ● User-defined task ID. Passing it in will not overwrite the system-generated task ID, but it supports task query via this ID. ● Please note that uniqueness must be ensured under single-user mode |
Request Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/${Your Endpoint}/kling/videos/image2video' \
--header 'Authorization: Bearer ${Your AK}' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v2.6",
"prompt": "Hollywood blockbuster-level visual effects, 8K ultra-high resolution. In a neon-drenched, rain-soaked city nightscape, Kong and Godzilla erupt into an explosive death match. Kong roars as he hurls a massive punch, every muscle in his arm bulging with raw power, while Godzilla gapes its jaws and its dorsal fins blaze with searing atomic blue light, ready to fire. The moment of impact unleashes a staggering shockwave, shattering surrounding skyscraper windows and sending countless chunks of debris and cascading sparks flying through the air. Raindrops hitting the monsters’ skin instantly vaporize into mist. The scene is drenched in apocalyptic, earth-shattering tension and sheer destructive force.",
"image": "https://img2.baidu.com/it/u=2688005144,1651821809&fm=253&fmt=auto&app=120&f=JPEG?w=666&h=500",
"mode": "pro",
"sound": "on",
"aspect_ratio": "16:9",
"duration": "5",
"external_task_id": "external_task_id"
}'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "868890892747673686",
"task_status": "submitted",
"created_at": 1775188250826,
"updated_at": 1775188250826,
"task_info": {
"parent_video": null
}
},
"request_id": "e9eb1aff-f64a-40bf-b9a5-b9ff45adaa8e"
}
Query Task
Request URL
https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/kling/videos/image2video/{taskid}
Request Method
GET
Query Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/${Your Endpoint}/kling/videos/image2video/788872612687921228' \
--header 'Authorization: Bearer ${Your AK}' \
--header 'Content-Type: application/json'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "868890892747673686",
"task_status": "succeed",
"created_at": 1775188250826,
"updated_at": 1775188467595,
"task_status_msg": "",
"task_info": {
"parent_video": null
},
"task_result": {
"videos": [
{
"id": "868890892911263836",
"url": "https://v4-fdl.kechuangai.com/ksc2/5H8Q9rkwbJYc2hNASa3tJedZI32pLHm-wtvwWAOWVXvt-W_CvEoPdYQYy-y8Rcn019YPqfY1K69VJ1db2gmknn9rogIFtul-JsV1fAS6bSMuRhDpii2SnbwshFXZF2riJhhAoUhciWT87Xf4ZbhqehgmUmHkLOQIJJRVBWPOhjV2m-waf_If2DakIPMVUXiftr7tDbV7QJVbQHYS3GSpNw.mp4?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAE1joX4zIbPH-Cm67NtCYBec22XBXK3wJaPFIn_cCxkJjsULN77k5Oy5DWq1hZpVhhEatwts5cuQEKUosHrT-RSbWU5IlkipC0sBnjcvG3hPs8CCxGHqS2z8Q1xFCmgEQ3Hd1ebXp3WxUnxgUf3W9XnVb9wQ5-hJ6I-YwXR1cl8DHcXiAvIhghP17cxWEAyJtCch6g9zE6WRPeX3h_4dPOtWOji4Z1R9hpxBL0NawdnvhoSbgFFnrpiqTZzapT733K7iU3CIiCbrd1zxr8zitaTO1HVhGmBRZYGGvO3Zwxs9lEcZ4dM4ygFMAE&x-kcdn-pid=112757&pkey=AAXJ_qjKB4mdRvnsGFL-z-loytZSITXZvXm3x8ULgTZRHdMZBticEIOze4CgFO41M44uHnvbDPS_4qgwfKrKgGqEkIq3t0TNQgQ-hXTmLIoBgD6rh7Dajx9a2OO2OLAeShM",
"duration": "5.041",
"watermark_url": null
}
]
},
"final_unit_deduction": "6"
},
"request_id": "091dc51b-589d-4d5b-9c1a-430ab0ba4cce"
}
Image Generation
Create Task
Request URL
https://genaiapi-m2.cloudsway.net/v1/ai/{endpoinPath}/kling/images/generations
Request Method
POST
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
model_name |
string | Optional | kling-v1 |
Model Name ● Enumerated values: kling-v1, kling-v1-5, kling-v2, kling-v2-new, kling-v2-1, kling-v3 |
prompt |
string | must |
None |
Text prompt, which can include positive and negative descriptions ● Must not exceed 2,500 characters |
negative_prompt |
string |
Optional | Empty | Negative text prompt
|
image |
string |
Optional |
Empty |
Reference Image
Example: Correct Base64 encoding parameters: Invalid Base64 encoding parameter (including data: prefix):Please provide only the Base64-encoded string part so that the system can correctly process and parse your data.
|
element_list |
array | Optional | Empty | Subject Reference List
|
resolution |
string | Optional | 1k | Clarity of the generated image
|
n |
int | Optional |
1 | Number of Generated Images
|
aspect_ratio |
string | Optional | 16:9 | The aspect ratio (width:height) of the generated image
|
watermark_info |
array |
Optional | Empty |
Whether to generate watermarked results simultaneously
|
callback_url |
string | Optional | None | Callback notification address for the results of this task. If configured, the server will actively notify when the task status changes.
|
external_task_id |
string | Optional | None | Custom Task ID
|
Request Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/${Your Endpoint}/kling/images/generations' \
--header 'Authorization: Bearer ${Your AK}' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v3",
"prompt": "Generate images of the numbers 1 through 9",
"element_list": [
{
"element_id": "160"
},
{
"element_id": "161"
},
{
"element_id": "159"
}
],
"image": "xxx",
"resolution": "2k",
"n": "9",
"aspect_ratio": "3:2",
"external_task_id": "",
"callback_url": ""
}'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "868892585292099640",
"task_status": "submitted",
"created_at": 1775188654357,
"updated_at": 1775188654357,
"task_info": {
"parent_video": null
}
},
"request_id": "68329d65-ee21-4013-9aa6-f0bc2cc07744"
}
Query Task (Single)
Request URL
https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/kling/images/generations/{taskId}
Request Method
GET
Query Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/${Your Endpoint}/kling/images/generations/858114895710539873' \
--header 'Authorization: Bearer ${Your AK}' \
--header 'Content-Type: application/json'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "868892585292099640",
"task_status": "failed",
"created_at": 1775188654357,
"updated_at": 1775188656386,
"task_status_msg": "Image format is invalid",
"task_info": {
"parent_video": null
},
"task_result": {
"images": null,
"result_type": null,
"series_images": null
},
"final_unit_deduction": "0"
},
"request_id": "a699ea31-8369-4b80-a796-7ca574d5ddf8"
}
Text-to-Sound Effect
Create a text-to-sound effect task
Request URL
POST v1/ai/{endpointPath}/kling/audio/text-to-audio
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| prompt | string | Required | None | Text prompt • Content length does not exceed 200 characters |
| duration | float | Required | None | Duration of the generated audio • Value range: 3.0 seconds to 10.0 seconds, supporting one decimal place of precision |
| external_task_id | string | Optional | None | Custom Task ID • User-defined task ID. Passing it in will not overwrite the system-generated task ID, but it supports task querying via this ID. • Please note that uniqueness must be ensured for a single user. |
| callback_url | string | Optional | None | Callback notification address for the result of this task. If configured, the server will proactively notify when the task status changes. |
Request Example
curl -g 'https://genaiapi-m2.cloudsway.net/v1/ai/{{endpointPath}}/kling/audio/text-to-audio' \
-H 'Authorization: Bearer {Your AK}' \
-H 'Content-Type: application/json' \
-d '{
"prompt": "The sound of fireworks during Spring Festival celebrations.",
"duration": 3,
"external_task_id": "",
"callback_url": ""
}'
Return Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "871457979416604766",
"task_status": "submitted",
"created_at": 1775800291981,
"updated_at": 1775800291981,
"task_info": {}
},
"request_id": "828f9782-d2e1-4550-a36d-e715ae2ae037"
}
Query text-to-sound effect task
Request URL
GET v1/ai/{endpointPath}/kling/audio/text-to-audio/{id}
task_id
Text-to-audio task ID: Request path parameter, directly fill the value in the request path, choose one of the two query methods with external_task_id
external_task_id
User-defined task ID. When creating a task, fill in the external_task_id, which is an alternative query method to task_id
Request Example
curl -g 'https://genaiapi-m2.cloudsway.net/v1/ai/{{endpointPath}}/kling/audio/text-to-audio/{id}' \
-H 'Authorization: Bearer {Your AK}' \
-H 'Content-Type: application/json'
Return Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "871457647223545935",
"task_status": "succeed",
"created_at": 1775800212780,
"updated_at": 1775800228263,
"task_status_msg": "",
"task_info": {},
"task_result": {
"audios": [
{
"id": "871457647265472604",
"url": null,
"duration": null,
"url_mp3": "https://v1-fdl.kechuangai.com/ksc2/ErHLIqeozb1WHdz1Izp1XGMBtJebQoG3Cp-2dvW1aWViY8RLKpP-tk5x7W6eeTn2b9GYO9YFP-o6znENuMnJ_gfCTlDfVz_FxCmXqGQ_q9-dhYwdNq2aZ8d7OHlPbYDwz0EsdeQnxcY_WktB6fbeiN5oHMdZZX8Uptz-fQGeBJWReQzcvLau7vxSQFcBf1rU1kGJZD3nRhuRJ-QT0NE0SA.mp3?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAFXEmxe-C5r1GsrJ4R_tFpMHnPrbjCJDG0KIp-dlRASzaKKVZPnTgDc4lOQw0tb7j0a6SuaZpiXsbq5v7GDhAdOjAaaMEFTIEhrKwILiBTZGoMM-l7cRD7Ak1Ijpt7KdddfiPC78jYKpRJEQVhp4DUtiyq8gzSrs6IOPskVBlbkMrhYZjRCYaJlswSacwFokyXfVoigHmoCox4tWOKtHuxwm5f_cNbqIxHkA6_Z19xqBhoSj4dfrTYhUzYe6jlYP2ZR__D3IiDmgbsrWNwPG28XCgRF7KfT3EKY6rUhktnmmeKY_OffqCgFMAE&x-kcdn-pid=112757&pkey=AAXEF3UtKZpRO5SOnZyIm1g87c3z1b0907OuSWpmsuDt4YCj95yjTniBUsV4LWeF5xlebOHfqK04MbbxPGXsyKVxpOqoVRq45ysb_TG_D6tKUSyb4zwibeQsYkSxRnmsFQw",
"url_wav": "https://v1-fdl.kechuangai.com/ksc2/ax60xYdmxPhWhrgqKcjG_R9nmqBtwZMYjs5jpC56Q5hVdN5Oae3O7d7kzmoEMhSJ-9Xv7-jrsi3v2DL0aHod0XOhTY8qoSofHRwh02DrXweWPL3JnQlUb13iVF2821muQ1O_-1-cbKUP1pg-QpQUOHvhd_FydZUe36F6bnvEW3E9AvbB95J6K0py-whjEerp2Z59LoNZAo2cHPtKS0ncHQ.wav?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAHMhoi-CYC9uUILiob74ZeXGkx3LSdWf7QCCBzpAdPiIjTaWxyhiErxhtb1mMQxCeT-YmlFsuqdVOJ73bXn5w7A6kLgO27kbl4uM5IjmZV5_dwTGhllwW_B2UXMdfwFxKIfRPu93U3-2M-Y3chNNOd0GhtUteZ9KIQn9Xc9bSpncu6HeNoMhIVm76XCDYyldt54EFfx8yLB51QV6LFCnnOtiAzbD-srIaG7HPJtH5j5tRoSqwnSbF-azU9cbKSOb8doGVG2IiAf7HRWbkMraGIU3pE62uCrWJoBkKaBwUWwUTOYw9nlhCgFMAE&x-kcdn-pid=112757&pkey=AAVm6lQUh6-ZOYrSRgFdt0zru0pJpiVxoeU820BANf98nNF4I4T8nG-q9lNdkw01UgQWYSR7L3cr6v6MVHiyN3UfBhNJJ9SFSS9f4E4z1eAlaLm8L8p3Ew6-nhILspq7oQU",
"duration_mp3": "3.056",
"duration_wav": "3.0"
}
]
},
"final_unit_deduction": "0.25"
},
"request_id": "5571ddf9-0c33-44cd-8087-300bb47688ab"
}
Speech Synthesis Interface
Request URL
POST https:// genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/kling/audio/tts
Input Parameter
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| text |
string | is | Empty |
Copywriting for synthesized audio
|
| voice_id | string | is | Empty | Timbre ID
|
| voice_language | string | is | Empty | Timbre and Language Enumerated values: zh en
|
| voice_speed |
float | Optional | 1.0 | Speech Rate
|
Request Example
curl --location --request POST 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/kling/audio/tts' \
--header 'Authorization: Bearer XXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"text": "冬日的清晨,推开窗,满目银装。一夜风雪,将天地涂抹成一幅素净的水墨。",
"voice_id": "ai_shatang",
"voice_language": "zh",
"voice_speed": 1.0
}'
Return Value Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "885634518584414243",
"task_status": "succeed",
"created_at": 1779180242308,
"updated_at": 1779180244125,
"task_result": {
"audios": [
{
"id": "885634518626357341",
"url": "https://v4-fdl.kechuangai.com/ksc2/2MeJM9GBC2sBBHooAqc-sl84JbXyvy_wBLpVY2cfVj4rJ0IXAQ_SuAGEGw_uZV7chJi63AdhvvJZgmDLsm7xqZhIAQWy4YXGa-LuANjDeIMmAqrDB6bIy4jOJXsBELbRSh7RrOrgSNAJPWBTT8UwCrS5ORLOCz9aPBe43tKmDzz4BtwWFTrpTqxIVoDBqmbGZmhu2TtQ59cuCr1s935gMA?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAE82CzOqWhJ-zM7AiSLJFdrnYQAGsAyPOzzbRXB7mp5ZbLRlv57_SkEqecRD4-jEHR8Ab49lKI9LKpLyXxgkJ_bhOycNixlQIgfnGSe7SrdRA0sfeYDxEgHhFXwfjekvHptAFy9z4CXIE710fSUEVWFzS86jH0vZcfsJ4OSr5bxQdZDA5SiRVqlAcQQUnOgg7Vl2Y3MgzdBvFQ5wbl0hxcRZqkXG-2OAsXVctqvHTMMxRoSNzwANz7xQHQ1n3QnpfpV26ryIiDJM_EdxJ2a0zvQ4L5hLrAo9OUT9w4fpgTujAsj-ZdGjCgFMAE&x-kcdn-pid=112757&pkey=AAW9qwdQ2EMam0UKLa51Zq6k8cMBLBLXKS5xtNwmGI1KSWx8mEo2BrFUablIbGuPCFUbjpuwqQCAX6yhJ04qK75b4XPlTloxxEscSThQ6QAPnYxvzcLxJlmUuDCCeNXIoL8",
"duration": "8.352",
"url_mp3": null,
"url_wav": null,
"duration_mp3": null,
"duration_wav": null
}
]
},
"final_unit_deduction": "0.05"
},
"request_id": "f371479a-76ce-4da8-adbb-33879408df3f"
}
Video-generated sound effects
Request URL
POST
https://genaiapi-m2.cloudsway.net /v1/ai/{endpointPath}/kling/audio/video-to-audio
Request Parameters
| Field | Type | Required | Default Value | Description |
|---|---|---|---|---|
| video_id | string | Optional | Empty | ID of the video generated by Keling AI Choose one of the video_url parameters to fill in, cannot be empty at the same time, and cannot have values at the same time Only videos generated within 30 days and with a length of 3.0-20.0 seconds are supported |
| video_url | string | Optional | None | Either the acquisition link of the uploaded video or the video_id parameter must be filled in; they cannot both be empty, nor can they both have values. Video formats only support MP4/MOV, with a file size ≤100M and a video length between 3.0 seconds and 20.0 seconds |
| sound_effect_prompt | string | Optional | None | Sound effect generation prompt Must not exceed 200 characters |
| bgm_prompt | string | Optional | None | Music generation prompt • Must not exceed 200 characters |
| asmr_mode | boolean | Optional | false | Whether to enable ASMR mode; this mode enhances detailed sound effects and is suitable for highly immersive content scenarios • true indicates enabled, false indicates disabled (default value) |
| external_task_id | string | Optional | None | Custom Task ID The user-defined task ID, when passed in, will not overwrite the system-generated task ID, but supports task querying via this ID. Please note that uniqueness must be ensured for a single user. |
| callback_url | string | Optional | None | Callback notification address for the result of this task. If configured, the server will proactively notify when the task status changes. |
Request Example
curl -g 'https://genaiapi-m2.cloudsway.net/v1/ai/{{endpointPath}}/kling/audio/video-to-audio' \
-H 'Authorization: Bearer {Your AK}' \
-H 'Content-Type: application/json' \
-d '{
"video_id": "",
"video_url": "https://p1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/20fps-7s.mov"
}'
Return Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "891066533651845201",
"task_status": "submitted",
"created_at": 1780475335623,
"updated_at": 1780475335623,
"task_info": {}
},
"request_id": "1a15fb7e-55d5-4671-a225-9b1255ec9eb9"
}
Query video sound effect generation task
Request URL
GET
https://genaiapi-m2.cloudsway.net /v1/ai/{endpointPath}/kling/audio/video-to-audio/{taskId或external_task_id}
task_id
Task ID for video-to-audio conversion. Fill in the value directly in the request path, and choose one of the two query methods between this and external_task_id
external_task_id
Custom task ID for video-to-audio conversion. When creating a task, you can choose either the external_task_id filled in or the task_id as the query method
Request Example
curl -g 'https://genaiapi-m2.cloudsway.net/v1/ai/{endpointPath}/kling/audio/video-to-audio/{{taskId}}' \
-H 'Authorization: Bearer {Your AK}' \
-H 'Content-Type: application/json'
Return Example
{
"code": 0,
"message": "SUCCEED",
"data": {
"task_id": "891066533651845201",
"task_status": "succeed",
"created_at": 1780475335623,
"updated_at": 1780475355352,
"task_status_msg": "",
"task_info": {},
"task_result": {
"videos": [
{
"id": "891066533727334406",
"url": "https://v4-fdl.kechuangai.com/ksc2/pIhYL3dVgRzIZjbr_mtXwSnO-mFMOYpBNRZvVQr0GObbHXhyQDhajJlnZDkqRV1alXtac_YgQx_uhH3uzJi-Rl2O3PhQRC53fiO2e6WMDXGhmi7g815ttCePgbBJr6z-RhMdYsp5wa-z2LveqRW3PlDOZvf0Qq-MNXz2t2FKFrOMK0vM_ga0eXj5aNKw1v8bDqWEwkWWBOMw1KiI52s22A.mp4?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAE9x8atRoTH5Mm8dJVTPBZLhBcw_Mha80H5f9nLqZSyyVkmt278Cch2OoGX5WnCRTxhguD962gNNRRJh6GqG95WeL62ZbH4OyVac5yt5MpZWFVvhGZ5o6nqzaKspXv1rYwUi_F5TtN8EyBuf7xjTdtXhqkwOgmepBa-RkNyOIlYbYX_WkO4oDUrQJ9iqhoDCVDkKLakqWjuHbF6HTPXL5_fo6wOKzMky-u-xHTN409ERhoSxWNjcgh9zqt_zDfpYBGATs3tIiAtyQZsAVrEbrbUcgDLmT_oKIC4RtWIWNxbGPb2F2cj7ygFMAE&x-kcdn-pid=112757&pkey=AAWuEugjCUBB1hUq-78WXlTOZGpcujQAVkYLVnQHcauNei3PUvAGL_VCp-ioa7VVyUG0jKk6_8Nsk0VbhED1q32NkhjekLVU3C6XEVEzsy8sn8ncl0gGvWpccqGXiHGnqiw",
"duration": "7.0",
"watermark_url": null
}
],
"audios": [
{
"id": "891066533727334406",
"url": null,
"duration": null,
"url_mp3": "https://v4-fdl.kechuangai.com/ksc2/PwKaNvs74inTwaGRNUdProeaqYxkIugHq5gxmpYuF6_Bq3Rf1mQXG6YFO1GWHpuux_M_Sq7eyygXymiWBdheb5RgOeIqzIjXUZp1n2vKXUmX8-_Ph8QY4EoO-4YXz-GCcnvRVuO3bfkMQRP5Sn9-wrlqb3RslzhBTR4RXz59YsudHcn9SMDt9n95pF0NvBQSMRDRD60d3FgziyO2FL00GQ.mp3?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAG0d3O0zrvQiT9L8RWEu1Muj6kvx9ZhRWtXfrK9GsRqNBMX2eHAvysY1TN-Gf5dFwZ3uTUcZhybVOpkbfjeCDsX8Jh0-xLczu5_bqqHjkLbE0Wq3x71Bg7wsD_LQULOa8H4paXWWeUQlnaHXfxZkUB1_0As-dTlO2Ay4qcuJfXs0EW0-CebKhss1hQ5_VpICcBUdDRBOwSZpQbc0WLtLKaExEUNm_4AUH0-Sag647P_-RoSMiIwzDkRLkXJDo0Gm30rVg5KIiAN9uUf-XIGCdk1R8J4MqPpc55XNjt2SAtWpGTkV-gSUSgFMAE&x-kcdn-pid=112757&pkey=AAWOvU4t_N2wGKGQnrz3Ojf_BAd8-paIRypiG16RNAmNKtLtuJfto1n4jb2O0DJtbmmYqD8AnFnHbNKbqPMQEvmv9FqQb04E2xWJ4RajKLQQ6GtG_BtFZNGbl-NQm3f0VXY",
"url_wav": "https://v4-fdl.kechuangai.com/ksc2/YoIKDuPlFzX1I-Cf6yKRsdfPqYSvtuuJyzK5zsPA9bjATb_bgqLvuVSiYA624nFvL5P791zgra7sZReQtXkKMDxrpkdSAxUzSXvaRshlICsS-bgPPL8PmsY_1Zb2C-u2-qaxtkyZxlVx9wxtPKDwtSsjCJzf8PgrpuQ69gs2qWKwdAyx0m8xSgyDVn5QIYm0SXQjBxalEgjS25gTqcbhJQ.wav?cacheKey=ChtzZWN1cml0eS5rbGluZy5tZXRhX2VuY3J5cHQSsAHyi8EXBD7LRGhnJQdr6JITxQVXu_UtDsMQlW_9wM0dngCmRBmK7WHZ7xhHfCsenk9l2DBVCNDSUmmNLI00mdJV6R4hmpVezOL4VSn4cNfA81oXGh9e4K51V2n8aJSeA34cBmp9FZqGpk9rQqSMVPYkOeMWDV_iu71__JP7McV2WIp2RujV8gH1vFZNdHFxtB39rULDv6Kzuv9QuyfHKtnQP4OEgHtRcqWh4C1wd3s1mxoS0TR4h_eyjkvDOmDeFijUb3cSIiCeTEUvJvuOmrYlWCnVkBacBuPhJJB2DczaSedIuGK0xygFMAE&x-kcdn-pid=112757&pkey=AAVg69bYbOPqLaRAif2WQE6bdN5BPIg7AlrRmVkHQhSGCXjOaMgWZXZIXvWpHMM4yTW3pJv1iDHJBKFLqANBJ8CAUxI8gn3N4y2ht52AEL1GLHkZ6hYIUrq81xQPnNBcK8Y",
"duration_mp3": "7.026",
"duration_wav": "6.96"
}
]
},
"final_unit_deduction": "0.25"
},
"request_id": "7753c14c-26d0-4e3e-a12a-9bfff2737bef"
}