典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIVideoKling

3.0 Text-to-Video

POST/api/v1/video/generation

Header Parameters

Authorization*string

Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

_action*string

Fixed value k3_t2v

model*string

Model Name: kling-v3

multi_shot?boolean

Whether to generate a multi-shot video ● When this parameter is set to true, the prompt parameter is ignored ● When this parameter is set to false, the shot_type and multi_prompt parameters are ignored

shot_type?string

Storyboard Mode ● Enum value: customize ● Required when the multi_shot parameter is true

prompt?string

Text prompt, which can include positive and negative descriptions. ● Prompts can be templated to meet various video generation requirements. The Omni model can achieve multiple capabilities by combining prompts with subjects, images, videos, and other content. ○ Use the <<<>>> format to specify a particular subject, image, or video, e.g., <<<element_1>>>, <<<image_1>>>, <<<video_1>>>. ● The length must not exceed 2,500 characters. ● When the multi_shot parameter is set to false, this parameter must not be empty. ● Supported ranges vary by model version and video mode; please refer to the capability map in this document for details.

multi_prompt?array<string>

Shot information, 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 are supported, with a minimum of 1 shot. ○ 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. ● Passed in key:value format 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.

[]?string
negative_prompt?string

Negative text prompt ● Cannot exceed 2500 characters

sound?string

Whether to generate audio simultaneously during video generation ● Enum values: on, off ● This parameter is only supported by V2.6 and later models

cfg_scale?string

Degree of freedom for video generation; the larger the value, the lower the model's degree of freedom and the stronger the correlation with the user's input prompt. ● Value range: [0, 1] ● The kling-v2.x model does not support this parameter.

mode?string

Video generation mode ● Enum values: std, pro ● std: Standard mode, basic mode, cost-effective ● pro: Expert mode, high-performance mode, generates higher-quality videos ● Support varies by model version and video mode; please refer to the capability map in the current documentation for details.

aspect_ratio?string

Aspect ratio (width:height) of the generated video ● Enum values: 16:9, 9:16, 1:1

duration?string

Duration of the generated video, 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; refer to the capability map in the current document for details.

watermark_info?array<string>

Whether to simultaneously generate watermarked results ● Defined by the enabled parameter, the specific array format is as follows: "watermark_info": { "enabled": boolean // true to generate, false not to generate} ● Custom watermarks are not currently supported.

[]?string

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

code*integer

Status Code

data*object

Data Object

urls*array<string>

Result Set

[]?string
usage*object

Usage Information

images*integer

Number of Images

seconds*integer

Video Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Token Count

output_tokens*integer

Output Token Count

expired*string

Validity Period

task_id*string

Task ID

task_status*string

Task Status

message*string

Status Information

request_id*string

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"
}