Platform
Checking your session…
← All models

Input types: Text, Image, VideoOutput: Video

KlingKling 4.0 Flash

Kling 4.0 Omni — up to 30s at 720p or 1080p from text, frames, reference images, a reference or base video, and elements.

Image + Video Input1080p30 sec

Use it in code

Use it with AI

Install the SDK

The SDK targets Node 20+ and ships with TypeScript types.

npm install @picsart/ai-sdk

Authenticate

Create a client once with your API key — it's sent as a bearer token on every request.

import { createClient } from '@picsart/ai-sdk';

const ai = createClient({
  apiKey: process.env.PICSART_API_KEY, // sent as: Authorization: Bearer <key>
  apiUrl: 'https://api.picsart.com',
});

Run the model

Call the model with its parameters. This example uses the required ones.

import { createClient } from '@picsart/ai-sdk';

const ai = createClient({
  apiKey: process.env.PICSART_API_KEY,
  apiUrl: 'https://api.picsart.com',
});

const result = await ai.generate('kling-v4-omni', {
  prompt: "A serene mountain lake at golden hour, ultra detailed",
  aspectRatio: "16:9",
  duration: 5,
  resolution: "720p"
});

console.log(result.url); // video URL

Parameters

10 parameters. Required ones must be supplied; the rest fall back to their defaults. The API takes these same names over HTTP.

ParameterTypeRequiredDefaultDetails
prompt
Prompt
textyes—max 26000 chars
aspectRatioenumno16:916:9, 9:16, 1:1, 21:9, adaptive
durationrangeno53–30 (step 1)
resolutionenumno720p720p, 1080p
startFrame
First Frame
file (image)no——
endFrame
End Frame
file (image)no——
imageUrls
Reference Images
file (image[])no——
videoUrl
Reference Video
file (video)no——
referType
Reference Video Mode
enumnofeaturefeature, base
elementList
Element References
objectno—{ element_id }

Output

generate() resolves once the job completes. A video URL.

Result
{
  "items": [
    {
      "url": "https://cdn.picsart.com/…/result"
    }
  ],
  "model": "kling-v4-omni"
}