Kling 3.0 API ドキュメント
Kling 3.0およびKling Video O3 APIをアプリケーションに統合するための完全ガイド。
クイックスタート
| 1 | curl -X POST 'https://kling3api.com/api/generate' \ |
| 2 | -H 'Authorization: Bearer YOUR_API_KEY' \ |
| 3 | -H 'Content-Type: application/json' \ |
| 4 | -d '{ |
| 5 | "type": "pro-text-to-video", |
| 6 | "prompt": "A cinematic shot of mountains at sunrise", |
| 7 | "duration": 5, |
| 8 | "aspect_ratio": "16:9" |
| 9 | }' |
認証
すべてのAPIリクエストには、AuthorizationヘッダーでBearerトークンを使用した認証が必要です。
APIキーの取得: ダッシュボードのAPI KeysページからAPIキーを取得できます。 → APIキーの取得
| 1 | Authorization: Bearer YOUR_API_KEY |
利用可能なモデル
Kling 3.0
高品質4K動画生成
| タイプ | 説明 | 時間 | クレジット |
|---|---|---|---|
pro-text-to-video | Pro品質テキストから動画生成 | 3-15s | 54/s (no audio) · 80/s (with audio) |
pro-image-to-video | Pro品質画像から動画アニメーション | 3-15s | 54/s (no audio) · 80/s (with audio) |
std-text-to-video | スタンダード品質テキストから動画 | 3-15s | 40/s (no audio) · 60/s (with audio) |
std-image-to-video | スタンダード品質画像から動画 | 3-15s | 40/s (no audio) · 60/s (with audio) |
Kling Video O3
参照・動画編集機能付き次世代モデル
| タイプ | 説明 | 時間 | クレジット |
|---|---|---|---|
o3-pro-text-to-video | O3 Pro テキストから動画 | 3-15s | 48/s |
o3-pro-image-to-video | O3 Pro 画像から動画 | 3-15s | 48/s |
o3-pro-reference-to-video | O3 Pro 参照画像/動画付き | 3-15s | 72/s |
o3-pro-video-edit | O3 Pro 動画編集 | auto | 435 fixed |
o3-std-text-to-video | O3 Standard テキストから動画 | 3-15s | 36/s |
o3-std-image-to-video | O3 Standard 画像から動画 | 3-15s | 36/s |
o3-std-reference-to-video | O3 Standard 参照から動画 | 3-15s | 20/s |
o3-std-video-edit | O3 Standard 動画編集 | auto | 360 fixed |
APIエンドポイント
/api/generate新しい動画生成タスクを作成します。APIはタスクタイプに基づいて自動的に正しいバックエンドにルーティングします。
リクエストボディ
タスクタイプ(例:pro-text-to-video, o3-pro-reference-to-video)
生成する動画のテキスト説明(最大2000文字)
動画時間(秒)。Kling 3.0: 3-15。O3: 3-15。 Defaults to 5.
出力アスペクト比(16:9, 9:16, 1:1) Defaults to 16:9.
画像から動画タスクの画像URL
最終フレーム画像URL(画像から動画のみ)
参照動画または動画編集タスクの動画URL
参照画像URLの配列(O3 参照から動画、最大7)
ネイティブ音声生成を有効にする Defaults to true.
特定の要素を避けるためのネガティブプロンプト
プロンプト忠実度(0-1、Kling 3.0のみ) Defaults to 0.5.
Kling 3.0 - テキストから動画
| 1 | { |
| 2 | "type": "pro-text-to-video", |
| 3 | "prompt": "A majestic eagle soaring through clouds at sunset", |
| 4 | "duration": 5, |
| 5 | "aspect_ratio": "16:9", |
| 6 | "sound": true |
| 7 | } |
Kling 3.0 - 画像から動画
| 1 | { |
| 2 | "type": "pro-image-to-video", |
| 3 | "prompt": "The character slowly turns and smiles", |
| 4 | "image": "https://example.com/my-image.jpg", |
| 5 | "duration": 5 |
| 6 | } |
Kling O3 - 参照から動画
| 1 | { |
| 2 | "type": "o3-pro-reference-to-video", |
| 3 | "prompt": "The character walks through a futuristic city", |
| 4 | "images": [ |
| 5 | "https://example.com/character-reference.jpg", |
| 6 | "https://example.com/style-reference.jpg" |
| 7 | ], |
| 8 | "duration": 5, |
| 9 | "aspect_ratio": "16:9" |
| 10 | } |
Kling O3 - 動画編集
| 1 | { |
| 2 | "type": "o3-pro-video-edit", |
| 3 | "prompt": "Change the background to a snowy mountain landscape", |
| 4 | "video": "https://example.com/original-video.mp4", |
| 5 | "keep_original_sound": true |
| 6 | } |
レスポンス
Task created successfully
| 1 | { |
| 2 | "code": 200, |
| 3 | "message": "success", |
| 4 | "data": { |
| 5 | "task_id": "n75abc123kling3", |
| 6 | "status": "IN_PROGRESS", |
| 7 | "consumed_credits": 400 |
| 8 | } |
| 9 | } |
/api/status動画生成タスクのステータスを確認します。task_idプレフィックスに基づいてルーティングします(Kling 3.0はn75、Kling O3はn71)。
クエリパラメータ
生成エンドポイントから返された一意のタスクID(例:Kling 3.0はn75xxx、O3はn71xxx)
リクエスト例
| 1 | curl -X GET 'https://kling3api.com/api/status?task_id=n75abc123kling3' \ |
| 2 | -H 'Authorization: Bearer YOUR_API_KEY' |
💡 Tip: ステータスAPIのresponseフィールドは動画URLの配列です。data.response[0]に直接アクセスして動画URLを取得できます。
| 1 | // Extract video URL from response |
| 2 | const videoUrl = data.response[0]; |
レスポンス
| 1 | { |
| 2 | "code": 200, |
| 3 | "message": "success", |
| 4 | "data": { |
| 5 | "task_id": "n75abc123kling3", |
| 6 | "status": "SUCCESS", |
| 7 | "consumed_credits": 400, |
| 8 | "created_at": "2026-02-05T10:30:00Z", |
| 9 | "request": { |
| 10 | "type": "pro-text-to-video", |
| 11 | "prompt": "A majestic eagle soaring through clouds at sunset", |
| 12 | "duration": 5, |
| 13 | "aspect_ratio": "16:9" |
| 14 | }, |
| 15 | "response": [ |
| 16 | "https://cdn.example.com/videos/abc123.mp4" |
| 17 | ], |
| 18 | "error_message": null, |
| 19 | "type": "pro-text-to-video" |
| 20 | } |
| 21 | } |
APIプレイグラウンド
ブラウザで直接APIをテストします。YOUR_API_KEYを実際のAPIキーに置き換えてください。
エラーコード
| Status | Code | Description |
|---|---|---|
| 400 不正なリクエスト | INVALID_PROMPT | プロンプトが無効または空です |
| 400 不正なリクエスト | INVALID_DURATION | 時間がサポート範囲外です |
| 400 不正なリクエスト | INVALID_TYPE | サポートされていないタスクタイプです |
| 400 不正なリクエスト | MISSING_IMAGE | 画像から動画タスクには画像が必要です |
| 400 不正なリクエスト | MISSING_VIDEO | 動画編集タスクには動画が必要です |
| 401 認証エラー | INVALID_API_KEY | APIキーが存在しないか無効です |
| 402 | INSUFFICIENT_CREDITS | この操作にはクレジットが不足しています |
| 429 リクエストが多すぎます | RATE_LIMITED | リクエストが多すぎます。スローダウンしてください |
| 500 サーバー内部エラー | INTERNAL_ERROR | サーバーエラーです。後でもう一度お試しください |