UlazAI developer docs

Developer documentation

Kling 2.6 Video Generation API

Generate high-quality AI videos with Kling 2.6 - The most affordable video generation option with native audio support!

πŸ’° Best Value: Starting at just 55 credits for 5-second videos - the cheapest video generation option on UlazAI!

✨ Kling 2.6 Features

βœ… Text-to-video generation

βœ… Image-to-video animation

βœ… 5s or 10s video duration

βœ… Native audio generation

βœ… Multiple aspect ratios (16:9, 9:16, 1:1)

βœ… Fast processing (~60-90 seconds)

βœ… Lowest prices starting at 55 credits

βœ… API key authentication

POST /kling26/api/generate/

Generate Kling 2.6 Video

Create a video using Kling 2.6 - supports both text-to-video and image-to-video modes.

Request Headers

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Request Body (Text-to-Video)

{
  "prompt": "A dog running through a field of flowers at sunset",
  "generationMode": "text_to_video",
  "duration": "5",
  "aspectRatio": "16:9",
  "sound": true
}

Request Body (Image-to-Video)

{
  "prompt": "The dog starts running and playing happily",
  "generationMode": "image_to_video",
  "imageUrls": ["https://example.com/dog.jpg"],
  "duration": "5",
  "sound": false
}

Parameters

prompt * (string)

Description of the video. Max 2000 characters.

generationMode * (string)

Mode: text_to_video or image_to_video

imageUrls (array)

Required for image_to_video mode. Array with 1 image URL.

duration (string)

Video duration: "5" or "10" seconds. Default: "5"

aspectRatio (string)

For text_to_video: "16:9", "9:16", or "1:1". Default: "16:9"

sound (boolean)

Enable native audio generation. Doubles the credit cost. Default: false

prompt_directory_optin (boolean) πŸ’° -10 CREDITS

Share your video to our public Prompt Directory and get 10 credits discount! Default: true

Success Response (201)

{
  "success": true,
  "data": {
    "task_id": "uuid-here",
    "status": "processing",
    "credits_used": 55,
    "credits_remaining": 945,
    "estimated_time": "60-90 seconds",
    "message": "KLING 2.6 video generation started"
  }
}

cURL Example

curl -X POST https://ulazai.com/kling26/api/generate/ \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A dog running through a field at sunset",
    "generationMode": "text_to_video",
    "duration": "5",
    "aspectRatio": "16:9",
    "sound": false
  }'
GET /kling26/api/status/{task_id}/

Check Generation Status

Get the current status and result of a Kling 2.6 generation task.

Response States

Completed

{
  "success": true,
  "data": {
    "task_id": "uuid-here",
    "status": "completed",
    "video_url": "https://cdn.ulazai.com/kling/videos/...",
    "duration": 5,
    "has_audio": true
  }
}

Processing

{
  "success": true,
  "data": {
    "task_id": "uuid-here",
    "status": "processing",
    "progress": 45
  }
}

cURL Example

curl -X GET https://ulazai.com/kling26/api/status/UUID/ \
  -H "Authorization: Bearer YOUR_API_KEY"

πŸ’° Kling 2.6 Pricing

Without Audio

55 credits (5s)

110 credits (10s)

β€’ Silent video output

β€’ Best value option

With Audio

110 credits (5s)

220 credits (10s)

β€’ Native audio generation

β€’ Sound effects & music

πŸ’‘ Pro tip: Kling 2.6 is the cheapest video generation option - great for bulk video creation!

πŸ’» Python Example

import requests
import time

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://ulazai.com"

# Generate video
response = requests.post(
    f"{BASE_URL}/kling26/api/generate/",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "prompt": "A dog running through a field at sunset",
        "generationMode": "text_to_video",
        "duration": "5",
        "aspectRatio": "16:9",
        "sound": False
    }
)

if response.status_code == 201:
    task_id = response.json()["data"]["task_id"]
    print(f"Generation started: {task_id}")
    
    # Poll for status
    while True:
        status_response = requests.get(
            f"{BASE_URL}/kling26/api/status/{task_id}/",
            headers={"Authorization": f"Bearer {API_KEY}"}
        )
        
        status_data = status_response.json()["data"]
        
        if status_data["status"] == "completed":
            print(f"Video ready: {status_data['video_url']}")
            break
        elif status_data["status"] == "failed":
            print("Generation failed")
            break
        
        time.sleep(10)  # Check every 10 seconds
else:
    print(f"Error: {response.json()}")