Documentation Kling 3.0 API
Guide complet pour intégrer les APIs Kling 3.0 et Kling Video O3 dans vos applications.
Démarrage rapide
| 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 | }' |
Authentification
Toutes les requêtes API nécessitent une authentification avec un jeton Bearer dans l'en-tête Authorization.
Obtenir votre clé API: Vous pouvez obtenir votre clé API depuis la page API Keys dans votre tableau de bord. → Obtenir votre clé API
| 1 | Authorization: Bearer YOUR_API_KEY |
Modèles disponibles
Kling 3.0
Génération vidéo 4K haute qualité
| Type | Description | Durée | Crédits |
|---|---|---|---|
pro-text-to-video | Génération texte-vidéo qualité Pro | 3-15s | 54/s (no audio) · 80/s (with audio) |
pro-image-to-video | Animation image-vidéo qualité Pro | 3-15s | 54/s (no audio) · 80/s (with audio) |
std-text-to-video | Génération texte-vidéo qualité Standard | 3-15s | 40/s (no audio) · 60/s (with audio) |
std-image-to-video | Génération image-vidéo qualité Standard | 3-15s | 40/s (no audio) · 60/s (with audio) |
Kling Video O3
Nouvelle génération avec référence et édition vidéo
| Type | Description | Durée | Crédits |
|---|---|---|---|
o3-pro-text-to-video | O3 Pro texte-vidéo | 3-15s | 48/s |
o3-pro-image-to-video | O3 Pro image-vidéo | 3-15s | 48/s |
o3-pro-reference-to-video | O3 Pro avec images/vidéo de référence | 3-15s | 72/s |
o3-pro-video-edit | O3 Pro édition vidéo | auto | 435 fixed |
o3-std-text-to-video | O3 Standard texte-vidéo | 3-15s | 36/s |
o3-std-image-to-video | O3 Standard image-vidéo | 3-15s | 36/s |
o3-std-reference-to-video | O3 Standard référence-vidéo | 3-15s | 20/s |
o3-std-video-edit | O3 Standard édition vidéo | auto | 360 fixed |
Points de terminaison API
/api/generateCréer une nouvelle tâche de génération vidéo. L'API route automatiquement vers le bon backend selon le type de tâche.
Corps de la requête
Type de tâche (ex: pro-text-to-video, o3-pro-reference-to-video)
Description textuelle de la vidéo à générer (max 2000 caractères)
Durée vidéo en secondes. Kling 3.0: 3-15. O3: 3-15. Defaults to 5.
Ratio d'aspect de sortie (16:9, 9:16, 1:1) Defaults to 16:9.
URL d'image pour les tâches image-to-video
URL d'image de frame finale (image-to-video uniquement)
URL vidéo pour les tâches reference-to-video ou video-edit
Tableau d'URLs d'images de référence (O3 reference-to-video, max 7)
Activer la génération audio native Defaults to true.
Prompt négatif pour éviter certains éléments
Adhérence au prompt (0-1, Kling 3.0 uniquement) Defaults to 0.5.
Kling 3.0 - Texte vers Vidéo
| 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 - Image vers Vidéo
| 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 - Référence vers Vidéo
| 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 - Édition Vidéo
| 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 | } |
Réponses
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/statusVérifier le statut d'une tâche de génération vidéo. Routage basé sur le préfixe task_id (n75 pour Kling 3.0, n71 pour Kling O3).
Paramètres de requête
L'ID unique de tâche retourné par l'endpoint generate (ex: n75xxx pour Kling 3.0, n71xxx pour O3)
Exemple de requête
| 1 | curl -X GET 'https://kling3api.com/api/status?task_id=n75abc123kling3' \ |
| 2 | -H 'Authorization: Bearer YOUR_API_KEY' |
💡 Tip: Le champ response dans l'API de statut est un tableau d'URLs vidéo. Vous pouvez directement accéder à data.response[0] pour obtenir l'URL vidéo.
| 1 | // Extract video URL from response |
| 2 | const videoUrl = data.response[0]; |
Réponses
| 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 | } |
Bac à sable API
Testez l'API directement depuis votre navigateur. Remplacez YOUR_API_KEY par votre véritable clé API.
Codes d'erreur
| Status | Code | Description |
|---|---|---|
| 400 Mauvaise requête | INVALID_PROMPT | Le prompt est invalide ou vide |
| 400 Mauvaise requête | INVALID_DURATION | Durée hors de la plage supportée |
| 400 Mauvaise requête | INVALID_TYPE | Type de tâche non supporté |
| 400 Mauvaise requête | MISSING_IMAGE | Image requise pour les tâches image-to-video |
| 400 Mauvaise requête | MISSING_VIDEO | Vidéo requise pour les tâches video-edit |
| 401 Non autorisé | INVALID_API_KEY | Clé API manquante ou invalide |
| 402 | INSUFFICIENT_CREDITS | Crédits insuffisants pour cette opération |
| 429 Trop de requêtes | RATE_LIMITED | Trop de requêtes, veuillez ralentir |
| 500 Erreur interne du serveur | INTERNAL_ERROR | Erreur serveur, veuillez réessayer plus tard |