通过 CometAPI 使用 Kling 生成图像:POST /kling/v1/images/generations 支持基于 prompt 的创建,并提供快速、可编程的输出。
curl --request POST \
--url https://api.cometapi.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "cry"
}
'{
"code": 123,
"data": {
"created_at": 123,
"task_id": "<string>",
"task_info": {
"external_task_id": null
},
"task_result": null,
"task_status": "<string>",
"task_status_msg": null,
"updated_at": 123
},
"message": "<string>"
}Bearer token authentication. Use your CometAPI key.
Must be application/json.
Text prompt describing the image to generate. Maximum 500 characters.
Elements to exclude from the image. Maximum 200 characters.
Reference image as a Base64 string (without data: prefix) or public URL. Accepted formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300×300 px.
How closely the output follows the reference image. Range: 0–1.
Number of images to generate. Range: 1–9.
Output aspect ratio (width:height). Options: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3.
Webhook URL to receive task status updates when the task completes.
Kling image model variant to use. See the Models page for current options.
curl --request POST \
--url https://api.cometapi.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "cry"
}
'{
"code": 123,
"data": {
"created_at": 123,
"task_id": "<string>",
"task_info": {
"external_task_id": null
},
"task_result": null,
"task_status": "<string>",
"task_status_msg": null,
"updated_at": 123
},
"message": "<string>"
}