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

Image-to-Video

POST/api/v1/video/generation

Header Parameters

Authorization*string

Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

_action*string

Fixed value i2v

model*string

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

image*object

Image information, required when generating video from a single image, includes the imageUrl field (image URL, must be publicly accessible). The image file size must not exceed 10MB. Supported formats are .jpg/.jpeg/.png. The width and height must not be less than 300px, and the aspect ratio must be between 1:2.5 and 2.5:1.

imageUrl*string

Image Link

headtailImages*object

First and last frame image information, required when generating a video from the first and last frames (not supported by kling-v2, kling-v2-1, and kling-v2-1-master). Includes headImage.imageUrl (first frame image) and tailImage.imageUrl (last frame image).

headImage?object

First Frame Image Information

imageUrl?string

Image Link

tailImage?object

Last Frame Image Information

imageUrl?string

Image Link

characterImages*array<object>

Reference image information, required for reference-based video generation (only supported by kling-v1-6, up to 4 images). Each element contains the imageUrl field.

[]?object
imageUrl*string

Image Link

prompt*string

Prompt, maximum length 2500 characters

negativePrompt?string

Negative prompt, used to describe elements you do not want to appear in the generated image

duration?integer

Video duration, unit: s, supported values: 5, 10

resolution?string

Video resolution (only supported by kling-v1-6), supported resolutions: 360p, 540p, 720p, 1080p

aspectRatio?string

Aspect ratio (supported only by kling-v1-6 reference generation), default 16:9, supported: 16:9, 9:16, 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 (only supported by kling-v1-6), default: std, supported: std, pro

mode?string

Mode (supported by kling-v2-5-turbo and kling-v2-6) kling-v2-5-turbo defaults to std; kling-v2-6 defaults to pro, supporting: std and pro (when generating videos from first and last frames, kling-v2-5-turbo only supports pro mode).

sound?string

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

voice?string

Timbre toggle (only supported by kling-v2-6), default: off, supported values: off, on

voiceList?array<string>

Voice list (only supported by kling-v2-6), allowing up to 2 voices to be referenced per video generation task.

[]?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 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 "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "_action": "string",    "model": "string",    "image": {      "imageUrl": "string"    },    "headtailImages": {},    "characterImages": [      {        "imageUrl": "string"      }    ],    "prompt": "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"
}