Documentation

多图参考生图

Last updated: Nov 4, 2026

POST
/v3/aigc/kl/images/multi-image2image

以 1~4 张主体图结合场景 / 风格图生成图片。

使用 TE 北京地域 API Key 鉴权。模型能力、调用约定见 Kling 接口概览。

Authorization

BearerAuth
headerAuthorizationBearer <token>

TE 北京地域 API Key,填写后自动添加 Bearer 前缀。

Request Body

application/json
  1. body
model_name?string

kling-v2(默认)、kling-v2-1

prompt?string

≤ 2500 字符

subject_image_list*array<>

主体图 [{subject_image}],1~4 张;无裁剪逻辑,请上传已选主体后的图片

scene_image?string

场景参考图,URL 或 Base64(不带 data: 前缀);jpg/jpeg/png,≤ 10MB,宽高 ≥ 300px,宽高比 1:2.5~2.5:1

style_image?string

风格参考图,URL 或 Base64(不带 data: 前缀);jpg/jpeg/png,≤ 10MB,宽高 ≥ 300px,宽高比 1:2.5~2.5:1

n?integer

[1,9],默认 1

aspect_ratio?string

16:9(默认)、9:16、1:1、4:3、3:4、3:2、2:3、21:9

watermark_info?

{"enabled": true} 同时生成含水印结果;不支持自定义水印

Response Body

成功;具体状态及结果见响应字段。

application/json
  1. response
taskId?string

任务 ID

requestId?string

请求 ID,用于排查

code?string

错误码,异常时返回

message?string

错误信息,异常时返回

Example Request
curl -X POST 'https://vod.bj.baidubce.com/v3/aigc/kl/images/multi-image2image' \  -H 'Content-Type: application/json' \  -d '{  "model_name": "kling-v2-1",  "prompt": "Generate a recommended cover for each subject based on the style of the reference image",  "subject_image_list": [    {      "subject_image": "https://example.com/subject.png"    }  ],  "scene_image": "https://example.com/scene.png",  "n": 9,  "aspect_ratio": "1:1",  "watermark_info": {    "enabled": true  }}'
Example Response200
{  "taskId": "tsk-xxxxxxxxxxxxxxxx",  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}