Kling 3.0 Motion Control

POST https://api.beatapi.io/v1/videos/tasks

在 720p 或 1080p 下进行全身动作迁移,可选择角色方向和背景来源。图片方向最长 10 秒,视频方向最长 30 秒。

支持的生成方式

生成方式必填参数使用规则
动作迁移model, images, reference_videos两个素材都必须通过 /v1/files 上传,尺寸需大于 340 px,宽高比需在 2:5–5:2 之间,并遵守图片方向 10 秒和视频方向 30 秒的限制。

异步任务流程

创建任务后保存 data.id,每 5–10 秒调用 GET /v1/tasks/{task_id} 查询状态。statussucceeded 时读取 data.output.media,为 failed 时读取 data.error_codedata.error_message,随后按错误与重试策略处理。

使用本地文件

请先上传本地输入,再将返回的 data.url 填入请求。

鉴权

Authorization   string   必填

Authorization 请求头中以 Bearer 令牌发送服务端 API 密钥,可在控制台创建。

Authorization: Bearer <BEATAPI_API_KEY>

永久 API 密钥只能保存在可信服务端,不能写入浏览器、移动端、公开脚本、日志或截图。请求体必须使用 Content-Type: application/json。建议为每个逻辑创建请求设置唯一的 Idempotency-Key,只有完全相同的请求体才能安全复用原键。

请求体

字段名、类型和枚举值保留英文原样,用途和限制用中文说明。

model   string   必填

稳定的公开模型 ID,必须使用当前页面列出的值。

取值与默认值: 固定值 kling-3-motion-control


prompt   string   选填

描述生成、编辑或分析目标的提示词。

取值与默认值: 最多 2500 字符


images   string[]   必填

按当前模型或工作流要求排序的公网 HTTPS 图片 URL 列表。

取值与默认值: 1–1 项


reference_videos   string[]   必填

多模态或动作迁移使用的公网 HTTPS 视频 URL 列表。

取值与默认值: 1–1 项


resolution   enum<string>   选填

输出素材的分辨率或质量档位。

取值与默认值: 可选值 720p1080p;默认值 720p


character_orientation   enum<string>   选填

角色方向的判定来源,并会影响允许的动作视频时长。

取值与默认值: 可选值 imagevideo;默认值 image


background_source   enum<string>   选填

动作迁移时使用的背景来源。

取值与默认值: 可选值 input_videoinput_image;默认值 input_video

请求示例

动作迁移

$curl --request POST \
> --url https://api.beatapi.io/v1/videos/tasks \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "kling-3-motion-control",
> "prompt": "Preserve the character and transfer the full-body motion precisely.",
> "images": [
> "https://media.beatapi.io/samples/neon-singer.png"
> ],
> "reference_videos": [
> "https://media.beatapi.io/inputs/motion.mp4"
> ],
> "resolution": "1080p",
> "character_orientation": "image",
> "background_source": "input_video"
>}'

响应

成功请求返回 HTTP 201,响应体如下。

1{
2 "data": {
3 "id": "task_8K2qA",
4 "object": "task",
5 "task_kind": "video",
6 "capability_id": "kling-3-motion-control",
7 "capability_version": null,
8 "media_type": "video",
9 "model": "kling-3-motion-control",
10 "status": "queued",
11 "stage": "queued",
12 "created_at": 1782210000,
13 "updated_at": 1782210000,
14 "completed_at": null,
15 "output": null,
16 "usage": {
17 "credits_reserved": 2.1,
18 "credits_charged": 2.1,
19 "billable_duration_seconds": 15,
20 "credits_settled": 0,
21 "credits_refunded": 0
22 },
23 "request_id": "req_abc123",
24 "error_code": null,
25 "error_message": null
26 }
27}

下一步

保存接受响应中的 data.id,每 5–10 秒轮询 GET /v1/tasks/{task_id}。任务成功后从 data.output.media 读取托管结果。

错误

状态码含义与处理方式
400请求字段、格式、取值或参数组合不合法,请修正后重新请求。
401API 密钥缺失、无效或未启用。
402USD 余额不足,请充值后再创建付费任务。
409幂等键已对应其他请求体,仅能对完全相同的逻辑请求复用原键。
429超过请求频率或并发上限,请遵守 Retry-After 或返回的等待时间。