الانتقال إلى المحتوى الرئيسي
POST
/
kling
/
v1
/
images
/
generations
Multi-Image to Image
curl --request POST \
  --url https://api.cometapi.com/kling/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subject_image_list": [
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    },
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    },
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    },
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    }
  ]
}
'
{
  "code": 123,
  "message": "<string>",
  "request_id": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123
  }
}
استخدم نقطة النهاية هذه عندما تريد من Kling إنشاء صورة واحدة من عدة مراجع للعنصر الأساسي، بالإضافة إلى مراجع اختيارية للمشهد أو النمط.

قبل استدعائها

  • قدّم من 2 إلى 4 صور في subject_image_list
  • استخدم model_name: kling-v2
  • أضف scence_image أو style_image فقط عندما يكون التكوين الأساسي للعنصر يعمل بالفعل
  • تعامل مع هذا المسار على أنه مسار إنشاء غير متزامن واحفظ معرّف المهمة الذي يتم إرجاعه

سير عمل المهمة

1

إرسال مهمة إنشاء الصورة

أرسل قائمة صور العنصر الأساسي وPrompt، ثم خزّن معرّف المهمة المُعاد.
2

الاستعلام عن المهمة

تابع باستخدام الاستعلامات الفردية عبر مسار الاستعلام عن صور Kling حتى تصل المهمة إلى حالة نهائية.
3

حفظ النتيجة

احفظ الصورة المُنشأة في مساحة التخزين الخاصة بك إذا كنت بحاجة إلى وصول دائم إليها.
للاطلاع على المرجع الكامل للمعلمات، راجع وثائق Kling الرسمية.

التفويضات

Authorization
string
header
مطلوب

Bearer token authentication. Use your CometAPI key.

الترويسات

Content-Type
string

Content type of the request body.

الجسم

application/json

Kling Image Generation API request body definition

subject_image_list
object[]
مطلوب

List of subject reference images. Minimum 2, maximum 4.

model_name
enum<string>
افتراضي:kling-v2

Model to use for multi-image generation.

الخيارات المتاحة:
kling-v2
prompt
string

Text prompt describing the desired output. Max 2500 characters.

scence_image
string

Optional scene reference image. Same format and size constraints as subject images.

style_image
string

Optional style reference image. Same format and size constraints as subject images.

n
integer
افتراضي:1

Number of images to generate.

aspect_ratio
enum<string>
افتراضي:16:9

Aspect ratio of the generated image (width:height).

الخيارات المتاحة:
16:9,
9:16,
1:1,
4:3,
3:4,
3:2,
2:3,
21:9
callback_url
string

Webhook URL for task status notifications. The server sends a callback when the task status changes.

external_task_id
string

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

الاستجابة

200 - application/json

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object