3.0 Image-to-Video
/api/v1/video/generationHeader Parameters
Format: Authorization: Bearer sk-xxxxxx
Request Body
application/json
Fixed value k3_i2v
Model Name: kling-v3
Reference Image ● Supports passing Base64-encoded images or image URLs (ensure accessibility) ○ Please note that if you use the Base64 method, ensure that all image data parameters you pass are in Base64 encoding format. When submitting data, do not add any prefixes before the Base64 encoded string, such as data:image/png;base64,. The correct parameter format should be directly the Base64 encoded string. ○ Example: ○ Correct Base64 encoded parameter: iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== ○ Incorrect Base64 encoded parameter (includes data: prefix): data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== ○ Please provide only the Base64 encoded string part so that the system can correctly process and parse your data. ● Supported image formats: .jpg / .jpeg / .png ● Image file size must not exceed 10MB, image width and height must be no less than 300px, and the image aspect ratio must be between 1:2.5 and 2.5:1 ● At least one of the image and image_tail parameters must be provided; they cannot both be empty ● Different model versions and video modes have different support scopes; please refer to the capability map in the current document for details
Reference Image - Tail Frame Control ● Supports passing image Base64 encoding or image URL (ensure accessibility) ○ Please note that if you use the Base64 method, ensure that all image data parameters you pass are in Base64 encoding format. When submitting data, do not add any prefixes to the Base64 encoded string, such as data:image/png;base64,. The correct parameter format should be directly the Base64 encoded string. ○ Example: ○ Correct Base64 encoded parameter: iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== ○ Incorrect Base64 encoded parameter (includes data: prefix): data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== ○ Please provide only the Base64 encoded string part so that the system can correctly process and parse your data. ● Supported image formats: .jpg / .jpeg / .png ● Image file size must not exceed 10MB, and image width and height must not be less than 300px ● At least one of the image and image_tail parameters must be provided; they cannot both be empty ● Different model versions and video modes have different support scopes; please refer to the capability map in the current document for details
Whether to generate a multi-shot video ● When this parameter is set to true, the prompt parameter is invalid ● When this parameter is set to false, the shot_type and multi_prompt parameters are invalid
Storyboard mode ● Enum value: customize ● Required when the multi_shot parameter is true
Text prompt, which can include positive and negative descriptions ● Prompt templates can be used to meet different video generation needs The Omni model can achieve various capabilities by combining prompts with subjects, images, videos, and other content ○ Use the <<<>>> format to specify a subject, image, or video, such as: <<<element_1>>>, <<<image_1>>>, <<<video_1>>> ● The length must not exceed 2500 characters ● When the multi_shot parameter is false, the current parameter must not be empty ● Supported ranges vary across different model versions and video modes; please refer to the capability map in the current document for details
Information for each shot, such as prompts and durations. ● Define the shot index and corresponding prompt and duration via the index, prompt, and duration parameters, where: ○ Up to 6 shots and at least 1 shot are supported. ○ The maximum length of content for each shot must not exceed 512. ○ The duration of each shot must not exceed the total duration of the current task and must be no less than 1. ○ The sum of the durations of all shots must equal the total duration of the current task. ● Formatted as key:value pairs, as follows: "multi_prompt": [ { "index":int, "prompt": "string", "duration": "5" }, { "index":int, "prompt": "string", "duration": "5" } ] ● When the mult_shot parameter is true and the shot_type parameter is customize, this parameter must not be empty.
Negative text prompt ● Must not exceed 2500 characters
Reference Element List ● Configured based on the IDs of elements in the element library, represented in key:value format as follows: "element_list": [ { "element_id":long }, { "element_id":long }] ● Supports up to 3 reference elements ● Elements are categorized into video custom elements (abbreviated as video character elements) and image custom elements (abbreviated as multi-image elements), which have different applicable scopes; please note the distinction ● Support coverage varies across different model versions and video modes
List of voices referenced during video generation ● A single video generation task can reference up to 2 voices ● When the voice_list parameter is not empty and a voice ID is referenced in the prompt parameter, the video generation task is billed as "with specified voice" ● The voice_id parameter value is returned via the voice customization API, or system preset voices can be used; voice_id for the non-lip-sync API ● The element_list and voice_list parameters are mutually exclusive and cannot coexist ● Passed as key:value pairs, as follows: "voice_list": [ { "voice_id": "voice_id_1" }, { "voice_id": "voice_id_2" }] ● Support varies across different model versions and video modes
Whether to generate audio simultaneously during video generation ● Enum values: on, off ● This parameter is only supported by models V2.6 and later
Degree of freedom for video generation; the higher the value, the lower the model's degree of freedom and the stronger the relevance to the user's input prompt. ● Value range: [0, 1] ● The kling-v2.x model does not support this parameter.
Video generation mode ● Enum values: std, pro ● std: Standard mode, basic mode, cost-effective ● pro: Expert mode (high quality), high-performance mode, generates higher quality videos ● Support for different model versions and video modes varies; please refer to the capability map in the current document for details.
Generated video duration, in seconds ● Enum values: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ● Supported ranges vary by model version and video mode; see the capability map in this document for details.
Whether to generate watermarked results simultaneously ● Defined via the enabled parameter, the specific array format is as follows: "watermark_info": { "enabled": boolean // true to generate, false to not generate} ● Custom watermarks are not currently supported
Response Body
application/json
Success
TypeScript Definitions
Use the response body type in TypeScript.
Status Code
Data Object
Result Set
Usage Information
Image Count
Video Seconds
Input Token Count
Total Token Count
Output Token Count
Validity Period
Task ID
Task Status
Status Information
Request ID
curl -X POST "https://api.ygw.ai/api/v1/video/generation" \ -H "Authorization: string" \ -H "Content-Type: application/json" \ -d '{ "_action": "string", "model": "string" }'{
"code": 0,
"data": {
"urls": [
"string"
],
"usage": {
"images": 0,
"seconds": 0,
"input_tokens": 0,
"total_tokens": 0,
"output_tokens": 0
},
"expired": "string",
"task_id": "string",
"task_status": "string"
},
"message": "string",
"request_id": "string"
}