视频模型进阶用户更新于
POST/v1/videos/generations
Kling 2.6 Motion Control
请求 ID kling-v2-6-motion-control
协议
POST /v1/videos/generations· 生成视频示例GET /v1/videos/tasks/{id}· 查询视频任务示例GET /v1/videos/tasks/{id}/content· 下载视频示例DELETE /v1/videos/tasks/{id}· 删除已结束的视频任务示例
认证
请求需要 API Key。在控制台的 API Key 管理 获取密钥。发送 JSON 请求时,设置 Content-Type: application/json。
Authorization: Bearer YOUR_API_KEY
请求参数
POST /v1/videos/generations
| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
model | string | 必填 | kling-v2-6-motion-control. 使用本页列出的模型 ID。 |
prompt | string | 选填 | 可补充角色身份或动作指示。 |
content | array<object> | 必填 | 恰好一张参考图和一个参考视频。 |
content[].type | string | 必填 | 可用值为 text, image_url, input_image, video_url, input_video。 |
content[].text | string | 视条件 | 当素材项的 type 为 text 时填写提示词。 |
content[].role | string | 必填 | 图片用 reference_image,视频用 reference_video。 |
content[].asset_id | string | 视条件 | 先用 POST /v1/videos/assets 上传素材,再填返回的 id。在 multipart 表单中先填 kind(image, video),再填 file。 素材需属于同一账户。素材 ID 与对应的公网 HTTPS URL 二选一。 |
content[].image_url | string | 视条件 | 图片的公网 HTTPS 地址,直接传字符串。 |
content[].video_url | string | 视条件 | 视频的公网 HTTPS 地址,直接传字符串。 |
motion_mode | string | 选填 | 动作控制模式。 可用值为 std, pro。 默认 std。 |
character_orientation | string | 选填 | image 时参考视频须为 3–10 秒,video 时须为 3–30 秒。 可用值为 image, video。 默认 image。 |
keep_original_sound | boolean | 选填 | 是否保留参考视频的原声。 默认 true。 |
请求示例
先将 API Key 设置为本机环境变量 ICODEEASY_API_KEY,并选择支持直接 HTTP 调用的接入点。接入点要求特定客户端时,按对应客户端指南配置。
示例中的素材 URL 和素材 ID 需要替换成自己的有效素材。
Video Generations
bash
curl -sS 'https://api.icodeeasy.cc/v1/videos/generations' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "kling-v2-6-motion-control",
"prompt": "Preserve the character identity and follow the reference motion.",
"content": [
{
"type": "image_url",
"image_url": "https://example.com/reference.png",
"role": "reference_image"
},
{
"type": "video_url",
"video_url": "https://example.com/motion.mp4",
"role": "reference_video"
}
],
"motion_mode": "std",
"character_orientation": "image",
"keep_original_sound": true
}'
查询视频任务
bash
curl -sS 'https://api.icodeeasy.cc/v1/videos/tasks/YOUR_TASK_ID' \
-H "Authorization: Bearer $ICODEEASY_API_KEY"
下载视频
bash
curl -sS 'https://api.icodeeasy.cc/v1/videos/tasks/YOUR_TASK_ID/content' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-L \
-o result.mp4
删除已结束的视频任务
bash
curl -sS 'https://api.icodeeasy.cc/v1/videos/tasks/YOUR_TASK_ID' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-i \
-X DELETE
响应与任务
HTTP 202 · 任务已受理
json
{
"id": "vid_1785398400000000000",
"object": "video.generation.job",
"model": "kling-v2-6-motion-control",
"created_at": "2026-07-30T08:00:00Z",
"status_url": "/v1/videos/tasks/vid_1785398400000000000",
"content_url": "/v1/videos/tasks/vid_1785398400000000000/content",
"status": "queued",
"updated_at": "2026-07-30T08:00:00Z",
"task_id": "vid_1785398400000000000"
}
HTTP 200 · 查询到已完成任务
json
{
"id": "vid_1785398400000000000",
"object": "video.generation.job",
"model": "kling-v2-6-motion-control",
"created_at": "2026-07-30T08:00:00Z",
"status_url": "/v1/videos/tasks/vid_1785398400000000000",
"content_url": "/v1/videos/tasks/vid_1785398400000000000/content",
"status": "succeeded",
"updated_at": "2026-07-30T08:01:00Z",
"url": "/v1/videos/tasks/vid_1785398400000000000/content"
}
保存 id。用同一 API Key 对 status_url 发起 GET 请求,直到 status 变为 succeeded 或 failed。成功后请求 content_url 下载,并允许 HTTP 重定向。两个地址都相对于 API Base URL。
| 字段 | 类型 | 说明 |
|---|---|---|
id / task_id | string | 任务 ID。创建响应中的 task_id 与 id 相同。 |
status | string | 任务状态,可为 queued、running、succeeded 或 failed。 |
progress | integer | 生成进度。服务没有进度值时会省略。 |
error.code | string | 生成失败时返回错误分类。 |
常见错误
| HTTP | 错误类型 | 说明 |
|---|---|---|
| 400 | invalid_request | 检查模型、字段组合和参考素材是否有效。 |
| 401 | unauthorized | 检查 API Key 是否缺失、无效或已停用。 |
| 402 | insufficient_balance | 账户余额不足以提交任务。 |
| 404 | not_found | 查询遇到 404 时保留任务 ID,核对任务所属账户的 API Key 和查询地址。任务可能已完成,请勿因此重新提交。 |
| 409 | video_not_ready | 视频尚未生成完成。继续查询任务状态。 |
| 503 | submission_unknown | 无法确认提交结果。请先联系支持确认任务是否已创建,再提交新请求。 |
完整接入指南 · 查看完整接口指南,了解请求字段、任务状态和响应格式。
能力与限制
text_to_video· 不支持reference_images· 支持video_input· 支持- 限制 参考图:最多 1 张 · 输入:One image and one video. Modes: std or pro. Reference video: 3–10 seconds for image orientation, 3–30 seconds for video orientation.