Kling-API-Dokumentation
Vollständige Anleitung, um Kling 4.0, Kling 4.0 Flash, Kling 3.0 und Kling Video O3 mit einem API-Schlüssel in deine Anwendung einzubinden.
Schnellstart
| 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 | }' |
Authentifizierung
Alle API-Anforderungen erfordern eine Authentifizierung mit einem Bearer-Token im Authorization-Header.
API-Schlüssel erhalten: Sie können Ihren API-Schlüssel von der API-Seite in Ihrem Dashboard erhalten. → API-Schlüssel erhalten
| 1 | Authorization: Bearer YOUR_API_KEY |
Verfügbare Modelle
Kling 4.0 Neu
Szenen von 3–30 s in 720p oder 1080p mit Referenzen, Subjekten, Stimmen und Keyframes
Auswahl mit "model": "kling-4.0"
| Typ | Beschreibung | Dauer | Credits |
|---|---|---|---|
reference-to-video | Text, Referenzbilder, Subjekte und Stimmen (automatisch gewählt) | 3-30s | 28.5/s (720p) · 42.5/s (1080p) |
keyframe-to-video | Erstes, mittlere und letztes Bild (automatisch gewählt) | 3-30s | 28.5/s (720p) · 42.5/s (1080p) |
Kling 4.0 Flash Neu
Günstigere 720p-Clips mit Bild-zu-Video, Referenzen und Videobearbeitung
Auswahl mit "model": "kling-4.0-flash"
| Typ | Beschreibung | Dauer | Credits |
|---|---|---|---|
text-to-video | Text zu Video, 720p | 3-20s | 24/s |
image-to-video | Animiert ein Startbild, Prompt optional | 3-20s | 24/s |
reference-to-video | Bis zu 10 Bilder und 5 Referenzvideos | 3-20s | 24/s · 32/s (videos) |
video-edit | Bearbeitet ein Quellvideo per Prompt, Abrechnung pro Sekunde des Quellvideos | auto (3-20s) | 32/s |
Kling 3.0
Hochwertige 4K-Videoerstellung
| Typ | Beschreibung | Dauer | Credits |
|---|---|---|---|
pro-text-to-video | Pro-Qualität Text-zu-Video-Erstellung | 3-15s | 54/s (no audio) · 80/s (with audio) |
pro-image-to-video | Pro-Qualität Bild-zu-Video-Animation | 3-15s | 54/s (no audio) · 80/s (with audio) |
std-text-to-video | Standard-Qualität Text-zu-Video | 3-15s | 40/s (no audio) · 60/s (with audio) |
std-image-to-video | Standard-Qualität Bild-zu-Video | 3-15s | 40/s (no audio) · 60/s (with audio) |
Kling Video O3
Nächste Generation mit Referenz & Video-Bearbeitung
| Typ | Beschreibung | Dauer | Credits |
|---|---|---|---|
o3-pro-text-to-video | O3 Pro Text-zu-Video | 3-15s | 48/s |
o3-pro-image-to-video | O3 Pro Bild-zu-Video | 3-15s | 48/s |
o3-pro-reference-to-video | O3 Pro mit Referenzbildern/Video | 3-15s | 72/s |
o3-pro-video-edit | O3 Pro Video-Bearbeitung | auto | 435 fixed |
o3-std-text-to-video | O3 Standard Text-zu-Video | 3-15s | 36/s |
o3-std-image-to-video | O3 Standard Bild-zu-Video | 3-15s | 36/s |
o3-std-reference-to-video | O3 Standard Referenz-zu-Video | 3-15s | 20/s |
o3-std-video-edit | O3 Standard Video-Bearbeitung | auto | 360 fixed |
API-Endpunkte
/api/generateErstellt einen neuen Videogenerierungs-Task. Setze model für die Kling-4-Familie auf kling-4.0 oder kling-4.0-flash; bei Kling 3.0 und O3 wählt das Feld type das Backend.
Anfragekörper
Modell der Kling-4-Familie: kling-4.0 oder kling-4.0-flash. Weglassen, um Kling 3.0 oder O3 über das Feld type zu nutzen. Jedes Kling-4-Modell hat eigene Felder; siehe die Modellanleitungen.
Task-Typ für Kling 3.0 / O3 (z. B. pro-text-to-video, o3-pro-reference-to-video). Nicht nötig, wenn model gesetzt ist.
Textbeschreibung des zu erzeugenden Videos. Maximale Länge: 2.000 Zeichen für Kling 3.0, 8.000 für Kling 4.0 und 2.500 für Kling 4.0 Flash.
Videodauer in Sekunden. Kling 3.0: 3-15. O3: 3-15. Defaults to 5.
Ausgabeseitenverhältnis (16:9, 9:16, 1:1) Defaults to 16:9.
Bild-URL für Bild-zu-Video-Aufgaben
Endframe-Bild-URL (nur Bild-zu-Video)
Video-URL für Referenz-zu-Video oder Video-Bearbeitungsaufgaben
Array von Referenz-Bild-URLs (O3 Referenz-zu-Video, max. 7)
Native Audio-Erstellung aktivieren Defaults to true.
Negativer Prompt zur Vermeidung bestimmter Elemente
Prompt-Adhärenz (0-1, nur Kling 3.0) Defaults to 0.5.
Kling 4.0 - Referenzbilder
| 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 - Keyframes
| 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 - Bild zu Video
| 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 - Videobearbeitung
| 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 - Text zu Video
| 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 - Bild zu Video
| 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 - Referenz zu Video
| 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 - Video-Bearbeitung
| 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 | } |
Antworten
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/statusPrüft den Status eines Videogenerierungs-Tasks. Übergib die task_id, die /api/generate für ein beliebiges Modell zurückgibt; die API leitet sie an das richtige Backend weiter.
Abfrageparameter
Die vom Generate-Endpunkt zurückgegebene Task-ID, für jedes Modell
Beispielanfrage
| 1 | curl -X GET 'https://kling3api.com/api/status?task_id=n75abc123kling3' \ |
| 2 | -H 'Authorization: Bearer YOUR_API_KEY' |
💡 Tip: Das Antwortfeld im Status-API ist ein Array von Video-URLs. Sie können direkt auf data.response[0] zugreifen, um die Video-URL zu erhalten.
| 1 | // Extract video URL from response |
| 2 | const videoUrl = data.response[0]; |
Antworten
| 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-Spielplatz
Testen Sie die API direkt in Ihrem Browser. Ersetzen Sie YOUR_API_KEY durch Ihren tatsächlichen API-Schlüssel.
Fehlercodes
| Status | Code | Description |
|---|---|---|
| 400 Ungültige Anfrage | INVALID_PROMPT | Der Prompt ist ungültig oder leer |
| 400 Ungültige Anfrage | INVALID_DURATION | Dauer außerhalb des unterstützten Bereichs |
| 400 Ungültige Anfrage | INVALID_TYPE | Nicht unterstützter Aufgabentyp |
| 400 Ungültige Anfrage | MISSING_IMAGE | Bild ist für Bild-zu-Video-Aufgaben erforderlich |
| 400 Ungültige Anfrage | MISSING_VIDEO | Video ist für Video-Bearbeitungsaufgaben erforderlich |
| 401 Nicht autorisiert | INVALID_API_KEY | API-Schlüssel fehlt oder ist ungültig |
| 402 | INSUFFICIENT_CREDITS | Nicht genügend Credits für diesen Vorgang |
| 429 Zu viele Anfragen | RATE_LIMITED | Zu viele Anfragen, bitte verlangsamen |
| 500 Interner Serverfehler | INTERNAL_ERROR | Serverfehler, bitte versuchen Sie es später erneut |