Skip to content

Kling-3.0 motion-control ​

本页由 ModelFold 文档站根据上游官方 OpenAPI 文档同步生成。接口路径、参数、示例与官方保持一致;品牌与 API 域名已替换为 ModelFold。

接口 ​

POST /jobs/createTask

完整 URL: https://ai.modelfold.online/v1/jobs/createTask

鉴权:所有请求都需要 Authorization: Bearer <API_KEY> 请求头。

文件上传要求 ​

在使用运动控制 API 之前,您需要上传您的图像和视频文件:

第 1 步 · 上传参考图像

使用文件上传 API 上传显示对象的参考图像。

要求:

  • 文件类型:JPEG、PNG 或 JPG 格式
  • 最大文件大小:每个文件 10MB,尺寸需大于 340px,宽高比为 2:5 至 5:2。
  • 内容:清楚显示对象的头部、肩膀和躯干的图像

第 2 步 · 上传运动视频

上传定义您要应用运动模式的视频。

要求:

  • 文件类型:MP4 或 QuickTime 格式
  • 持续时间:每个视频 3-30 秒
  • 最大文件大小:每个文件 100MB,尺寸需大于 340px,宽高比为 2:5 至 5:2。
  • 内容:清楚显示对象的头部、肩膀和躯干的视频

第 3 步 · 获取文件 URL

上传后,您将收到可在 input_urls 和 video_urls 参数中使用的文件 URL。

WARNING

  • 支持的图像格式:JPEG、PNG、JPG(最大:10MB),尺寸需大于 340px,宽高比为 2:5 至 5:2。
  • 支持的视频格式:MP4、QuickTime(最大:100MB,3-30 秒),尺寸需大于 340px,宽高比为 2:5 至 5:2。
  • 视频必须清楚显示对象的头部、肩膀和躯干
  • 每个请求最多一个图像和一个视频

查询任务状态 ​

提交任务后,使用统一的查询端点来检查进度并获取结果:

TIP

对于生产环境,我们建议使用 callBackUrl 参数来接收生成完成时的自动通知,而不是轮询状态端点。

相关资源 ​

请求参数 ​

请求体 (application/json) ​

参数类型必填说明
modelstring是用于生成任务的模型名称。必填字段。
- 此端点必须为 kling-3.0/motion-control 默认值:"kling-3.0/motion-control"。 可选值:kling-3.0/motion-control。 示例:kling-3.0/motion-control。
callBackUrlstring是接收生成任务完成通知的回调 URL。可选配置,生产环境建议使用。
- 任务生成完成后,系统会向该 URL 以 POST 方式推送任务状态和结果
- 回调内容包含生成内容的 URL 及任务相关信息
- 你的回调接口需支持接收 POST 请求及 JSON 格式的请求体
- 也可选择调用任务详情接口,主动轮询任务状态
- 为确保回调安全性,请参阅 Webhook 校验指南 了解签名验证实现方法
inputobject是—
  input.promptstring否(可选) 文本提示词,用于引导生成动画内容,可为空或 0-2500 字符
  input.input_urlsarray&lt;string&gt;是(必填)包含一个图片url
  input.video_urlsarray&lt;string&gt;是(必填)包含一个视频url
  input.modestring否可选。输出分辨率:"720p"(默认)或 "1080p"。 默认值:"720p"。 可选值:720p / 1080p。 示例:720p。
  input.character_orientationstring否(可选) 角色朝向参考来源。video: 参考视频 (推荐);image: 参考图片。默认值: video

请求示例 ​

bash
curl -X POST "https://ai.modelfold.online/v1/jobs/createTask" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "kling-3.0/motion-control",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "The cartoon character is dancing.",
    "input_urls": [
      "https://static.aiquickdraw.com/tools/example/1767694885407_pObJoMcy.png"
    ],
    "video_urls": [
      "https://static.aiquickdraw.com/tools/example/1767525918769_QyvTNib2.mp4"
    ],
    "mode": "720p",
    "character_orientation": "image"
  }
}'
json
{
  "model": "kling-3.0/motion-control",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "The cartoon character is dancing.",
    "input_urls": [
      "https://static.aiquickdraw.com/tools/example/1767694885407_pObJoMcy.png"
    ],
    "video_urls": [
      "https://static.aiquickdraw.com/tools/example/1767525918769_QyvTNib2.mp4"
    ],
    "mode": "720p",
    "character_orientation": "image"
  }
}

