@image_1、@video_1 或自定义 @名称 引用素材。prompt 中按下表引用:| 素材 | 引用写法 | 数量上限 |
|---|---|---|
参考图 images | @image_1、@image_2… | 10 张 |
参考视频 videos | @video_1、@video_2… | 5 个,单个 2–30 秒,合计不超过 30 秒 |
主体 elements | @主体名 | 7 个,其中视频主体最多 3 个 |
声音 voices | @声音名 | 3 个 |
image_N、video_N、first_frame、last_frame 等保留名。aspect_ratio 时,有任意参考素材则按素材自适应,无素材则使用 16:9。传入 videos 时由 keep_original_sound 决定是否保留原声,未传 videos 时原生音频默认开启。callBackUrl 参数接收生成完成的自动通知,而非轮询状态接口。curl --location 'https://api.kie.ai/api/v1/jobs/createTask' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "kling-4.0/reference-to-video",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "@Hero 坐在 @video_1 的桌前,拿起 @image_1 里的玩偶,用 @Narrator 的声音打招呼",
"duration": 10,
"resolution": "1080p",
"image_urls": [
"https://example.com/doll.png"
],
"video_urls": [
"https://example.com/room.mp4"
],
"keep_original_sound": false,
"elements": [
{
"name": "Hero",
"image_urls": [
"https://example.com/hero-front.jpg",
"https://example.com/hero-side.jpg"
],
"tag": "character",
"description": "穿红夹克的年轻男人"
}
],
"voices": [
{
"name": "Narrator",
"audio_url": "https://example.com/narrator.mp3"
}
]
}
}'{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_kling-4.0-reference-to-video_abc123"
}
}