Kling Universal Protocol API (Text-to-Image / Image-to-Image / Motion Control / Omni)
1. Model Description
| ability | MaaS_KeLing_3.0_turbo | MaaS_KeLing_3.0_video | MaaS_KeLing_V2.6 | MaaS_KeLing_V2.5_turbo |
|---|---|---|---|---|
| Text-to-Video | ✅ | ✅ | ✅ | ✅ |
| Image to Video | ✅ | ✅ | ✅ | ✅ |
| Motion Control | — | ✅ | ✅ | — |
| Omni Video | — |
— |
— | — |
| MaaS_KeLing_3O_video | MaaS_KeLing_O1_video | MaaS_KeLing_4.0 | MaaS_KeLing_4.0_flash | |
| Text-to-Video | — | — | ✅ | ✅ |
| Image to Video | — | — | ✅ | ✅ |
| Motion Control | — | — | — | — |
| Omni Video | ✅ | ✅ | ✅ | ✅ |
For the optional values of parameters for each interface and model differences, please refer to the corresponding parameter tables and supplementary descriptions in §3.
2. Billing
2.1 Billing Items and Usage of the Platform
| Billing Item Code | Trigger Condition | Dosage Calculation |
|---|---|---|
| balance | Quota Consumption: Old agreement: final_balance_deduction.quota > 0; New agreement: billing[0]. charge_type = cash | final_balance_deduction.quota / amount as the consumption for this task |
| credit | Consumption resource package (points): Under the old protocol, final_unit_deduction > 0; under the new protocol, billing[0]. charge_type = unit | Take final_unit_deduction / amount as the consumption for this task |
3. Details of Functional Interfaces
3.1 Text-to-Video
3.1.1 Request URL
Applicable models (endpoints): MaaS_KeLing_3.0_turbo / MaaS_KeLing_3.0_video / MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo / MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash.
3.1.2 Request Body Parameters
| Parameter Name | Field Type | Required or not | default value | Description |
|---|---|---|---|---|
| prompt | string | Yes | - | Text prompts, which can include positive descriptions and negative descriptions. Length: MaaS_KeLing_3.0_turbo / MaaS_KeLing_3.0_video must not exceed 3072 characters, and it is recommended to keep it under 2500; MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo must not exceed 2500 characters; MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash: For pure English text, the character count shall not exceed 26,000; for pure non-English text, the character count shall not exceed 11,000; for mixed text, (number of English characters / 26000) +(number of non-English characters / 11000) ≤ 1. |
| settings | object | No | - | Output configuration-related parameters, such as resolution, duration, etc. |
| settings.multi_shot | boolean | No | true | Whether to generate a multi-camera video. Only supported by MaaS_KeLing_3.0_video; when set to false, a multi-camera video cannot be generated even if a prompt in multi-camera format is used. MaaS_KeLing_3.0_turbo does not have this field, but multi-camera functionality can still be achieved via a fixed prompt format (see supplementary instructions). MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo / MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash are not supported |
| settings.audio | string | No |
off | Whether to generate a video with audio. Optional values: native, off. Only MaaS_KeLing_3.0_video / MaaS_KeLing_V2.6 support this; MaaS_KeLing_3.0_turbo / MaaS_KeLing_V2.5_turbo / MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash do not support it.MaaS_KeLing_V2.6: Only 1080P resolution is supported when generating audio videos |
| settings.resolution | string | No | 720p | The clarity of the generated video. Supported values: MaaS_KeLing_3.0_turbo / MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo support 720p and 1080p; MaaS_KeLing_3.0_video supports 720p, 1080p and 4k;For MaaS_KeLing_4.0, supported values are 720p and 1080p; the default value is 1080p; 4k is not supported; MaaS_KeLing_4.0_flash only supports 720p, with 720p as the default resolution |
| settings.aspect_ratio | string | No | 16:9 | Specify the aspect ratio (width: height) of the generated video. For MaaS_KeLing_3.0_turbo / MaaS_KeLing_3.0_video / MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo, the available options are: 16:9,9:16,1:1; MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash Optional values: 21:9,16:9,9:16,1:1; Default: 16:9 |
| settings.duration | int | No | 5 | Specify the duration of the generated video, in seconds (s). For MaaS_KeLing_3.0_turbo / MaaS_KeLing_3.0_video, the valid value range is 3 to 15; for MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo, the valid values are 5 and 10. MaaS_KeLing_4.0 Optional values: 3,4, 5,6, 7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30; default value: 10; if not provided, the duration intent can be recognized from the Prompt; MaaS_KeLing_4.0_flash Optional value: 3–20; if not passed, the duration recognized in the Prompt will be used, and the default value is 10 if no valid duration is recognized |
| options | object | No | - | General configurations, such as callback address, whether to include watermark, etc. |
| options.callback_url | string | No | - | The callback notification address for the result of this task. If configured, the server will actively notify when the task status changes. For the schema of the specific notification message, please refer to the Kling Callback Protocol. |
| options.external_task_id | string | No | - | Custom task ID. The passed-in ID will not overwrite the system-generated task ID, but task query can be performed via this ID. Note that uniqueness must be ensured under a single user. |
| options.watermark_info | object | No | - | Specifies whether to generate watermarked results simultaneously. Custom watermarking is not supported for the time being. |
| options.watermark_info.enabled | boolean | No | false | true means to generate, false means not to generate |
Supplementary Note:
Keling Video 3.0 / 3.0 Turbo models can deliver a wide range of capabilities via prompts and other inputs:
-
Multi-shot videos can be generated via a fixed format: "Shot n, m, words; Shot n, m, words;", separated by half-width symbols, where:
-
n: storyboard sequence number; supports a maximum of 6 storyboards and a minimum of 1 storyboard
-
m: duration of each storyboard panel; the duration of a single storyboard panel shall not be less than 1, and the sum of the durations of all storyboard panels shall be equal to the total duration of the currently generated video
-
words: storyboard prompt; maximum length 512
-
Prompt templating can be adopted to meet diverse video generation requirements
-
For more information, please refer to the official Kling "Kling Video 3.0 Model User Guide" of Kling.
MaaS_KeLing_4.0Text-to-generation: Not supported settings.multi_shot/ settings.audio; you can describe the usage of creatives, segmented events and audio intent via Prompt, and reference the creatives with @idin the contentsof Image-to-generation/Omni (refer to the official "KeLing 4.0 User Guide" for details).
MaaS_KeLing_4.0_flash Text-to-Video: Only plain text-to-video generation is supported. If you need to input images, videos or subjects as references, please use the image-to-video or Omni video interface. The resolution is fixed at 720p, and the duration ranges from 3 to 20 seconds.
3.1.3 Response Parameters (Creation)
| Parameter Name | Field Type | Description |
|---|---|---|
| code | int | Error code; refer to the error code for specific definitions |
| message | string | Error Message |
| request_id | string | Request ID, generated by the system, for request tracing and troubleshooting |
| data.id | string | System-generated task ID / Queried task ID |
| data.status | string | Task status, enumerated values: submitted, processing, succeeded, failed |
| data.create_time | long | Task creation time, Unix timestamp, in milliseconds |
| data.update_time | long | Task update time, Unix timestamp, in ms |
| data.external_id | string | Custom task ID of this task (if any) |
3.1.4 Request Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/kling/videos/text-to-video' \
--header 'Authorization: Bearer {YOUR_AK}' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train.",
"settings": {
"resolution": "720p",
"aspect_ratio": "9:16",
"duration": 5
},
"options": {
"callback_url": "https://your.domain/callback",
"external_task_id": "",
"watermark_info": { "enabled": false }
}
}'
3.1.5 Response Example
{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"id": "893605946402811985",
"status": "submitted",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string"
}
}
3.2 Image to Video
3.2.1 Request URL
Applicable models (endpoints): MaaS_KeLing_3.0_turbo / MaaS_KeLing_3.0_video / MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo / MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash.
3.2.2 Request Body Parameters
| Parameter Name | Field Type | Required or not | default value | Description |
|---|---|---|---|---|
| contents | array | Yes | - | Reference creatives collection, such as prompts, images, subjects, timbres, etc. Relevant fields of the same creative shall be placed in the same directory structure |
| contents[].type | string | Yes | - | Media type. Available values depend on the model: MaaS_KeLing_3.0_turbo: prompt, first_frame; MaaS_KeLing_3.0_video: prompt, first_frame, last_frame, element; MaaS_KeLing_V2.6: prompt, first_frame, last_frame, voice; MaaS_KeLing_V2.5_turbo: prompt, first_frame, last_frame; MaaS_KeLing_4.0 available values: prompt, first_frame, middle_frame, last_frame; does not support element, voice; MaaS_KeLing_4.0_flash supported values: prompt, first_frame (only supports first-frame image-to-video) |
| contents[].text | string | No | - | Text prompt when type= prompt. Length: MaaS_KeLing_3.0_video shall not exceed 3072 (recommended to be no more than 2500); MaaS_KeLing_3.0_turbo / MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo must not exceed 2500; The rules for MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash are consistent with the prompt length specification in Section 3.1.2 |
| contents[].url | string | No | - | type= first_frame / last_frame / middle_frame (MaaS_KeLing_4.0 only): reference image, supports URL or base64. Supported image formats:. jpg /. jpeg /. png; For MaaS_KeLing_3.0_turbo to MaaS_KeLing_V2.5_turbo: file size ≤50MB, width and height ≥300px, aspect ratio 1:2.5–2.5:1; MaaS_KeLing_4.0 Image: ≤30MB, width and height ≥300px, aspect ratio 2:5 to 5:2, total number of images ≤10; MaaS_KeLing_4.0_flash Image: ≤30MB, width and height ≥300px, aspect ratio ranging from 2:5 to 5:2 |
| contents[].element_id | string | No | - | Subject ID when type= element (generated by the system and returned by the subject-related query API). Only supported by MaaS_KeLing_3.0_video; a maximum of 3 subjects can be specified. MaaS_KeLing_4.0 Image Generation does not support element |
| contents[].voice_id | string | No | - | Timbre ID (custom or preset) when type= voice. Only supported by MaaS_KeLing_V2.6; up to 2 timbres can be referenced; settings.audio cannot be off when a timbre is specified; specifying a timbre is not supported when generating a silent video. MaaS_KeLing_4.0 image generation does not support voice |
| contents[].id | string | No | - | Creatives index ID, used for specification via @xxx in the prompt; this parameter must not be duplicated within the same task. Applicable to the main entity (MaaS_KeLing_3.0_video) and voice (MaaS_KeLing_V2.6) scenarios;Recommended for use in MaaS_KeLing_4.0 multi-keyframe/multi-image scenarios |
| settings | object | No | - | Output configuration-related parameters, such as resolution, duration, etc. |
| settings.multi_shot | boolean | No | true | Whether to generate a multi-camera video. Only MaaS_KeLing_3.0_video supports this feature; when set to false, multi-camera videos cannot be generated even if a multi-camera format prompt is used. MaaS_KeLing_3.0_turbo does not have this field, but multi-camera videos can still be implemented via a fixed-format Prompt (see supplementary instructions).MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo / MaaS_KeLing_4.0 is not supported (no optional values available, do not pass this field) |
| settings.audio | string | No | off | Whether to generate a video with audio. Optional values: native, off. Only MaaS_KeLing_3.0_video / MaaS_KeLing_V2.6 support this parameter; MaaS_KeLing_3.0_turbo / MaaS_KeLing_V2.5_turbo / MaaS_KeLing_4.0 do not support it (no optional values available, please do not pass this field). For MaaS_KeLing_V2.6: only 1080P is supported when generating a video with audio;Specifying a voice type is not supported when generating a silent video. |
| settings.resolution | string | No | 720p | The clarity of the generated video. Optional values: MaaS_KeLing_3.0_turbo / MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo correspond to 720p and 1080p; MaaS_KeLing_3.0_video supports 720p, 1080p, 4k; MaaS_KeLing_4.0 Optional values: 720p, 1080p; default: 1080p; MaaS_KeLing_4.0_flash only supports 720p, and the default resolution is 720p. MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo: When generating videos using the start and end frames, only 1080P video generation is supported; MaaS_KeLing_V2.6 also only supports 1080P when audio is enabled |
| settings.duration | int | No | 5 | Set the duration of the generated video, in seconds (s). Available values: for MaaS_KeLing_3.0_turbo / MaaS_KeLing_3.0_video, the duration ranges from 3 to 15; for MaaS_KeLing_V2.6 / MaaS_KeLing_V2.5_turbo, the available durations are 5 and 10; MaaS_KeLing_4.0 Optional values: 3,4, 5,6, 7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30; Default value: 10; MaaS_KeLing_4.0_flash Optional value: 3–20; if not passed, the duration recognized in the Prompt will be used, and the default value is 10 if no valid duration is recognized |
| options | object | No | - | General configurations, such as callback address, whether to include watermark, etc. |
| options.callback_url | string | No | - | The callback notification address for the result of this task. If configured, the server will actively notify when the task status changes. For the schema of the specific notification message, please refer to the Kling Callback Protocol. |
| options.external_task_id | string | No | - | Custom task ID. The passed-in ID will not overwrite the system-generated task ID, but task query can be performed via this ID. Note that uniqueness must be ensured under a single user. |
| options.watermark_info | object | No | - | Specifies whether to generate watermarked results simultaneously. Custom watermarking is not supported for the time being. |
| options.watermark_info.enabled | boolean | No | false | true means to generate, false means not to generate |
Supplementary Notes (Excerpted from Official Sources):
Frame Mode:
-
MaaS_KeLing_3.0_turbo: supports image-to-video generation with only the first frame, and does not currently support first frame + last frame or last frame only -
MaaS_KeLing_3.0_video/MaaS_KeLing_V2.6/MaaS_KeLing_V2.5_turbo: Support video generation from only the first frame image and from both the first and last frame images, do not support video generation from only the last frame image; the first frame is a required field, and the last frame is an optional field
Keling Video 3.0 / 3.0 Turbo models can deliver a wide range of capabilities via prompts and other inputs:
-
Multi-shot videos can be generated via a fixed format: "Shot n, m, words; Shot n, m, words;", separated by half-width symbols, where:
-
n: storyboard sequence number; supports a maximum of 6 storyboards and a minimum of 1 storyboard
-
m: duration of each storyboard panel; the duration of a single storyboard panel shall not be less than 1, and the sum of the durations of all storyboard panels shall be equal to the total duration of the currently generated video
-
words: storyboard prompt; maximum length 512
-
(
MaaS_KeLing_3.0_video) You can specify a specific subject in the format of@xxx, for example:@Zhang -
(
MaaS_KeLing_3.0_video) Please avoid an inclusive relationship between different subject names, e. g.:@Zhangand@ZhangSan -
(
MaaS_KeLing_3.0_video) Please avoid the subject name being identical to part of the content in the Prompt, e. g.:@gmailandMy email address is wang@gmail.com -
Prompt templating can be adopted to meet diverse video generation requirements
-
For more information, please refer to the official Kling "Kling Video 3.0 Model User Guide" of Kling.
MaaS_KeLing_V2.6: You can specify a certain timbre in the format of @xxx, for example:@sweet.
MaaS_KeLing_4.0Image to Video: Supports multiple keyframes (first frame / middle frame / last frame), with a maximum of 10 images; does not support settings.multi_shot, settings.audioand element/ voicecreatives.
MaaS_KeLing_4.0_flash Image-to-Video: Only first-frame image-to-video is supported (intermediate frames / end frames are not supported); if you need to combine reference images, reference videos or subjects, please use the Omni video interface; the resolution is fixed at 720p, and the duration ranges from 3 to 20 seconds.
3.2.3 Response Parameters
Same as §3.1.3.
3.2.4 Request Example (First Frame)
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/kling/videos/image-to-video' \
--header 'Authorization: Bearer {YOUR_AK}' \
--header 'Content-Type: application/json' \
--data '{
"contents": [
{ "type": "prompt", "text": "A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train." },
{ "type": "first_frame", "url": "https://example.com/start-frame.jpg" }
],
"settings": {
"resolution": "1080p",
"duration": 10
},
"options": {
"callback_url": "https://your.domain/callback",
"watermark_info": { "enabled": false }
}
}'
3.2.5 Response Example
Same as §3.1.5.
3.3 Motion Control
3.3.1 Request URL
Applicable models (endpoints): MaaS_KeLing_3.0_video/ MaaS_KeLing_V2.6. The new protocol follows the structure of contents + settings + options; the path is aligned with the official specification, with no /videosprefix. The existing legacy flat interface remains at.. ./kling/videos/motion-control, which can be found in historical documents.This API does not have separate settings.duration/ settings.aspect_ratio/ settings.multi_shot; the output duration is related to the reference video and valid motion extraction, and points will be deducted based on the duration of the output video.
3.3.2 Request Body Parameters
| Parameter Name | Field Type | Required or not | default value | Description |
|---|---|---|---|---|
| contents | array | Yes | - | Reference creatives collection, such as prompts, visual reference images, action reference videos, and subjects |
| contents[].type | string | Yes |
- | Creatives type. Optional values: MaaS_KeLing_3.0_videocan be prompt, image, video, element;MaaS_KeLing_V2.6can be prompt, image, video (no element) |
| contents[].text | string | No | - | type= promptrefers to the text prompt used. You can use prompts to add elements to the frame, achieve camera movement effects, etc. ; the content length must not exceed 2500 characters. |
| contents[].url | string | No | - | When type = image, it is the image reference image (supporting url or base64); when type = video, it is the action reference video ( only supporting url, not supporting base64 ) |
| contents[].element_id | string | No | - | type= element, the ID of the subject. Only MaaS_KeLing_3.0_videosupports this parameter; a maximum of 1 subject can be specified; when referencing a subject, the generated video can only temporarily refer to the character orientation in the video (character_orientationmust be set to video) |
| contents[].id | string | No | - | Creatives index ID; must not be duplicated within the same task (used for main scenarios) |
| settings | object | No | - | Output relevant configuration parameters, such as character orientation, clarity, etc. |
| settings.character_orientation | string | Yes | - | Generate the orientation of the person in the video. Optional values: image (consistent with the orientation of the person in the image; the duration of the reference video must not exceed 10 seconds at this time), video (consistent with the orientation of the person in the video; the duration of the reference video must not exceed 30 seconds). The minimum duration of the reference video is ≥ 3 seconds |
| settings.audio | string | No | original | Whether to generate a video with audio. Optional values: original (retain the original audio of the reference video), off (no audio included). Note: Motion control is not a native feature of text-to-video/image-to-video native |
| settings.resolution | string | No | 720p | The resolution of the generated video. Optional values: 720p, 1080p (MaaS_KeLing_3.0_video/ MaaS_KeLing_V2.6are the same) |
| options | object | No | - | General configurations, such as callback address, whether to include watermark, etc. |
| options.callback_url | string | No | - | The callback notification address for the result of this task. If configured, the server will actively notify when the task status changes. For the schema of the specific notification message, please refer to the Kling Callback Protocol. |
| options.external_task_id | string | No | - | Custom task ID. The passed-in ID will not overwrite the system-generated task ID, but task query can be performed via this ID. Note that uniqueness must be ensured under a single user. |
| options.watermark_info | object | No | - | Specifies whether to generate watermarked results simultaneously. Custom watermarking is not supported for the time being. |
| options.watermark_info.enabled | boolean | No | false | true means to generate, false means not to generate |
Supplementary Notes (Excerpted from Official Sources):
Content requirements for the reference image (image):
-
Try to keep the character proportions in the image consistent with those in the reference video as much as possible, and avoid generating a half-body character driven by full-body motions.
-
The subject must have their clear upper body or full body (including limbs and head) fully visible, with no obstructions.
-
Avoid extreme orientations of the person in the frame, such as handstands, lying flat, etc. ; the proportion of the person in the frame shall not be too low.
-
Supports realistic/stylized characters (including human characters, humanoid animals, some pure animals, and characters with partially humanoid limb proportions)
-
Supported image formats:. jpg /. jpeg /. png; file size must not exceed 50MB; width and height dimensions shall be no less than 300px; aspect ratio shall be within the range of 1:2.5 to 2.5:1
Content requirements for the action reference video (video):
-
The subject must have their clear upper body or full body (including all limbs and head) fully visible, with no occlusion.
-
It is recommended to upload a video of a single person performing an action; if there are 2 or more people in the video, the action of the character occupying the largest proportion of the frame will be used for generation.
-
It is recommended to use real human movements; for some stylized human/human-like limb proportions, you can adjust them via
-
The action video is shot in a single take, with the character always present in the frame; avoid shot cuts, camera movements, etc. , otherwise the footage will be clipped.
-
Avoid overly fast movements; relatively smooth movements yield better generation results.
-
If the action is highly difficult and fast-paced, there is a certain probability that the generated result will be shorter than the duration of the uploaded video; the model only extracts the duration of valid actions; generation can be completed as long as a minimum of 3 seconds of usable continuous actions is extracted;Points deduction shall be subject to the duration of the output video
-
The system will verify the video content
-
Supported video formats:. mp4 /. mov; file size must not exceed 100MB; width and height range from 340 to 3850px; duration ≥ 3s, the upper limit varies with
character_orientation(video→ 30s /image→ 10s)
3.3.3–3.3.5 Responses / Examples
The response is created in the same manner as specified in §3.1.3.
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/kling/motion-control' \
--header 'Authorization: Bearer {YOUR_AK}' \
--header 'Content-Type: application/json' \
--data '{
"contents": [
{ "type": "prompt", "text": "smooth dance motion" },
{ "type": "image", "url": "https://example.com/character.jpg" },
{ "type": "video", "url": "https://example.com/motion.mp4" }
],
"settings": {
"character_orientation": "video",
"resolution": "1080p",
"audio": "original"
},
"options": {
"callback_url": "https://your.domain/callback"
}
}'
3.4 Omni Video Generation
3.4.1 Request URL
Applicable models (endpoints): MaaS_KeLing_3O_video / MaaS_KeLing_O1_video / MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash.
3.4.2 Request Body Parameters
| Parameter Name | Field Type | Required or not | default value | Description |
|---|---|---|---|---|
| contents | array | Yes | - | Reference creatives collection, such as prompts, images, subjects, videos, timbres, etc. |
| contents[].type | string | Yes | - | Media type. MaaS_KeLing_3O_video / MaaS_KeLing_O1_video: prompt, first_frame, last_frame, refer_image, feature_video, base_video, element; MaaS_KeLing_4.0 media type available values: prompt, first_frame, middle_frame, last_frame, refer_image, feature_video, base_video, element, voice; no settings.multi_shot field; MaaS_KeLing_4.0_flash media type available values: prompt, first_frame, refer_image, feature_video, base_video, element (no middle_frame / last_frame / voice). |
| contents[].text | string | No | - | Text prompt when type= prompt. Length: MaaS_KeLing_3O_video shall not exceed 3072 (recommended to be no more than 2500); MaaS_KeLing_O1_video shall not exceed 2500;For MaaS_KeLing_4.0, the rules follow the description on prompt length in §3.1.2 |
| contents[].url | string | No | - | Image types (first_frame / last_frame / refer_image / middle_frame (MaaS_KeLing_4.0 only)) support URL or base64; for constraints on video types (feature_video / base_video), please refer to the supplementary instructions |
| contents[].element_id | string | No | - | Subject ID when type= element. MaaS_KeLing_3O_video supports video character subjects + multi-image subjects; MaaS_KeLing_O1_video only supports multi-image subjects, and does not support video character subjects;MaaS_KeLing_4.0 supports both video character subjects and multi-image subjects: up to 7 subjects (with video character subjects ≤ 3); the total number of images + videos + subjects + timbres ≤ 15 |
| contents[].voice_id | string | No | - | Timbre ID when type= voice. Only supported by MaaS_KeLing_4.0 Omni (max. 3; you must set an id in contents and reference it via @ in the Prompt);MaaS_KeLing_4.0_flash does not support voice creatives |
| contents[].id | string | No | - | Creatives index ID, used for specification via @xxx in the prompt (e. g. image @image_1, subject @Zhang, video @video_1, timbre @1); must not be duplicated within the same task |
| settings | object | No | - | Output configuration-related parameters, such as resolution, duration, etc. |
| settings.multi_shot | boolean | No | true | Whether to generate a multi-camera video. Only MaaS_KeLing_3O_video supports this feature; when set to false, multi-camera video cannot be generated even if a multi-camera format prompt is used. MaaS_KeLing_O1_video / MaaS_KeLing_4.0 do not support this (no optional values available, do not pass this field) |
| settings.audio | string | No | off | Specifies whether to generate a video with audio. Supported values: For MaaS_KeLing_3O_video, the options are native, original, and off; for MaaS_KeLing_O1_video, the options are original and off (native is not supported). When using feature_video, simultaneous audio and video output is not supported, so audio can only be set to off; when using base_video, audio cannot be set to native.MaaS_KeLing_4.0 does not have the settings.audio field (audio is described via Prompt);MaaS_KeLing_4.0_flash supports native (default) and original |
| settings.resolution | string | No | 720p | The resolution of the generated video. Optional values: for MaaS_KeLing_3O_video, the options are 720p, 1080p, 4k; for MaaS_KeLing_O1_video, the options are 720p, 1080p;for MaaS_KeLing_4.0, the optional values are 720p and 1080p; the default value is 1080p;MaaS_KeLing_4.0_flash only supports 720p, and the default value is 720p |
| settings.aspect_ratio | string | No | 16:9 | Specify the aspect ratio (width: height) of the generated video. For MaaS_KeLing_3O_video / MaaS_KeLing_O1_video, selectable values are 16:9,9:16,1:1 (required when no first frame and no reference video are provided, refer to the original specification for rules);For MaaS_KeLing_4.0 / MaaS_KeLing_4.0_flash, selectable values are 21:9,16:9,9:16,1:1, adaptive; the default value is adaptive;If no value is passed or adaptive is passed, it can be inferred from Prompt / base_video / keyframes, etc. |
| settings.duration | int | No | 5 | Video generation duration, in seconds. Supported values: for MaaS_KeLing_3O_video, the range is 3–15; for MaaS_KeLing_O1_video, the range is 3–10, and when only the first frame is provided with no other reference images/videos, only 5 or 10 are supported;For MaaS_KeLing_4.0, supported values: 3,4, 5,6, 7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30;Default is 10; when base_video is present, the duration can be inherited from it;For MaaS_KeLing_4.0_flash, the optional value ranges from 3 to 20; if not provided, the duration recognized in the Prompt will be used, and if no duration is recognized, the default value 10 will be applied |
| options | object | No | - | General configurations, such as callback address, whether to include watermark, etc. |
| options.callback_url | string | No | - | The callback notification address for the result of this task. If configured, the server will actively notify when the task status changes. For the schema of the specific notification message, please refer to the Kling Callback Protocol. |
| options.external_task_id | string | No | - | Custom task ID. The passed-in ID will not overwrite the system-generated task ID, but task query can be performed via this ID. Note that uniqueness must be ensured under a single user. |
| options.watermark_info | object | No | - | Specifies whether to generate watermarked results simultaneously. Custom watermarking is not supported for the time being. |
| options.watermark_info.enabled | boolean | No | false | true means to generate, false means not to generate |
Supplementary Notes (Excerpted from Official Sources):
Keling Video 3.0 Omni model can deliver a wide range of capabilities via prompts and other inputs:
-
Multi-shot videos can be generated via a fixed format: "Shot n, m, words; Shot n, m, words;", separated by half-width symbols, where:
-
n: storyboard sequence number; supports a maximum of 6 storyboards and a minimum of 1 storyboard
-
m: duration of each storyboard panel; the duration of a single storyboard panel shall not be less than 1, and the sum of the durations of all storyboard panels shall be equal to the total duration of the currently generated video
-
words: storyboard prompt; maximum length 512
-
You can specify an image, an entity, or a video in the format of
@xxx, for example:@image_1,@Zhang,@video_1 -
Please avoid inclusive relationships between different subject names, e. g.:
@Zhangand@ZhangSan -
Please avoid the subject name being identical to part of the content in the Prompt, for example:
@gmailand the identical segment in email-related text -
For more information, please refer to the official Omni user guide of Kling
Kling Video O1 model can deliver a wide range of capabilities via prompts and other inputs:
-
You can specify an image, an entity, or a video in the format of
@xxx, for example:@image_1,@Zhang,@video_1 -
Please avoid inclusion relationships between different entity names; please avoid entity names being identical to partial content in the Prompt.
-
O1 None Fixed multi-camera format description not available; for more details, please refer to the official Kling O1 user guide
Image (first_frame / last_frame / refer_image):
-
Format:. jpg /. jpeg /. png; File size ≤ 50MB; Width and height ≥ 300px; Aspect ratio ranging from 1:2.5 to 2.5:1; URL or base64 supported
-
First/last frame: Supports only the first frame, and first + last frame; does not support only the last frame
-
MaaS_KeLing_O1_video: When using the start and end frames, adding additional reference images is not supported; the subject function is not supported when using the start and end frames. -
Maximum number of reference images (for combination with the main subject):
-
MaaS_KeLing_3O_video: When there is no reference video and only multi-image subjects are involved, the total number of reference images plus multi-image subjects shall be ≤ 7; when there is no reference video but both video character subjects and multi-image subjects are involved, the total number shall be ≤ 4; when there is a reference video and only multi-image subjects are involved, the total number shall be ≤ 4;When a reference video is provided, video character subjects and reference images are not supported simultaneously. -
MaaS_KeLing_O1_video: When there is no reference video but multiple image subjects, the total number of reference images plus multiple image subjects shall be ≤ 7; when there is a reference video plus multiple image subjects, the total number shall be ≤ 4
Video (feature_video / base_video):
-
Format:. mp4 /. mov; File size ≤ 200MB; Maximum 1 reference video allowed
-
Duration:
MaaS_KeLing_3O_videoranges from 3 to 15.5 seconds;MaaS_KeLing_O1_videoranges from 3 to 10 seconds -
Resolution:
MaaS_KeLing_3O_videowidth and height 700–4553px, total pixel area ≤8294400, aspect ratio 0.4–2;MaaS_KeLing_O1_videowidth and height 700–2160px -
Frame rate: Input 24–60fps, output 24fps
-
feature_video: For multi-camera scenarios,multi_shotcan only be set to true; simultaneous audio and video output is not supported, andaudiocan only beoff.MaaS_KeLing_O1_videoonly supports defining the first frame of a video, and does not support the last frame. -
base_video: does not support defining the first/last frame; does not support multi-camera shots;audiocannot benative
Subject (element):
-
MaaS_KeLing_3O_video: For the first frame or the start and end frame scenarios, there are at most 3 subjects; no video + only multiple images ≤ 7; no video + only video characters ≤ 3; no video + both, video characters ≤ 3 and images + multiple images ≤ 4; with video + only multiple images ≤ 4; with video + only video characters ≤ 1;When a reference video is provided, video character subjects and multi-image subjects are not supported simultaneously -
MaaS_KeLing_O1_video: Multi-image subject only; subject not supported when using start and end frames; when no reference video is available, the number of images + subjects ≤ 7; when a reference video is available, the number ≤ 4
Keling Video 4.0 Omni (MaaS_KeLing_4.0):
Keling Video 4.0 Flash Omni (MaaS_KeLing_4.0_flash):
-
Creatives are passed in via contents, and support prompt, first_frame, refer_image, feature_video, base_video, element; in the Prompt, you can reference creatives with IDs using @video_1, @image_1 and the like
-
Images: ≤30MB, width and height ≥300px, aspect ratio 2:5 to 5:2; Videos:. mp4 /. mov, 3–30 seconds per clip
-
Audio processing: settings.audio supports native (default) / original; voice creatives and settings.multi_shot are not supported
-
With a resolution of only 720p and a duration ranging from 3 to 20 seconds; for more constraints, please refer to the official "Kling 4.0 & 4.0 Flash User Guide"
1) Not supported: settings.multi_shot, settings.audio; multi-creatives referencing, video editing, lines and timbre shall be described via Prompt + contents (including @id). For details, please refer to the official "Kling 4.0 User Guide"
2) Images (including middle_frame/ refer_image, etc.): ≤30MB, width and height ≥300px, aspect ratio 2:5 to 5:2, total number of images ≤10; when there are multiple middle_frame/ refer_image, the idfield is required
3) Video (feature_video/ base_video):. mp4 /. mov, ≤300MB, 3–30s per segment (total input video duration includes the main video subject); for rules on the number of reference videos and subject combinations, please refer to the official documentation
4) Subjects: up to 7 (video character subjects ≤ 3); voice type voiceup to 3; total of images + videos + subjects + voice types ≤ 15
3.4.3–3.4.5 Responses / Examples
The response is created in the same manner as specified in §3.1.3.
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/kling/omni-video' \
--header 'Authorization: Bearer {YOUR_AK}' \
--header 'Content-Type: application/json' \
--data '{
"contents": [
{ "type": "prompt", "text": "cinematic shot of the character walking in the rain" },
{ "type": "refer_image", "url": "https://example.com/ref.jpg", "id": "img1" }
],
"settings": {
"resolution": "1080p",
"duration": 5,
"aspect_ratio": "16:9",
"audio": "off"
},
"options": {
"callback_url": "https://your.domain/callback"
}
}'
3.5 Query Task (General Protocol)
3.5.1 Request URL
Or:
GET https://genaiapi-m2.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/kling/general/tasks?external_task_id={id}
Note: The current API only supports querying non-real-time / asynchronous tasks.
task_idandexternal_task_id: you must select exactly one of the two IDs, and cannot use both at the same time. Platform adaptation: only supports querying a single task; the usage will only be settled for this single task (takebilling[0], see §2.2).task_ids/external_task_idswill be ignored if passed in (batch query is not supported for the time being). The existing hard-coded Turbo query remainsGET. ../kling/tasks(task_ids/external_task_ids), see §3.6.
3.5.2 Request Query Parameters
| Parameter Name | Field Type | Required or not | default value | Description |
|---|---|---|---|---|
| task_id | string | No | - | The system-defined task ID (single) to be queried. Choose either this parameter or external_task_id |
| external_task_id | string | No | - | The custom task ID to be queried (single). Either this parameter or task_idis required. |
| task_ids | string | No | - | Ignore; not supported yet |
| external_task_ids | string | No | - | Ignore; not supported yet |
3.5.3 Response Parameters (Successful Task Summary)
| Parameter Name | Field Type | Description |
|---|---|---|
| code | int | Error code; refer to the error code for specific definitions |
| message | string | Error Message |
| request_id | string | Request ID, generated by the system, for request tracing and troubleshooting |
| data | array | Task List |
| data[].id | string | Queried Task ID |
| data[].status | string | Task status, enumerated values: submitted, processing, succeeded, failed |
| data[].create_time | long | Task creation time, Unix timestamp, in ms |
| data[].update_time | long | Task update time, Unix timestamp, in milliseconds |
| data[].external_id | string | Custom task ID of this task (if any) |
| data[].outputs | array | Generate Result List (on Success) |
| data[].outputs[].type | string | Content type of the generated result; enumeration values: image, video, audio, element, voice; the returned fields vary for different content types |
| data[].outputs[].url | string | URL of the generated result (Please note that for information security purposes, the generated images/videos will be cleared after 30 days, so please save them in time) |
| data[].outputs[].duration | string | Duration of the generated video, unit: seconds |
| data[].billing | array | For deduction details, see §2.1 |
| data[].billing[].amount | string | Deduction amount; in the quota consumption scenario (charge_type= cash), it represents the discounted price deducted from the quota; in the resource package consumption scenario (charge_type= unit), it represents the point deduction amount; decimal |
3.5.4 Request Example
curl --location 'https://genaiapi-m2.cloudsway.net/v1/ai/{YOUR_ENDPOINT}/kling/general/tasks?task_id=893605946402811985' \
--header 'Authorization: Bearer {YOUR_AK}'