响应 ​

200 — 请求成功 ​

参数类型必填说明
codeinteger是请求状态码。请求失败时 HTTP 状态仍为 200,请始终以本字段判断:200 表示成功,其他值均表示失败,原因见 msg。常见值:401 API key 无效或缺失;402 积分不足;429 超出频率限制;422 或 500 请求未能处理(请先查看 msg、检查参数,再决定是否重试)。 可选值:200 / 401 / 402 / 404 / 422 / 429 / 433 / 455 / 500 / 501 / 505。 示例:200。
msgstring是响应消息,失败时的错误描述
dataobject是—
  data.taskIdstring是可以使用任务 ID 与“获取任务详细信息”端点一起查询任务状态。
json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_kling-3.0_1096798773938"
  }
}

回调 ​

videoTaskCompleted ​

回调地址:{request.body#/callBackUrl}(即请求体里的 callBackUrl)。

当 kling-3.0/motion-control 任务成功或失败时,系统会发送此回调。

回调体参数

参数类型必填说明
codeinteger是统一回调状态码:成功为 200,失败为 501。 可选值:200 / 501。 示例:200。
msgstring是统一回调消息。 可选值:Playground task completed successfully. / Playground task failed.。 示例:Playground task completed successfully.。
dataobject是—
  data.taskIdstring是任务唯一标识符。
  data.modelstring是任务使用的模型。 可选值:kling-3.0/motion-control。 示例:kling-3.0/motion-control。
  data.statestring是任务最终状态。 可选值:success / fail。 示例:success。
  data.paramstring是包含已提交任务参数的 JSON 字符串。
  data.resultJsonstring否任务成功时,包含 resultUrls、firstFrameUrl、lastFrameUrl 或 resultObject 的 JSON 字符串。仅在 state 为 success 时出现。
  data.failCodestring否失败码,数字字符串,如 "400"、"500"。仅在 state 为 fail 时出现。
  data.failMsgstring否失败原因,仅在 state 为 fail 时出现。
  data.costTimeinteger否处理耗时(秒),成功和失败回调都会返回。
  data.completeTimeinteger否任务完成时间戳。
  data.createTimeinteger否任务创建时间戳。
  data.updateTimeinteger否完成时间请以 completeTime 为准;updateTime 可能与 createTime 相同。
  data.creditsConsumednumber否本任务消耗的积分;失败任务为 0。

任务成功完成

json
{
  "code": 200,
  "msg": "Playground task completed successfully.",
  "data": {
    "taskId": "task_example_video_webhook_001",
    "model": "kling-3.0/motion-control",
    "state": "success",
    "param": "{\"input\":\"{\\\"prompt\\\":\\\"The cartoon character is dancing.\\\",\\\"input_urls\\\":[\\\"https://example.com/input-image.jpg\\\"],\\\"video_urls\\\":[\\\"https://example.com/input-video.mp4\\\"],\\\"mode\\\":\\\"720p\\\",\\\"character_orientation\\\":\\\"image\\\"}\",\"callBackUrl\":\"https://example.com/callback\",\"model\":\"kling-3.0/motion-control\"}",
    "resultJson": "{\"resultUrls\":[\"https://example.com/generated-video.mp4\"]}",
    "costTime": 12,
    "completeTime": 1234567890,
    "createTime": 1234560000,
    "updateTime": 1234567890,
    "creditsConsumed": 1.23
  }
}

任务失败

json
{
  "code": 501,
  "msg": "Playground task failed.",
  "data": {
    "taskId": "task_example_video_webhook_001",
    "model": "kling-3.0/motion-control",
    "state": "fail",
    "param": "{\"input\":\"{\\\"prompt\\\":\\\"The cartoon character is dancing.\\\",\\\"input_urls\\\":[\\\"https://example.com/input-image.jpg\\\"],\\\"video_urls\\\":[\\\"https://example.com/input-video.mp4\\\"],\\\"mode\\\":\\\"720p\\\",\\\"character_orientation\\\":\\\"image\\\"}\",\"callBackUrl\":\"https://example.com/callback\",\"model\":\"kling-3.0/motion-control\"}",
    "failCode": "400",
    "failMsg": "<error detail>",
    "costTime": 12,
    "creditsConsumed": 0
  }
}

ModelFold — 一个 API,接入所有主流 AI 模型。