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

Text-to-Video

POST/api/v1/video/generation

Header Parameters

Authorization?string

Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

model*string

Model names, supported: kling-v1-6 kling-v2 kling-v2-1-master kling-v2-5-turbo kling-v2-6

_action*string

Fixed value t2v

prompt?string

Prompt, maximum length 2500 characters

negativePrompt?string

Negative Prompt

duration?integer

Video duration, in seconds, supported values: 5, 10

aspectRatio?string

Aspect ratio, default 16:9, supported: 9:16, 16:9, 1:1

cfgScale?number

Degree of freedom, default 0.5, range [0, 1]; the higher the value, the lower the model's degree of freedom and the stronger the relevance to the prompt.

motionMode?string

Generation mode (supported by kling-v1-6 and kling-v2, not supported by other models), default: std, supported values: std, pro

mode?string

Mode (only supported by kling-v2-5-turbo and kling-v2-6), default: pro, supported: pro

sound?string

Audio switch (only supported by kling-v2-6), default: off, supported values: off, on

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 Duration in Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Tokens

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 "Content-Type: application/json" \  -d '{    "model": "string",    "_action": "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"
}