Routes par modèle
Créer une vidéo Kling avec contrôle des mouvements
Créez une tâche Kling avec contrôle des mouvements à partir d’une image de personnage et d’une vidéo de mouvement de référence.
POST
/
motion-control
/
{model}
cURL
curl https://api.cometapi.com/motion-control/kling-2.6 \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video."
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png"
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4"
}
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off"
}
}
JSON
import os
import requests
response = requests.post(
"https://api.cometapi.com/motion-control/kling-2.6",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video.",
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png",
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4",
},
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off",
},
},
)
response.raise_for_status()
result = response.json()
print(result["data"]["id"])
const response = await fetch(
"https://api.cometapi.com/motion-control/kling-2.6",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video."
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png"
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4"
}
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off"
}
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
console.log(result.data.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/motion-control/{model}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contents' => [
[
'type' => 'prompt',
'text' => 'The character performs the dance shown in the reference video.'
],
[
'type' => 'image',
'url' => 'https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png'
],
[
'type' => 'video',
'url' => 'https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4'
]
],
'settings' => [
'resolution' => '720p',
'character_orientation' => 'video',
'audio' => 'off'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/motion-control/{model}"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"The character performs the dance shown in the reference video.\"\n },\n {\n \"type\": \"image\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png\"\n },\n {\n \"type\": \"video\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4\"\n }\n ],\n \"settings\": {\n \"resolution\": \"720p\",\n \"character_orientation\": \"video\",\n \"audio\": \"off\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/motion-control/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"The character performs the dance shown in the reference video.\"\n },\n {\n \"type\": \"image\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png\"\n },\n {\n \"type\": \"video\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4\"\n }\n ],\n \"settings\": {\n \"resolution\": \"720p\",\n \"character_orientation\": \"video\",\n \"audio\": \"off\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/motion-control/{model}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"The character performs the dance shown in the reference video.\"\n },\n {\n \"type\": \"image\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png\"\n },\n {\n \"type\": \"video\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4\"\n }\n ],\n \"settings\": {\n \"resolution\": \"720p\",\n \"character_orientation\": \"video\",\n \"audio\": \"off\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}Utilisez
Utilisez l’image du personnage et la vidéo de référence sous forme d’URL accessibles publiquement. Définissez
Pour animer une image de personnage, envoyez ce corps de requête à
La réponse renvoie un
Utilisez la valeur
POST /motion-control/{model} pour animer une image de personnage avec les mouvements d’une vidéo de référence. La requête crée une tâche asynchrone.
Choisir un modèle
| ID du modèle | Résolution | settings.audio |
|---|---|---|
kling-3.0 | 720p, 1080p | original, off |
kling-2.6 | 720p, 1080p | original, off |
settings.audio sur original pour conserver l’audio de la vidéo de référence, ou sur off pour une sortie silencieuse.
L’image doit être au format JPG ou PNG, ne pas dépasser 50 Mo et mesurer au moins 300 pixels sur chaque côté. Utilisez une vidéo de référence MP4 ou MOV d’au moins 3 secondes et ne dépassant pas 100 Mo. Avec character_orientation: image, la vidéo peut durer jusqu’à 10 secondes ; avec video, elle peut durer jusqu’à 30 secondes.
Paramètres de la requête
| Champ | Obligatoire | Description |
|---|---|---|
Chemin model | Oui | ID du modèle dans l’URL : kling-3.0 ou kling-2.6. Ne l’ajoutez pas au corps de la requête. |
contents | Oui | Tableau contenant un élément image et un élément video. Ajoutez un élément prompt pour décrire la scène. |
contents[].type | Oui | image pour le personnage, video pour la référence de mouvement ou prompt pour les instructions textuelles. |
contents[].url | Pour les éléments image et vidéo | URL publique de l’image du personnage ou de la vidéo de mouvement de référence. |
contents[].text | Pour un élément prompt | Instructions textuelles obligatoires pour la scène générée. |
settings.resolution | Non | Résolution de sortie : 720p ou 1080p. Si elle est omise, la requête utilise 720p. |
settings.character_orientation | Oui | image utilise l’orientation du personnage à partir de l’image ; video utilise la vidéo de référence. |
settings.audio | Non | Définissez original pour conserver l’audio de référence ou off pour le désactiver. Définissez la valeur explicitement. |
options.callback_url | Non | URL HTTPS recevant les rappels d’état de la tâche. |
options.external_task_id | Non | Votre propre identifiant de tâche pour la corrélation ; conservez le data.id renvoyé pour les requêtes. |
options.watermark_info.enabled | Non | Définissez sur true pour demander un filigrane. |
POST /motion-control/kling-2.6. Remplacez les URL des médias par vos propres fichiers accessibles lorsque vous utilisez votre propre personnage et mouvement :
{
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video."
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png"
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4"
}
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off"
}
}
id pour la tâche asynchrone :
{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}
data.id avec Obtenir une tâche Kling jusqu’à ce que la tâche soit terminée. Lisez l’URL de la vidéo terminée dans le tableau outputs de la tâche. Stockez la vidéo dans votre propre espace de stockage si vous avez besoin d’un accès durable.
Le panneau OpenAPI contient les requêtes Shell, Python et JavaScript correspondantes. Pour plus de détails sur les entrées, consultez la référence de l’API de contrôle des mouvements Kling.Paramètres de chemin
Corps
application/json
Motion-control request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.
Réponse
200 - application/json
Task created. Store data.id for a GET /tasks query.
Dernière modification le 25 septembre 2026
⌘I
cURL
curl https://api.cometapi.com/motion-control/kling-2.6 \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video."
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png"
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4"
}
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off"
}
}
JSON
import os
import requests
response = requests.post(
"https://api.cometapi.com/motion-control/kling-2.6",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video.",
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png",
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4",
},
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off",
},
},
)
response.raise_for_status()
result = response.json()
print(result["data"]["id"])
const response = await fetch(
"https://api.cometapi.com/motion-control/kling-2.6",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"contents": [
{
"type": "prompt",
"text": "The character performs the dance shown in the reference video."
},
{
"type": "image",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png"
},
{
"type": "video",
"url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4"
}
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "off"
}
}),
},
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
console.log(result.data.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/motion-control/{model}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contents' => [
[
'type' => 'prompt',
'text' => 'The character performs the dance shown in the reference video.'
],
[
'type' => 'image',
'url' => 'https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png'
],
[
'type' => 'video',
'url' => 'https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4'
]
],
'settings' => [
'resolution' => '720p',
'character_orientation' => 'video',
'audio' => 'off'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/motion-control/{model}"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"The character performs the dance shown in the reference video.\"\n },\n {\n \"type\": \"image\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png\"\n },\n {\n \"type\": \"video\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4\"\n }\n ],\n \"settings\": {\n \"resolution\": \"720p\",\n \"character_orientation\": \"video\",\n \"audio\": \"off\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/motion-control/{model}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"The character performs the dance shown in the reference video.\"\n },\n {\n \"type\": \"image\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png\"\n },\n {\n \"type\": \"video\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4\"\n }\n ],\n \"settings\": {\n \"resolution\": \"720p\",\n \"character_orientation\": \"video\",\n \"audio\": \"off\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/motion-control/{model}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contents\": [\n {\n \"type\": \"prompt\",\n \"text\": \"The character performs the dance shown in the reference video.\"\n },\n {\n \"type\": \"image\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-3.ng.png\"\n },\n {\n \"type\": \"video\",\n \"url\": \"https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dance.mp4\"\n }\n ],\n \"settings\": {\n \"resolution\": \"720p\",\n \"character_orientation\": \"video\",\n \"audio\": \"off\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}