API Documentation

Kling

API documentation and implementation examples for the Kling model.

Part of the Video / Kling collection

API Endpoint

/v1/video/kling

Request Parameters

aspect_ratiostring

Aspect ratio for the generated video

Enum:[ "16:9", "1:1", "9:16" ]
durationinteger

Duration of the video in seconds.

Enum:[ 5, 10 ]
prompt(Required)string

Prompt for video generation

Code Examples

const apiKey = "YOUR_API_KEY"; fetch("https://api.stockimg.ai/v1/video/kling", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` }, body: JSON.stringify({ "aspect_ratio": "example string", "duration": 1, "prompt": "example string" }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));

Response Example

{ "video": { "content_type": "example string", "file_name": "example string", "file_size": 1, "url": "example string" } }

Response Fields

video(Required)object
content_typestring

Content type/MIME type of the video

file_namestring

Name of the video file

file_sizeinteger

Size of the video file in bytes

urlstring

URL of the generated video