تطبيقات الويب
أضف توليد الذكاء الاصطناعي إلى تطبيقك ببضعة أسطر من التعليمات البرمجية. تتولى أدوات webhook التسليم غير المتزامن.
Claude visitors: new accounts receive $1.00 in bonus API credit within 30 days. One per person; usage credits only.
عملاء آمنون من حيث الأنواع للغات Python وNode.js وGo وRuby وJava وPHP. استطلاع مدمج لحالة المهام غير المتزامنة ومساعدات webhooks وإعادة محاولات تلقائية.
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"
]);
تشارك حزم SDK الخاصة بالنماذج كائن المهمة نفسه وآلية المصادقة ومعالجة الأخطاء وروابط الأسعار.
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"
});
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"
)
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
}
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"
)
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()
);
}
}
<?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"
]);
أضف توليد الذكاء الاصطناعي إلى تطبيقك ببضعة أسطر من التعليمات البرمجية. تتولى أدوات webhook التسليم غير المتزامن.
عالج طلبات التوليد على نطاق واسع. تحافظ عمليات إعادة المحاولة وتحديد المعدل المدمجة على موثوقية خدمتك.
ولّد بيانات التدريب أو عزز مجموعات البيانات أو أنشئ وسائط اصطناعية كجزء من مسار تعلم الآلة.
بديل مباشر. غيّر عنوان URL الأساسي واحتفظ بالكود الحالي.
أنواع TypeScript وPython لكل نموذج ونقطة نهاية ومعامل.
دعم أصلي لـ async/await والبث عبر SSE في جميع اللغات المدعومة.
تتولى RunAPI صيانة حزم SDK خاصة بالنماذج للغات Python وNode.js وPHP وJava وRuby وGo. تُنشر حزم PHP على Packagist ويمكن تثبيتها باستخدام Composer. تستهدف كل حزمة عائلة نماذج واحدة، بينما تظل واجهة REST API متاحة للغة Elixir و.NET وأي بيئة تشغيل يمكنها إرسال طلبات HTTPS.
تقلّل الحزم الخاصة بالنماذج تبعيات التطبيق وتسهّل فهم حقول الطلب. يمكن لتطبيق فيديو تثبيت Kling أو Seedance، ولتطبيق موسيقى تثبيت Suno، ويمكن لخادم خلفي متعدد الوسائط إضافة حزم عند طرح مسارات عمل جديدة.
يغطي العقد المصدّر الحالي 251 معرّف نموذج عام و132 عملية طلب. يُولّد هذا العقد من كتالوج RunAPI ويُستخدم لإبقاء أمثلة SDK وبيانات CLI الوصفية ووثائق API متوافقة.
لا. تستخدم استدعاءات SDK مفتاح RunAPI API نفسه المستخدم في REST وCLI وMCP ومهارات الوكلاء. احفظه في RUNAPI_API_KEY أو مرّره عبر مدير الأسرار الخاص ببيئة النشر بدلًا من تثبيته داخل الكود المصدري.
نعم. تستخدم المهام المنشأة عبر SDK دورة الحياة نفسها لطلبات REST. يمكنك الاستعلام عن حالة المهمة من عامل خلفية أو إعداد معالجة الاستدعاءات لكي يرسل RunAPI بيانات المهمة النهائية إلى خادمك الخلفي.
راجع كتالوج النماذج وصفحة الأسعار قبل دمج نموذج. تربط وثائق SDK بصفحات النماذج لكي يتمكن المطورون من مراجعة وحدة الفوترة الحالية وبنية نقطة النهاية ومعرّفات النماذج المدعومة دون نسخ الأسعار إلى الكود.
نساعدكم في إعدادات المؤسسات والتكاملات والأسئلة التقنية.