Kling 动作控制
curl --request POST \
--url https://api.mixroute.ai/kling/motion-control/{model}import requests
url = "https://api.mixroute.ai/kling/motion-control/{model}"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.mixroute.ai/kling/motion-control/{model}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mixroute.ai/kling/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",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mixroute.ai/kling/motion-control/{model}"
req, _ := http.NewRequest("POST", url, nil)
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.mixroute.ai/kling/motion-control/{model}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixroute.ai/kling/motion-control/{model}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyKling
Kling 动作控制
使用人物图片和动作参考视频生成 Kling 视频。
Kling 动作控制
curl --request POST \
--url https://api.mixroute.ai/kling/motion-control/{model}import requests
url = "https://api.mixroute.ai/kling/motion-control/{model}"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.mixroute.ai/kling/motion-control/{model}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mixroute.ai/kling/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",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mixroute.ai/kling/motion-control/{model}"
req, _ := http.NewRequest("POST", url, nil)
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.mixroute.ai/kling/motion-control/{model}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixroute.ai/kling/motion-control/{model}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body使用 MixRoute API Key,以
通用选项见 Kling 概览。
保存
Authorization: Bearer $MIXROUTE_API_KEY 认证,请求体为 JSON。模型 ID 位于 URL 中,不在请求体中重复传 model;不添加 /v1,也不使用 metadata 包装。
支持 kling-3.0 与 kling-2.6。两者均只支持 720p / 1080p,不支持 4k。这是基于人物动作参考的控制,不是独立的 motion 型号或单纯摄像机运镜参数。
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
contents | object[] | 是 | 输入集合,提供外观图片与动作视频,可附提示词。 |
contents[].type | string | 是 | 每项必填:prompt、image、video;3.0 另支持 element。 |
contents[].text | string | 按类型 | prompt 项必填,最多 2500 字符,可描述正向与负向要求。 |
contents[].url | string | 按类型 | image/video 项必填。图片可用 URL 或 Base64,视频用公网 URL。 |
contents[].element_id | string | 按类型 | 仅 3.0 的 element 项,必填,最多 1 个 Element。 |
contents[].id | string | 按类型 | element 项必填,同任务唯一,供提示词 @id 引用。 |
settings.character_orientation | string | 是 | video:人物朝向跟随视频,参考视频 3-30 秒;image:跟随图片,参考视频 3-10 秒。使用 Element 时朝向跟随视频,设 video。 |
settings.resolution | string | 否 | 720p(默认)或 1080p,不支持 4k。 |
settings.audio | string | 否 | original(默认)保留参考视频原声;off 静音。没有 native。 |
不要传
settings.duration。输出时长由可用的连续动作决定,可能短于参考视频;至少需要提取出 3 秒有效动作。按实际生成时长结算。媒体限制
- 图片:JPG/JPEG/PNG,最多 50 MB;宽高至少 300 px,宽高比 1:2.5 至 2.5:1。
- 视频:MP4/MOV,最多 100 MB,宽高各 340-3850 px;时长按
character_orientation选择。 - 图片与视频中的人物比例应接近,头部、肢体清晰可见,避免遮挡。动作视频优先单人、单镜头、连续运动,避免剪辑与快速动作。
请求示例
先设置环境变量MIXROUTE_API_KEY。将 example.com 媒体地址替换为无需登录即可访问的真实素材。
curl --request POST "https://api.mixroute.ai/kling/motion-control/kling-3.0" \
--header "Authorization: Bearer $MIXROUTE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"contents": [
{
"type": "prompt",
"text": "The person follows the reference motion."
},
{
"type": "image",
"url": "https://example.com/person.png"
},
{
"type": "video",
"url": "https://example.com/motion.mp4"
}
],
"settings": {
"resolution": "720p",
"character_orientation": "video",
"audio": "original"
}
}'
提交响应
{
"code": 0,
"message": "",
"request_id": "REQUEST_ID",
"data": {
"id": "task_example",
"status": "submitted"
}
}
data.id,使用 查询 Kling 任务 轮询至 succeeded 或 failed。提交成功不代表生成完成。