多图参考生图
▼
Authorization
在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
请求参数
Header 参数
Content-Type
string
可选
示例: application/json
Authorization
string
可选
示例: Bearer {{YOUR_API_KEY}}
Body 参数 application/json
model_name
string
必需
模型名称 枚举值:kling-v2, kling-v2-1
prompt
string
可选
正向文本提示词 不能超过2500个字符
subject_image_list
array [object]
必需
最多支持4张图片,最少支持1张图片
subject_image
string
必需
scene_image
string
可选
场景参考图 支持传入图片Base64编码或图片URL(确保可访问)
style_image
string
可选
风格参考图 支持传入图片Base64编码或图片URL(确保可访问)
n
integer
必需
生成图片数量 取值范围:[1,9]
aspect_ratio
string
可选
生成图片的画面纵横比(宽:高) 枚举值:16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9
callback_url
string
可选
external_task_id
string
可选
示例
{
"model_name": "kling-v2",
"prompt": "根据两张图的特点融合",
"subject_image_list": [
{
"subject_image": "https://example.com/image1.jpg"
},
{
"subject_image": "https://example.com/image2.jpg"
}
],
"scene_image": "",
"style_image": "",
"n": 1,
"aspect_ratio": "16:9",
"callback_url": "",
"external_task_id": ""
}
请求示例代码
curl --location --request POST 'https://api.quickrouter.ai/kling/v1/images/multi-image2image' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"model_name": "kling-v2",
"prompt": "根据两张图的特点融合",
"subject_image_list": [
{
"subject_image": "https://example.com/image1.jpg"
},
{
"subject_image": "https://example.com/image2.jpg"
}
],
"scene_image": "",
"style_image": "",
"n": 1,
"aspect_ratio": "16:9",
"callback_url": "",
"external_task_id": ""
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"model_name": "kling-v2",
"prompt": "根据两张图的特点融合",
"subject_image_list": [
{
"subject_image": "https://example.com/image1.jpg"
},
{
"subject_image": "https://example.com/image2.jpg"
}
],
"scene_image": "",
"style_image": "",
"n": 1,
"aspect_ratio": "16:9",
"callback_url": "",
"external_task_id": ""
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.quickrouter.ai/kling/v1/images/multi-image2image", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("api.quickrouter.ai")
payload = json.dumps({
"model_name": "kling-v2",
"prompt": "根据两张图的特点融合",
"subject_image_list": [
{
"subject_image": "https://example.com/image1.jpg"
},
{
"subject_image": "https://example.com/image2.jpg"
}
],
"scene_image": "",
"style_image": "",
"n": 1,
"aspect_ratio": "16:9",
"callback_url": "",
"external_task_id": ""
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
conn.request("POST", "/kling/v1/images/multi-image2image", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
返回响应
响应参数 application/json
object
string
可选
示例
{}