Web Applications
Add AI generation to your app with a few lines of code. Webhook helpers handle async delivery.
Type-safe clients for Python, Node.js, Go, Ruby, Java, and PHP. Built-in async task polling, webhook helpers, and automatic retries.
npm install @runapi.ai/kling
npm
import { KlingClient } from "@runapi.ai/kling";
const client = new KlingClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.textToVideo.create({
"model": "kling-v3-turbo-text-to-video",
"prompt": "A paper kite flying above a quiet coastal town at sunrise",
"duration_seconds": 5,
"aspect_ratio": "16:9",
"output_resolution": "720p"
});
pip install runapi-kling
PyPI
import os
from runapi.kling import KlingClient
client = KlingClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_video.create(
model="kling-v3-turbo-text-to-video",
prompt="A paper kite flying above a quiet coastal town at sunrise",
duration_seconds=5,
aspect_ratio="16:9",
output_resolution="720p"
)
go get github.com/runapi-ai/kling-sdk/go@latest
Go modules
package main
import (
"context"
"log"
"os"
"github.com/runapi-ai/core-sdk/go/option"
kling "github.com/runapi-ai/kling-sdk/go/kling"
)
func main() {
client, err := kling.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
if err != nil {
log.Fatal(err)
}
task, err := client.TextToVideo.Create(context.Background(), kling.TextToVideoParams{
Model: kling.TextToVideoModel("kling-v3-turbo-text-to-video"),
Prompt: "A paper kite flying above a quiet coastal town at sunrise",
DurationSeconds: 5,
AspectRatio: "16:9",
OutputResolution: kling.KlingTextToVideoOutputResolution("720p"),
})
if err != nil {
log.Fatal(err)
}
_ = task
}
gem install runapi-kling
RubyGems
require "runapi/kling"
client = RunApi::Kling::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.text_to_video.create(
model: "kling-v3-turbo-text-to-video",
prompt: "A paper kite flying above a quiet coastal town at sunrise",
duration_seconds: 5,
aspect_ratio: "16:9",
output_resolution: "720p"
)
implementation("ai.runapi:runapi-kling")
Maven
import ai.runapi.kling.KlingClient;
import ai.runapi.kling.types.TextToVideoParams;
import ai.runapi.core.polling.TaskCreateResponse;
public final class Example {
public static void main(String[] args) {
KlingClient client = KlingClient.builder()
.apiKey(System.getenv("RUNAPI_API_KEY"))
.build();
TaskCreateResponse task = client.textToVideo().create(
TextToVideoParams.builder()
.model("kling-v3-turbo-text-to-video")
.prompt("A paper kite flying above a quiet coastal town at sunrise")
.durationSeconds(5)
.aspectRatio("16:9")
.outputResolution("720p")
.build()
);
}
}
composer require runapi-ai/kling
Packagist
<?php
require __DIR__ . '/vendor/autoload.php';
use RunApi\Core\ClientOptions;
use RunApi\Kling\KlingClient;
$client = new KlingClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->textToVideo->create([
"model" => "kling-v3-turbo-text-to-video",
"prompt" => "A paper kite flying above a quiet coastal town at sunrise",
"duration_seconds" => 5,
"aspect_ratio" => "16:9",
"output_resolution" => "720p"
]);
Model-specific SDKs share the same task object, auth, error handling, and pricing links.
import os
from runapi.kling import KlingClient
client = KlingClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_video.create(
model="kling-v3-turbo-text-to-video",
prompt="A paper kite flying above a quiet coastal town at sunrise",
duration_seconds=5,
aspect_ratio="16:9",
output_resolution="720p"
)
import { KlingClient } from "@runapi.ai/kling";
const client = new KlingClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.textToVideo.create({
"model": "kling-v3-turbo-text-to-video",
"prompt": "A paper kite flying above a quiet coastal town at sunrise",
"duration_seconds": 5,
"aspect_ratio": "16:9",
"output_resolution": "720p"
});
package main
import (
"context"
"log"
"os"
"github.com/runapi-ai/core-sdk/go/option"
kling "github.com/runapi-ai/kling-sdk/go/kling"
)
func main() {
client, err := kling.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
if err != nil {
log.Fatal(err)
}
task, err := client.TextToVideo.Create(context.Background(), kling.TextToVideoParams{
Model: kling.TextToVideoModel("kling-v3-turbo-text-to-video"),
Prompt: "A paper kite flying above a quiet coastal town at sunrise",
DurationSeconds: 5,
AspectRatio: "16:9",
OutputResolution: kling.KlingTextToVideoOutputResolution("720p"),
})
if err != nil {
log.Fatal(err)
}
_ = task
}
Add AI generation to your app with a few lines of code. Webhook helpers handle async delivery.
Process generation requests at scale. Built-in retries and rate limiting keep your service reliable.
Generate training data, augment datasets, or create synthetic media as part of your ML pipeline.
Drop-in replacement. Change the base URL, keep your existing code.
TypeScript and Python types for every model, endpoint, and parameter.
Native async/await and SSE streaming in all supported languages.
RunAPI maintains model-specific SDKs for Python, Node.js, PHP, Java, Ruby, and Go. PHP packages are published on Packagist and can be installed with Composer. Each package targets one model family, while the REST API remains available for Elixir, .NET, and any runtime that can send HTTPS requests.
Model-specific packages keep application dependencies small and make request fields easier to understand. A video app can install Kling or Seedance, a music app can install Suno, and a multimodal backend can add packages as new workflows ship.
The current exported contract covers 232 public model IDs and 128 request operations. That contract is generated from the RunAPI catalog and is used to keep SDK examples, CLI metadata, and API documentation aligned.
No. SDK calls use the same RunAPI API key as REST, CLI, MCP, and agent skills. Store it in RUNAPI_API_KEY or pass it through your deployment secret manager instead of hardcoding it in source code.
Yes. SDK-created tasks use the same task lifecycle as REST requests. You can poll task status from a worker, or configure callback handling so RunAPI sends your backend the terminal task payload.
Use the model catalog and pricing page before integrating a model. SDK docs link back to model pages so developers can check the current billing unit, endpoint shape, and supported model IDs without copying price values into code.
We're here to help with enterprise setup, integrations, and technical questions.