Runnable Node.js examples for the Kling API by useapi.net — generate Kling v3 / v2.x video (text-to-video, image-to-video, multi-image Omni & multi-shot, motion control, effects, extend, native audio), lip-sync avatars with TTS / custom voices, and Kolors image generation (incl. virtual try-on & upscale) — all through a simple REST API that drives your own Kling AI account, with no developer account or per-generation metering.
Each example reads a list of prompts from prompts.json, submits them through the useapi.net Kling API, polls each task until it is final, and downloads every result — preferring the clean, non-watermarked master — so you can queue a batch and come back to the winners.
| Example | What it does | Tutorial |
|---|---|---|
text-to-video/ |
Batch-generate Kling v3 / v2.x video from text prompts (with notes on adapting it to the image-to-video frames endpoint) | How to Generate AI Video with Kling v3 via the Kling API |
omni/ |
Batch-generate Kling Omni video — multi-image reference, saved Video Elements, and v3 multi-shot sequences | Multi-Reference & Multi-Shot Video with Kling Omni |
lip-sync/ |
Batch-generate talking lip-sync avatars from an image + TTS text or an audio file | Kling Lip-Sync Avatars, Motion Control & Image Generation |
motion-control/ |
Batch-transfer motion from a reference video onto a still image | Kling Lip-Sync Avatars, Motion Control & Image Generation |
image-generation/ |
Batch-generate images with Kolors (kling-v3-0 text-to-image + @image_N references) |
Kling Lip-Sync Avatars, Motion Control & Image Generation |
You need Node.js v21 or newer (no dependencies to install), a useapi.net API token, and a connected Kling account (one $15/month subscription covers every useapi.net API):
git clone https://github.com/useapi/kling-api.git
cd kling-api/text-to-video
node ./kling.mjs <API_TOKEN> <EMAIL>API_TOKEN is your useapi.net token and EMAIL is your connected Kling account email — every script looks the account up by email automatically. Edit prompts.json in each folder to queue your own prompts. Every supported parameter is documented on the POST /videos/text2video, POST /videos/omni, POST /avatars/video, POST /videos/motion-create, and POST /images/kolors endpoint pages.
- How to Generate AI Video with Kling v3 via the Kling API — text-to-video and start/end-frame image-to-video, the model lineup, and pricing
- Multi-Reference & Multi-Shot Video with Kling Omni — blend up to 7 image references, reuse saved Video Elements, and storyboard a multi-shot sequence
- Kling Lip-Sync Avatars, Motion Control & Image Generation — talking avatars with TTS, motion transfer, and Kolors images
useapi.net is an experimental REST API for AI services. The Kling API drives your own Kling AI (Kuaishou) account, so you spend your plan's credits at consumer rates instead of metered developer-API pricing. See the model matrix and pricing on the API overview.
Visit our Discord Server or Telegram Channel for any support questions and concerns.
We regularly post guides and tutorials on the YouTube Channel.