DEV Community

diwushennian4955
diwushennian4955

Posted on • Originally published at nexa-api.com

Kling 3.0 API Tutorial: Text & Image to Video with Native Audio (Python + JavaScript)

Kling 3.0 API Tutorial: Text & Image to Video with Native Audio (Python + JavaScript)

PiAPI is ranking #1 for Kling 3.0 API access. Here's why NexaAPI is the better, cheaper alternative.

What is Kling 3.0?

Kling 3.0 is Kuaishou's latest AI video model with:

  • 🎬 Multi-Shot AI Director — Cinematic camera control
  • 🎯 Enhanced Subject Consistency — Multi-image references
  • 🔊 Native Audio in 5 Languages — EN, ZH, JA, KO, ES
  • ⏱️ Up to 15 Seconds — Longer generation support

Why NexaAPI over PiAPI?

Provider Price/Video Free Tier Models
NexaAPI ~$0.01–0.05 ✅ Yes 50+
PiAPI Higher Limited Kling only

Python Tutorial

# pip install nexaapi
from nexaapi import NexaAPI

client = NexaAPI(api_key='YOUR_API_KEY')

# Text-to-Video with Kling 3.0
response = client.video.generate(
    model='kling-3.0',
    prompt='A cinematic shot of a futuristic city at sunset, dramatic lighting',
    duration=5,
    aspect_ratio='16:9',
    mode='standard'
)
print(response.video_url)

# Image-to-Video
response_img = client.video.generate(
    model='kling-3.0',
    prompt='Gentle camera pan across the scene',
    image_url='https://example.com/your-image.jpg',
    duration=5,
    aspect_ratio='16:9'
)

# With Native Audio
response_audio = client.video.generate(
    model='kling-3.0',
    prompt='Ocean waves crashing on a beach at golden hour',
    duration=5,
    native_audio=True,
    aspect_ratio='16:9'
)
Enter fullscreen mode Exit fullscreen mode

JavaScript Tutorial

// npm install nexaapi
import NexaAPI from 'nexaapi';

const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });

async function generateVideo() {
  const response = await client.video.generate({
    model: 'kling-3.0',
    prompt: 'A cinematic shot of a futuristic city at sunset',
    duration: 5,
    aspectRatio: '16:9',
    mode: 'standard'
  });
  console.log('Video URL:', response.videoUrl);
}

generateVideo();
Enter fullscreen mode Exit fullscreen mode

Get Started

Full code: https://github.com/diwushennian4955/kling-3-0-api-tutorial

Top comments (0)