Kling API ドキュメント
1つの API キーで Kling 4.0、Kling 4.0 Flash、Kling 3.0、Kling Video O3 をアプリに組み込むための完全ガイド。
クイックスタート
| 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 | "model": "kling-4.0", |
| 6 | "prompt": "A cinematic shot of mountains at sunrise", |
| 7 | "duration": 5, |
| 8 | "resolution": "1080p", |
| 9 | "aspect_ratio": "16:9" |
| 10 | }' |
認証
すべてのAPIリクエストには、AuthorizationヘッダーでBearerトークンを使用した認証が必要です。
APIキーの取得: ダッシュボードのAPI KeysページからAPIキーを取得できます。 → APIキーの取得
| 1 | Authorization: Bearer YOUR_API_KEY |
利用可能なモデル
Kling 4.0 新着
参照素材・被写体・音声・キーフレームを使った 3〜30 秒、720p / 1080p のシーン
指定方法 "model": "kling-4.0"
| タイプ | 説明 | 時間 | クレジット |
|---|---|---|---|
reference-to-video | テキスト、参照画像、被写体、音声(自動で選択) | 3-30s | 28.5/s (720p) · 42.5/s (1080p) |
keyframe-to-video | 最初・中間・最後のフレーム(自動で選択) | 3-30s | 28.5/s (720p) · 42.5/s (1080p) |
Kling 4.0 Flash 新着
画像から動画、参照素材、動画編集に対応した低コストの 720p クリップ
指定方法 "model": "kling-4.0-flash"
| タイプ | 説明 | 時間 | クレジット |
|---|---|---|---|
text-to-video | テキストから動画、720p | 3-20s | 24/s |
image-to-video | 最初のフレーム画像を動かす(プロンプトは任意) | 3-20s | 24/s |
reference-to-video | 画像最大 10 枚、参照動画最大 5 本 | 3-20s | 24/s · 32/s (videos) |
video-edit | プロンプトで元動画を編集、元動画の秒数で課金 | auto (3-20s) | 32/s |
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動画生成タスクを作成します。Kling 4 シリーズは model に kling-4.0 または kling-4.0-flash を指定します。Kling 3.0 と O3 は type フィールドでバックエンドが決まります。
リクエストボディ
Kling 4 シリーズのモデル:kling-4.0 または kling-4.0-flash。省略すると type フィールドで Kling 3.0 または O3 を使用します。Kling 4 の各モデルには専用のフィールドがあります。詳しくはモデルガイドをご覧ください。
Kling 3.0 / O3 のタスクタイプ(例:pro-text-to-video、o3-pro-reference-to-video)。model を指定する場合は不要です。
生成する動画のテキスト説明。最大長:Kling 3.0 は 2,000 文字、Kling 4.0 は 8,000 文字、Kling 4.0 Flash は 2,500 文字。
動画時間(秒)。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 4.0 - 参照画像
| 1 | { |
| 2 | "model": "kling-4.0", |
| 3 | "prompt": "The woman from @image_1 walks into the cafe from @image_2 and orders a coffee", |
| 4 | "image_urls": [ |
| 5 | "https://example.com/woman.jpg", |
| 6 | "https://example.com/cafe.png" |
| 7 | ], |
| 8 | "duration": 8, |
| 9 | "resolution": "1080p", |
| 10 | "aspect_ratio": "9:16" |
| 11 | } |
Kling 4.0 - キーフレーム
| 1 | { |
| 2 | "model": "kling-4.0", |
| 3 | "prompt": "Start on @first_frame and settle on @last_frame in one continuous move", |
| 4 | "first_frame_url": "https://example.com/start.jpg", |
| 5 | "last_frame_url": "https://example.com/end.jpg", |
| 6 | "duration": 6, |
| 7 | "resolution": "720p" |
| 8 | } |
Kling 4.0 Flash - 画像から動画
| 1 | { |
| 2 | "model": "kling-4.0-flash", |
| 3 | "prompt": "The product slowly rotates while soft light sweeps across it", |
| 4 | "image": "https://example.com/product.jpg", |
| 5 | "duration": 5 |
| 6 | } |
Kling 4.0 Flash - 動画編集
| 1 | { |
| 2 | "model": "kling-4.0-flash", |
| 3 | "mode": "video-edit", |
| 4 | "prompt": "Turn the daytime street into a snowy night", |
| 5 | "video": "https://example.com/street.mp4", |
| 6 | "keep_original_sound": true |
| 7 | } |
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動画生成タスクのステータスを確認します。どのモデルでも /api/generate が返した task_id を渡せば、API が適切なバックエンドに振り分けます。
クエリパラメータ
生成エンドポイントが返したタスク ID(全モデル共通)
リクエスト例
| 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 | サーバーエラーです。後でもう一度お試しください |