Claude visitors: new accounts receive $1.00 in bonus API credit within 30 days. One per person; usage credits only.

SDK

حزم SDK رسمية لكل لغة برمجة

عملاء آمنون من حيث الأنواع للغات Python وNode.js وGo وRuby وJava وPHP. استطلاع مدمج لحالة المهام غير المتزامنة ومساعدات webhooks وإعادة محاولات تلقائية.

Python · Node.js · PHP · Java · Ruby · Go · REST-compatible
INSTALL 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"
});

تشارك حزم SDK الخاصة بالنماذج كائن المهمة نفسه وآلية المصادقة ومعالجة الأخطاء وروابط الأسعار.

HOW IT WORKS

كيفية استدعاء نموذج ذكاء اصطناعي باستخدام RunAPI 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 التسليم غير المتزامن.

خدمات الواجهة الخلفية

عالج طلبات التوليد على نطاق واسع. تحافظ عمليات إعادة المحاولة وتحديد المعدل المدمجة على موثوقية خدمتك.

مسارات البيانات

ولّد بيانات التدريب أو عزز مجموعات البيانات أو أنشئ وسائط اصطناعية كجزء من مسار تعلم الآلة.

لماذا يختار المطورون حزم RunAPI SDK

OpenAI-Compatible

بديل مباشر. غيّر عنوان URL الأساسي واحتفظ بالكود الحالي.

Full Type Safety

أنواع TypeScript وPython لكل نموذج ونقطة نهاية ومعامل.

Async & Streaming

دعم أصلي لـ async/await والبث عبر SSE في جميع اللغات المدعومة.

RunAPI SDK questions

تتولى RunAPI صيانة حزم SDK خاصة بالنماذج للغات Python وNode.js وPHP وJava وRuby وGo. تُنشر حزم PHP على Packagist ويمكن تثبيتها باستخدام Composer. تستهدف كل حزمة عائلة نماذج واحدة، بينما تظل واجهة REST API متاحة للغة Elixir و.NET وأي بيئة تشغيل يمكنها إرسال طلبات HTTPS.

استكشف المزيد

هل تبنون مع فريق؟

نساعدكم في إعدادات المؤسسات والتكاملات والأسئلة التقنية.

تواصل معنا