npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ai-sdk/klingai

v3.0.3

Published

The **Kling AI provider** for the [AI SDK](https://ai-sdk.dev/docs) contains video model support for the [Kling AI API](https://app.klingai.com/global/dev/document-api/quickStart/productIntroduction/overview).

Readme

AI SDK - Kling AI Provider

The Kling AI provider for the AI SDK contains video model support for the Kling AI API.

Setup

The Kling AI provider is available in the @ai-sdk/klingai module. You can install it with:

npm i @ai-sdk/klingai

Skill for Coding Agents

If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:

npx skills add vercel/ai

Provider Instance

You can import the default provider instance klingai from @ai-sdk/klingai:

import { klingai } from '@ai-sdk/klingai';

Video Models

This provider currently supports three video generation modes: text-to-video, image-to-video, and motion control.

Note: Not all options are supported by every model version and mode combination. See the KlingAI Capability Map for detailed compatibility.

Text-to-Video

Generate video from a text prompt.

Available models: kling-v1-t2v, kling-v1.6-t2v, kling-v2-master-t2v, kling-v2.1-master-t2v, kling-v2.5-turbo-t2v, kling-v2.6-t2v

import { klingai } from '@ai-sdk/klingai';
import { experimental_generateVideo } from 'ai';

const { videos } = await experimental_generateVideo({
  model: klingai.video('kling-v2.6-t2v'),
  prompt: 'A chicken flying into the sunset in the style of 90s anime.',
  aspectRatio: '16:9',
  duration: 5,
  providerOptions: {
    klingai: {
      mode: 'std',
    },
  },
});

Image-to-Video

Generate video from a start frame image, with optional end frame control.

Available models: kling-v1-i2v, kling-v1.5-i2v, kling-v1.6-i2v, kling-v2-master-i2v, kling-v2.1-i2v, kling-v2.1-master-i2v, kling-v2.5-turbo-i2v, kling-v2.6-i2v

import { klingai } from '@ai-sdk/klingai';
import { experimental_generateVideo } from 'ai';

const { videos } = await experimental_generateVideo({
  model: klingai.video('kling-v2.6-i2v'),
  prompt: {
    image: 'https://example.com/start-frame.png',
    text: 'The cat slowly turns its head and blinks',
  },
  duration: 5,
  providerOptions: {
    klingai: {
      // Pro mode required for start+end frame control
      mode: 'pro',
      // Optional: end frame image
      imageTail: 'https://example.com/end-frame.png',
    },
  },
});

Motion Control

Generate video using a reference motion video.

Available models: kling-v2.6-motion-control

import { klingai } from '@ai-sdk/klingai';
import { experimental_generateVideo } from 'ai';

const { videos } = await experimental_generateVideo({
  model: klingai.video('kling-v2.6-motion-control'),
  prompt: {
    image: 'https://example.com/character.png',
    text: 'The character performs a smooth dance move',
  },
  providerOptions: {
    klingai: {
      videoUrl: 'https://example.com/reference-motion.mp4',
      characterOrientation: 'image',
      mode: 'std',
    },
  },
});

Provider Options

Use providerOptions.klingai to configure video generation. Options vary by mode:

| Option | T2V | I2V | Motion Control | Description | | ---------------------- | ----------------- | ----------------- | ----------------- | ------------------------------- | | mode | 'std' / 'pro' | 'std' / 'pro' | 'std' / 'pro' | Generation quality mode | | negativePrompt | Yes | Yes | — | What to avoid (max 2500 chars) | | sound | V2.6+ pro only | V2.6+ pro only | — | 'on' / 'off' for audio | | cfgScale | Yes (V1.x) | Yes (V1.x) | — | Prompt adherence [0, 1] | | cameraControl | Yes | Yes | — | Camera movement presets | | imageTail | — | Pro mode | — | End frame image (URL or base64) | | staticMask | — | Yes | — | Static brush mask | | dynamicMasks | — | Yes | — | Dynamic brush configs | | videoUrl | — | — | Required | Reference motion video URL | | characterOrientation | — | — | Required | 'image' or 'video' | | keepOriginalSound | — | — | Yes | 'yes' / 'no' | | watermarkEnabled | — | — | Yes | Enable watermark | | pollIntervalMs | Yes | Yes | Yes | Poll interval (default: 5000ms) | | pollTimeoutMs | Yes | Yes | Yes | Max wait (default: 600000ms) |

See the KlingAI Capability Map for which features each model version supports.

Authentication

Kling AI uses access key / secret key authentication. Set the following environment variables:

KLINGAI_ACCESS_KEY=your-access-key
KLINGAI_SECRET_KEY=your-secret-key

Or pass them directly:

import { createKlingAI } from '@ai-sdk/klingai';

const klingai = createKlingAI({
  accessKey: 'your-access-key',
  secretKey: 'your-secret-key',
});

Documentation

Please check out the Kling AI API documentation for more information.