视频(Videos)可灵系列
可灵视频生成
提交可灵视频生成任务(文生、首帧、首尾帧、参考图、参考视频)。
请求地址仍为 POST /v1/video/generations,完成后用 GET /v1/video/generations/{task_id} 查询。
素材只通过 metadata.content 传入。首帧必须写 role=first_frame;不写 role 时按参考图提交。已经有素材时不要传宽高比。
尾帧只支持 kling-video-2.1,须与首帧一起传,且分辨率为 1080P。
各版本能力与字段说明见下方接口文档。
Authorization
BearerAuth
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Request Body
application/json
model*string
模型 ID。
| model | 说明 |
|---|---|
kling-video-1.6 | 文生、首帧、参考图、参考视频 |
kling-video-2.0 | 文生、首帧、参考图、参考视频 |
kling-video-2.1 | 同上,另支持首尾帧,须 1080P |
kling-video-2.5 | 文生、首帧、参考图、参考视频 |
kling-video-2.6 | 文生、首帧、参考图、参考视频 |
kling-video-o1 | 文生、首帧、参考图、参考视频 |
kling-video-3.0 | 文生、首帧、参考图、参考视频;支持动作控制、数字人、对口型 |
kling-video-3.0-omni | 文生、首帧、参考图、参考视频 |
prompt?string
文本描述提示词。t2v 模式必填;i2v / 参考图模式建议填写以精确描述运动效果。
duration?number
视频时长(秒)。范围 3–15,默认 5。超出范围时限制到范围内;不传则使用默认 5 秒。
resolution?string
分辨率。720P、1080P,默认 720P,使用大写 P。kling-video-2.1 使用尾帧时必须是 1080P。
ratio?string
宽高比。文生视频可选 16:9、9:16、1:1。已经有素材时不要传,由素材决定。
seed?integer
随机种子,控制生成结果可复现性。全部模型支持。
metadata?
扩展参数。尾帧仅 kling-video-2.1,须与首帧同时传入,且分辨率为 1080P。已有素材时不传宽高比。
| 字段 | 类型 | 说明 |
|---|---|---|
content | array | 素材列表。见下方元素字段 |
negative_prompt | string | 反向提示词 |
enhance_prompt | string | 自动优化提示词,Enabled / Disabled |
scene_type | string | motion_control 动作控制、avatar_i2v 数字人、lip_sync 对口型 |
audio_generation | string | 是否生成 AI 音频,Enabled / Disabled。有值即转发 |
enhance_switch | string | 视频超分增强,Enabled / Disabled |
content 元素结构
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | image_url / video_url / audio_url |
role | string | 见下表 |
image_url.url | string | 图片地址 |
video_url.url | string | 视频地址 |
audio_url.url | string | 音频地址 |
reference_type | string | 写在对应视频项上。feature 为特征参考,base 为待编辑视频。普通参考图不传 |
role 取值:
| role | 适用 type | 说明 |
|---|---|---|
first_frame | image_url | 首帧。必须显式填写,省略时按参考图提交 |
last_frame | image_url | 尾帧。仅 kling-video-2.1,须与首帧同时传入,且分辨率为 1080P |
reference_image | image_url | 参考图 |
reference_video | video_url | 参考视频 |
reference_audio | audio_url | 参考音频 |
Response Body
application/json
application/json
curl -X POST "https://loading/v1/video/generations" \ -H "Content-Type: application/json" \ -d '{ "model": "kling-video-2.1", "prompt": "小猫慢慢睁开眼睛,轻轻伸了个懒腰", "resolution": "1080P", "duration": 5, "seed": 20240101, "metadata": { "audio_generation": "Enabled", "content": [ { "type": "image_url", "role": "first_frame", "image_url": { "url": "https://example.com/cat.jpg" } } ] } }'{
"task_id": "task_aehCmxJ5YUNOIQGgkhvxaco4T9P2h3Dw",
"status": "queued"
}{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}最后更新于