HiAPI
  • Models
  • Pricing
Search

Search HiAPI models, tools, and resources.

LoginGet Started
  • Models
  • Pricing
HiAPI

One API, All AI Models

Generate images, video, and audio with leading models through one production-ready API.

Get a free API key

AI Image API

  • All image models
  • GPT Image 2
  • Nano Banana 2
  • Seedream 5.0 Pro
  • Qwen Image 2.0 Pro
  • FLUX 1.1 Pro

AI Video API

  • All video models
  • Seedance 2.5
  • FLUX.3 Video
  • Seedance 2.0
  • Veo 3.1
  • Kling 3.0

AI Audio API

  • All audio models
  • MiniMax Music 2.6
  • MiniMax Music 1.5
  • ElevenLabs v3
  • Text to music
  • Text to speech

Product

  • Model marketplace
  • Playground
  • Pricing
  • Image API Cost Calculator
  • Free GPT Image 2 Generator
  • Free Nano Banana Image Generator
  • Outfit Preview
  • Product Photo Lab

Developers

  • Documentation
  • API Reference
  • Agent Skills
  • LLM integration index
  • Blog

Company

  • About
  • Contact support
  • Terms of Service
  • Privacy Policy

© 2026 hiapi. All rights reserved.

Open source on GitHubPython SDK on PyPI
  • Two model-accurate payloads
  • Omni: first and last frames with sound
  • Turbo: one starting frame
  • One Python task runner for both models
  • Schema differences that affect code
  • Current image-to-video prices
  • Polling, callbacks, and output storage
  • Error boundaries
  • FAQ
  • Which Kling image-to-video model should I use in Python?
  • Can Omni use a first and last frame?
  • Can Turbo generate sound or 4K output?
  • How long can a Kling image-to-video task be?
  • Why did my task fail after POST returned 200?
TutorialJul 2, 2026

Kling Image-to-Video API in Python: Omni vs Turbo Working Examples

Choose the right Kling I2V endpoint, send a tested payload, and run both variants through one Python task workflow.

hiapiUpdated Aug 10, 2026klingimage-to-videopythonapi-tutorial

Latest models

Explore models

Contents
  • Two model-accurate payloads
  • Omni: first and last frames with sound
  • Turbo: one starting frame
  • One Python task runner for both models
  • Schema differences that affect code
  • Current image-to-video prices
  • Polling, callbacks, and output storage
  • Error boundaries
  • FAQ
  • Which Kling image-to-video model should I use in Python?
  • Can Omni use a first and last frame?
  • Can Turbo generate sound or 4K output?
  • How long can a Kling image-to-video task be?
  • Why did my task fail after POST returned 200?

Generate it with HiAPI

Choose a model, enter your prompt, and see the result.

HiAPI Blog

Related articles

HiAPI

Generate it with HiAPI

This is the generic Kling AI image-to-video API Python guide for hiapi. Choose Omni or Turbo from the job requirements, keep the model-specific payload separate, and run either payload through the same create, poll, and download code.

ChooseUse it whenImage inputOutput options
kling-3.0-omni/image-to-videoYou need first/last-frame control, native sound, or 4KOne image for the first frame, or two images for first and last frames720p, 1080p, 4K; optional sound
kling-3.0-turbo/image-to-videoA single starting frame and a smaller schema fit the jobExactly one public image URL720p or 1080p; no sound field

Both are asynchronous task models: create a task with POST /v1/tasks, poll GET /v1/tasks/{taskId}, and download data.output[0].url before it expires.

Two model-accurate payloads

The outer task envelope is shared. The model and input fields are where the variants differ.

Omni: first and last frames with sound

{
  "model": "kling-3.0-omni/image-to-video",
  "input": {
    "image_urls": [
      "https://cdn.example.com/first-frame.jpg",
      "https://cdn.example.com/last-frame.jpg"
    ],
    "prompt": "The camera arcs around the subject as the light changes from dawn to noon",
    "duration": 8,
    "resolution": "1080p",
    "sound": true
  }
}

With two images, entry 0 is the first frame and entry 1 is the last frame. Use one image when you only need a starting frame.

Turbo: one starting frame

{
  "model": "kling-3.0-turbo/image-to-video",
  "input": {
    "prompt": "The subject turns toward the camera while leaves move in a light breeze",
    "image_urls": ["https://cdn.example.com/first-frame.jpg"],
    "duration": 8,
    "resolution": "1080p"
  }
}

Turbo requires a prompt and exactly one image. Its accepted duration is 3-15 seconds and its resolution is 720p or 1080p. For its strict fields and failure cases, see the Turbo schema, limits, and Python errors guide.

One Python task runner for both models

Install requests, set HIAPI_API_KEY, then keep payload selection outside the network functions:

import os
import time
from pathlib import Path

import requests

API_BASE = "https://api.hiapi.ai/v1"
HEADERS = {
    "Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}",
    "Content-Type": "application/json",
}


def create_task(model: str, model_input: dict) -> str:
    response = requests.post(
        f"{API_BASE}/tasks",
        headers=HEADERS,
        json={"model": model, "input": model_input},
        timeout=30,
    )
    response.raise_for_status()
    return response.json()["data"]["taskId"]


def wait_for_task(task_id: str, timeout_seconds: int = 900) -> dict:
    deadline = time.time() + timeout_seconds
    while time.time() < deadline:
        response = requests.get(
            f"{API_BASE}/tasks/{task_id}", headers=HEADERS, timeout=30
        )
        response.raise_for_status()
        task = response.json()["data"]
        if task["status"] == "success":
            return task
        if task["status"] == "fail":
            raise RuntimeError(task.get("error", "task failed"))
        time.sleep(8)
    raise TimeoutError(f"task {task_id} did not finish in time")


