Skip to content
Dashboard

Kling v2.5 Turbo Text-to-Video

Kling v2.5 Turbo Text-to-Video generates up to 1080p video directly from text prompts at turbo generation speed, optimized for prompt-to-video iteration and high-volume creative content pipelines. Your use is subject to Kling AI's Terms & Privacy Policies.

text-to-videoaudio-generation
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({
model: 'klingai/kling-v2.5-turbo-t2v',
prompt: 'A serene mountain lake at sunrise.'
});
Read docs

Getting started

Generate videos with Kling v2.5 Turbo Text-to-Video using the experimental_generateVideo function from AI SDK 6 or later. AI Gateway handles routing and polls until the video is ready.

Install the AI SDK (pnpm add ai dotenv), create an API key from the API Keys page, and set it as AI_GATEWAY_API_KEY in your environment. Full setup is covered in the video generation quickstart.

index.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'klingai/kling-v2.5-turbo-t2v',
prompt: 'A chicken flying into the sunset in the style of 90s anime',
providerOptions: {
klingai: {
mode: 'std',
},
},
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);

Top-level parameters

Exercise the supported top-level parameters: prompt, aspectRatio, and duration.

top-level-params.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'klingai/kling-v2.5-turbo-t2v',
prompt: 'A chicken flying into the sunset in the style of 90s anime',
aspectRatio: '16:9',
duration: 5,
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);
ParameterTypeRequiredDescription
promptstringYesText description of the video to generate. Max 2500 characters.
duration5 | 10NoVideo length in seconds. 5 or 10 seconds.
resolutionstringNoResolution ('1280x720', '1920x1080').
aspectRatiostringNoAspect ratio ('16:9', '9:16', '1:1').
generateAudiobooleanNoGenerate synchronized audio with the video.

Input limits

InputFormatsSourcesMax countMax sizeLimits
TextUp to 2500 characters

Provider options

Load the always-compatible KlingAI options under providerOptions.klingai. Feature controls like cameraControl, voiceList, and multiShot are mutually exclusive with each other and are shown in their own examples below.

provider-options.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'klingai/kling-v2.5-turbo-t2v',
prompt: 'A chicken flying into the sunset in the style of 90s anime',
aspectRatio: '16:9',
duration: 5,
generateAudio: true,
providerOptions: {
klingai: {
mode: 'pro',
negativePrompt: 'blurry, low quality',
watermarkEnabled: true,
pollIntervalMs: 5000,
pollTimeoutMs: 600000,
},
},
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);

Pass KlingAI-specific options under providerOptions.klingai in your generateVideo call.

ParameterTypeRequiredDescription
mode'std' | 'pro'No'std' for standard quality. 'pro' for professional quality. Defaults to 'std'.
negativePromptstringNoWhat to avoid in the video. Max 2500 characters.
voiceListarrayNoVoice IDs for speech. Max 2 voices. Requires generateAudio: true. Cannot coexist with elementList.
cameraControl.typestringNoCamera movement type: 'simple', 'down_back', 'forward_up', 'right_turn_forward', or 'left_turn_forward'.
cameraControl.configobjectNoMovement configuration. Required when type is 'simple'. Set one of horizontal, vertical, pan, tilt, roll, or zoom in range [-10, 10] and leave the others at 0.
watermarkEnabledbooleanNoGenerate a watermarked result alongside the video.
pollIntervalMsnumberNoHow often to check task status. Defaults to 5000.
pollTimeoutMsnumberNoMaximum wait time. Defaults to 600000 (10 minutes).

Audio and voice

Set generateAudio: true to enable audio.

Reference voices in your prompt with the <<<voice_1>>> syntax, where the number matches the order of entries in voiceList. You can use up to 2 voices per video, and voice generation requires generateAudio: true.

Camera control

Control camera movement during generation. Use a preset movement type or 'simple' with a config that sets one axis (others stay at 0).

camera-control.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'klingai/kling-v2.5-turbo-t2v',
prompt: 'A serene mountain landscape at sunset',
aspectRatio: '16:9',
providerOptions: {
klingai: {
mode: 'std',
cameraControl: {
type: 'simple',
config: {
zoom: 5,
horizontal: 0,
vertical: 0,
pan: 0,
tilt: 0,
roll: 0,
},
},
},
},
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);