메인 콘텐츠로 건너뛰기
POST
/
kling
/
v1
/
images
/
multi-image2image
cURL
curl https://api.cometapi.com/kling/v1/images/multi-image2image \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model_name": "kling-v2-1",
  "prompt": "Two product mascots standing together in a bright studio scene",
  "subject_image_list": [
    {
      "subject_image": "https://your-image-host/subject-1.png"
    },
    {
      "subject_image": "https://your-image-host/subject-2.png"
    }
  ],
  "scene_image": "https://your-image-host/scene.png",
  "style_image": "https://your-image-host/style.png",
  "n": 1,
  "aspect_ratio": "1:1"
}'
import os
import requests

response = requests.post(
"https://api.cometapi.com/kling/v1/images/multi-image2image",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"model_name": "kling-v2-1",
"prompt": "Two product mascots standing together in a bright studio scene",
"subject_image_list": [
{
"subject_image": "https://your-image-host/subject-1.png"
},
{
"subject_image": "https://your-image-host/subject-2.png"
}
],
"scene_image": "https://your-image-host/scene.png",
"style_image": "https://your-image-host/style.png",
"n": 1,
"aspect_ratio": "1:1"
},
)

result = response.json()
print(result["code"], result.get("data", {}).get("task_id"))
const response = await fetch("https://api.cometapi.com/kling/v1/images/multi-image2image", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model_name": "kling-v2-1",
"prompt": "Two product mascots standing together in a bright studio scene",
"subject_image_list": [
{
"subject_image": "https://your-image-host/subject-1.png"
},
{
"subject_image": "https://your-image-host/subject-2.png"
}
],
"scene_image": "https://your-image-host/scene.png",
"style_image": "https://your-image-host/style.png",
"n": 1,
"aspect_ratio": "1:1"
}),
});

const result = await response.json();
console.log(result.code, result.data?.task_id);
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/images/multi-image2image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subject_image_list' => [
[
'subject_image' => 'https://your-image-host/subject-1.png'
],
[
'subject_image' => 'https://your-image-host/subject-2.png'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.cometapi.com/kling/v1/images/multi-image2image"

payload := strings.NewReader("{\n \"subject_image_list\": [\n {\n \"subject_image\": \"https://your-image-host/subject-1.png\"\n },\n {\n \"subject_image\": \"https://your-image-host/subject-2.png\"\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.cometapi.com/kling/v1/images/multi-image2image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject_image_list\": [\n {\n \"subject_image\": \"https://your-image-host/subject-1.png\"\n },\n {\n \"subject_image\": \"https://your-image-host/subject-2.png\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cometapi.com/kling/v1/images/multi-image2image")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subject_image_list\": [\n {\n \"subject_image\": \"https://your-image-host/subject-1.png\"\n },\n {\n \"subject_image\": \"https://your-image-host/subject-2.png\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "code": 123,
  "message": "<string>",
  "data": {
    "task_id": "<string>",
    "created_at": 123,
    "updated_at": 123,
    "task_status_msg": "<string>",
    "task_info": {
      "external_task_id": "<string>"
    },
    "task_result": {}
  },
  "request_id": "<string>"
}
여러 개의 피사체 참조 이미지와 선택적인 장면 또는 스타일 참조를 바탕으로 Kling이 하나의 이미지를 생성하게 하려면 이 엔드포인트를 사용하세요.

호출 전에 확인할 사항

  • subject_image_list에 1~4개의 이미지를 제공합니다
  • 새 요청에는 model_name: kling-v2-1을 사용합니다
  • 핵심 피사체 구성이 이미 잘 작동할 때만 scene_image 또는 style_image를 추가합니다
  • 이를 비동기 생성 경로로 보고, 반환된 작업 id를 저장합니다

작업 흐름

1

이미지 생성 작업 제출

피사체 이미지 목록과 프롬프트를 전송한 뒤, 반환된 작업 id를 저장합니다.
2

작업 폴링

작업이 종료 상태에 도달할 때까지 해당 Kling 이미지 조회 경로로 반환된 작업을 폴링합니다.
3

결과 저장

지속적으로 접근해야 한다면 생성된 이미지를 자체 스토리지에 저장합니다.
전체 파라미터 참조는 공식 Kling 문서를 확인하세요.

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

헤더

Content-Type
string
기본값:application/json

Must be application/json.

본문

application/json
subject_image_list
object[]
필수

Subject reference images. Minimum 1, maximum 4.

Required array length: 1 - 4 elements
model_name
enum<string>
기본값:kling-v2

Model to use for multi-image generation. Use kling-v2-1 for new requests; omitting the field uses the legacy route default.

사용 가능한 옵션:
kling-v2,
kling-v2-1
prompt
string

Text prompt describing the desired output. Maximum 2500 characters.

negative_prompt
string

Elements to exclude from the image. Maximum 2500 characters.

scene_image
string

Optional scene reference image. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

style_image
string

Optional style reference image. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

n
integer
기본값:1

Number of images to generate. Range: 1-9.

필수 범위: 1 <= x <= 9
aspect_ratio
enum<string>
기본값:16:9

Aspect ratio of the generated image.

사용 가능한 옵션:
16:9,
9:16,
1:1,
4:3,
3:4,
3:2,
2:3,
21:9
watermark_info
object

Watermark options.

callback_url
string

Webhook URL for task status notifications.

external_task_id
string

Optional user-defined task ID for your own tracking. Must be unique per account.

응답

200 - application/json

Task request accepted or an error response returned by the API.

code
필수

Response code. 0 means the task request was accepted.

message
string
필수

Response message.

data
object
필수
request_id
string

Request identifier returned when present.