def download_output(task: dict, destination: str) -> None:
    output_url = task["output"][0]["url"]
    with requests.get(output_url, stream=True, timeout=180) as response:
        response.raise_for_status()
        with Path(destination).open("wb") as file:
            for chunk in response.iter_content(1024 * 1024):
                file.write(chunk)

Choose a payload and call the shared functions:

MODEL = "kling-3.0-omni/image-to-video"
MODEL_INPUT = {
    "image_urls": [
        "https://cdn.example.com/first-frame.jpg",
        "https://cdn.example.com/last-frame.jpg",
    ],
    "prompt": "The camera arcs around the subject as daylight grows warmer",
    "duration": 8,
    "resolution": "1080p",
    "sound": True,
}

task_id = create_task(MODEL, MODEL_INPUT)
task = wait_for_task(task_id)
download_output(task, "kling-output.mp4")

To run Turbo, replace MODEL and MODEL_INPUT with the Turbo payload above. Do not send Omni-only fields to Turbo.

Schema differences that affect code

CapabilityOmniTurbo
promptOptional but recommendedRequired
image_urlsOne or two URLsExactly one URL
durationInteger, 3-15 secondsInteger, 3-15 seconds
resolution720p, 1080p, 4K720p, 1080p
soundSupportedNot accepted

Input images must be publicly reachable by the API. A localhost URL, an authenticated page, or an expired signed URL can pass basic JSON validation and still make the asynchronous task fail when the renderer fetches it.

The source image defines framing, so do not add text-to-video fields such as aspect_ratio. Unknown fields are rejected by strict schemas.

Current image-to-video prices

Prices below are the production rates verified for these image-to-video tiers. Check the live pricing page before budgeting a large run.

Model and tierPrice per second5-second task
Omni 720p, no audio$0.100$0.50
Omni 720p, audio$0.143$0.715
Omni 1080p, no audio$0.129$0.645
Omni 1080p, audio$0.193$0.965
Omni 4K$0.479$2.395
Turbo 720p$0.130$0.65
Turbo 1080p$0.160$0.80

The word “Turbo” does not mean every tier is cheaper. Select by capabilities and the price of the exact resolution and audio mode you intend to send.

Polling, callbacks, and output storage

Polling is appropriate for a script or notebook. A production service can send a top-level callback configuration when it creates the task, then update its job record when the terminal event arrives.

Whichever completion method you use:

  1. Store the task id before retrying a worker, or a retry may create and bill a duplicate task.
  2. Treat success and fail as terminal outcomes.
  3. Download output[0].url promptly; the result includes expireAt because the pickup URL is temporary.
  4. Re-host the MP4 in storage you control instead of serving the temporary output URL to users.

Error boundaries

  • HTTP 400 means the task was not created because the JSON failed schema validation. Inspect the field named in the response.
  • HTTP 401 means the key is missing, invalid, or not permitted for the selected model.
  • A task that is created and later reaches fail passed request validation but failed during input fetching or generation. Log the task id and structured error separately from the original HTTP response.
  • An expired output URL does not mean the task failed. It means the result was not downloaded during its pickup window.

FAQ

Which Kling image-to-video model should I use in Python?

Use Omni when you need two-frame control, sound, or 4K. Use Turbo when its exact one-image, 720p/1080p schema fits the job. The create and polling code can remain shared.

Can Omni use a first and last frame?

Yes. Send two public URLs in image_urls; the first is the starting frame and the second is the ending frame.

Can Turbo generate sound or 4K output?

No. Turbo's image-to-video schema accepts 720p or 1080p and does not accept the Omni sound field.

How long can a Kling image-to-video task be?

For these endpoints, duration is an integer from 3 through 15 seconds.

Why did my task fail after POST returned 200?

The create request passed schema validation, but the renderer may have been unable to fetch the image or complete the generation. Inspect the terminal task error and confirm the image URL is public and unexpired.

Latest models

View all models
  • GPT Image 2From $0.007/image
  • Nano Banana 2From $0.051/image
  • Seedream 5.0 ProFrom $0.050/image
  • Seedance 2.5From $0.121/s

Explore models

TextImageVideoAudio
Back to blog
GPT Image 2From $0.007/image
Nano Banana 2From $0.051/image
Seedream 5.0 ProFrom $0.050/image
Seedance 2.5From $0.121/s
View all models
TextChat and reasoning
ImageGenerate and edit
VideoText and image to video
AudioSpeech and music
Start generating
View model pricing
View all articles
How to Use the flux-3 API for Text-to-Video, Audio, and Continuation

How to Use the flux-3 API for Text-to-Video, Audio, and Continuation

minimax-music-3 API: curl & Python Guide

minimax-music-3 API: curl & Python Guide

How to use grok-imagine-image-2.0/image-to-image via the hiapi API: curl, Python, and a working request

How to use grok-imagine-image-2.0/image-to-image via the hiapi API: curl, Python, and a working request

How to Use grok-imagine-image-2.0/text-to-image via the hiapi API: curl, Python, and a Working Request

How to Use grok-imagine-image-2.0/text-to-image via the hiapi API: curl, Python, and a Working Request

How to Use the qwen-image-3.0 API: curl, Python, and a Working Request

How to Use the qwen-image-3.0 API: curl, Python, and a Working Request

How to Use qwen-image-3.0-pro via the hiapi API: curl, Python, and a Working Request

How to Use qwen-image-3.0-pro via the hiapi API: curl, Python, and a Working Request

Start generating