Modellruter
Opprett en Kling-video med bevegelseskontroll
Opprett en Kling-oppgave med bevegelseskontroll fra et karakterbilde og en referansevideo med bevegelse.
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"
}
}
JSONimport 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"
}
}Bruk
Bruk karakterbildet og referansevideoen som offentlig tilgjengelige URL-er. Sett
For å animere et karakterbilde sender du denne forespørselskroppen til
Svaret returnerer en
Bruk verdien
POST /motion-control/{model} til å animere et karakterbilde med bevegelsen fra en referansevideo. Forespørselen oppretter en asynkron oppgave.
Velg en modell
| Modell-ID | Oppløsning | settings.audio |
|---|---|---|
kling-3.0 | 720p, 1080p | original, off |
kling-2.6 | 720p, 1080p | original, off |
settings.audio til original for å beholde lyd fra referansevideoen, eller off for lydløst resultat.
Bildet må være JPG eller PNG, maksimalt 50 MB og minst 300 piksler langs hver kant. Bruk en MP4- eller MOV-referansevideo på minst 3 sekunder og maksimalt 100 MB. Med character_orientation: image kan videoen være opptil 10 sekunder; med video kan den være opptil 30 sekunder.
Forespørselsparametere
| Felt | Påkrevd | Beskrivelse |
|---|---|---|
Bane model | Ja | Modell-ID i URL-en: kling-3.0 eller kling-2.6. Ikke legg den til i forespørselskroppen. |
contents | Ja | Array som inneholder ett image-element og ett video-element. Legg til et prompt-element for å beskrive scenen. |
contents[].type | Ja | image for karakteren, video for bevegelsesreferansen eller prompt for tekstveiledning. |
contents[].url | For bilde- og videoelementer | Offentlig URL for karakterbildet eller referansevideoen med bevegelse. |
contents[].text | For et prompt-element | Påkrevd tekstveiledning for den genererte scenen. |
settings.resolution | Nei | Utdataoppløsning: 720p eller 1080p. Hvis den utelates, bruker forespørselen 720p. |
settings.character_orientation | Ja | image bruker karakterens orientering fra bildet; video bruker referansevideoen. |
settings.audio | Nei | Sett original for å beholde referanselyd eller off for å deaktivere den. Angi verdien eksplisitt. |
options.callback_url | Nei | HTTPS-URL som mottar tilbakekall for oppgavestatus. |
options.external_task_id | Nei | Din egen oppgaveidentifikator for korrelasjon; behold den returnerte data.id for spørringer. |
options.watermark_info.enabled | Nei | Sett til true for å be om et vannmerke. |
POST /motion-control/kling-2.6. Erstatt medie-URL-ene med dine egne tilgjengelige filer når du bruker din egen karakter og bevegelse:
{
"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 for den asynkrone oppgaven:
{
"code": 0,
"message": "SUCCEED",
"data": {
"id": "example-task-id",
"status": "submitted"
}
}
data.id sammen med Hent en Kling-oppgave til oppgaven er fullført. Les URL-en til den ferdige videoen fra oppgavens outputs-array. Lagre videoen i din egen lagring hvis du trenger varig tilgang.
OpenAPI-panelet inneholder tilsvarende forespørsler for Shell, Python og JavaScript. Se Kling API-referanse for bevegelseskontroll.Stien-parametere
Kropp
application/json
Motion-control request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.
Svar
200 - application/json
Task created. Store data.id for a GET /tasks query.
Sist endret 25. september 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"
}
}
JSONimport 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"
}
}