Generate Images with KOLORS
April 24, 2025
Table of contents
This endpoint generates images using Kling’s KOLORS AI image generation system. It supports both KOLORS v1.5 (for face and subject references) and KOLORS v2.0 (for text-to-image and restyle), allowing for various reference-based image generation approaches.
https://api.useapi.net/v1/kling/images/kolors
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"email": "[email protected]",
"prompt": "Portrait of a woman with blue eyes, detailed, photorealistic",
"reference": "face",
"imageReference": "https://example.com/face.jpg",
"faceStrength": 65,
"faceNo": 1,
"aspect_ratio": "16:9",
"imageCount": 1
}
-
email
is optional when only one account configured.
However, if you have multiple accounts configured, this parameter becomes required. -
prompt
is required, the text description of the image to generate.
Maximum length: 2500 characters. reference
is optional, the type of reference to use.
Supported values:none
(default, uses KOLORS v2.0)subject
(uses KOLORS v1.5)face
(uses KOLORS v1.5)restyle
(uses KOLORS v2.0)
-
imageReference
is required ifreference
is notnone
, the URL of the reference image.
You can upload images using POST /assets and use the returned URL here. -
aspect_ratio
is optional, the aspect ratio of the generated image. Not supported byrestyle
reference type.
Supported values:1:1
,16:9
(default),4:3
,3:2
,2:3
,3:4
,9:16
,21:9
. -
imageCount
is optional, the number of images to generate.
Range:1
to9
. Default:1
. -
faceStrength
is optional, the strength of face similarity for bothface
andsubject
reference types.
Range:1
to100
. Default:65
. -
subjectStrength
is optional, the strength of subject similarity forsubject
reference type.
Range:1
to100
. Default:50
. -
faceNo
is optional, the index of the face to use in multi-face images forface
reference type.
Default:1
. You can use POST /images/recognize-faces to detect faces in an image. -
maxJobs
is optional, range from1
to10
.
Specifies the maximum number of concurrent jobs. -
replyUrl
is optional, a callback URL to receive generation progress and result.
See GET /tasks/task_id
for response model. replyRef
is optional, a reference identifier for the callback.
Responses
-
{ "task": { "id": 123456789, "userId": 12345, "type": "mmu_img2img_aiweb", "scene": "NORMAL_CREATION", "status": 5, "status_name": "submitted", "status_final": false, "taskInfo": { "type": "mmu_img2img_aiweb", "inputs": [ { "name": "input", "inputType": "URL", "token": null, "blobStorage": null, "url": "https://example.com/face.jpg", "cover": null, "fromWorkId": null }, { "name": "feature", "inputType": "URL", "token": null, "blobStorage": null, "url": "https://s21-kling.klingai.com/....jpg", "cover": null, "fromWorkId": null } ], "arguments": [ { "name": "prompt", "value": "Portrait of a woman with blue eyes, detailed, photorealistic" }, { "name": "aspect_ratio", "value": "16:9" }, { "name": "imageCount", "value": "1" }, { "name": "kolors_version", "value": "1.5" }, { "name": "fidelity", "value": "0.65" }, { "name": "style", "value": "默认" }, { "name": "faceBound", "value": "{\"x\":120,\"y\":80,\"width\":200,\"height\":240}" }, { "name": "referenceType", "value": "mmu_img2img_aiweb_v15_character" }, { "name": "biz", "value": "klingai" } ], "extraArgs": {}, "callbackPayloads": [ { "name": "face_count", "value": "1" }, { "name": "referenceImageWidth", "value": "724" }, { "name": "referenceImageHeight", "value": "1268" } ], "scene": "NORMAL_CREATION" }, "favored": false, "deleted": false, "viewed": false, "createTime": 1745376611075, "updateTime": 1745376611075 }, "works": [], "status": 5, "status_name": "submitted", "status_final": false, "message": "", "limitation": { "type": "mmu_img2img_aiweb", "remaining": 10000, "limit": 10000 }, "userPoints": { "points": [], "total": 0 }, "userTickets": { "ticket": [] }, "editProject": null }
-
{ "error": "reference \"face\" does not support subjectStrength" }
-
{ "error": "Unauthorized", "code": 401 }
When successful, the response includes a task ID which can be used to check the status using GET /tasks/task_id
.
Model
{ // TypeScript, all fields are optional
task: {
id: number
userId: number
type: string
scene: string
status: number
status_name: 'submitted' | 'failed' | 'processing' | 'succeed'
status_final: boolean
taskInfo: {
type: string
inputs: Array<{
name: string
inputType: string
token: string | null
blobStorage: any | null
url: string
cover: string | null
fromWorkId: number | null
}>
arguments: Array<{
name: string
value: string
}>
extraArgs: Record<string, any>
callbackPayloads: any[]
scene: string
}
favored: boolean
deleted: boolean
viewed: boolean
createTime: number
updateTime: number
viewTime: number
}
works: Array<any>
status: number
status_name: 'submitted' | 'failed' | 'processing' | 'succeed'
status_final: boolean
message: string
limitation: {
type: string
remaining: number
limit: number
}
userPoints: {
points: Array<{
orderId: string
type: string
amount: number
balance: number
startTime: number
endTime: number
}>
total: number
}
userTickets: {
ticket: Array<{
orderId: string
type: string
packageType: string
amount: number
balance: number
startTime: number
endTime: number
}>
}
editProject: any | null
}
Examples
-
curl -X POST "https://api.useapi.net/v1/kling/images/kolors" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -d '{ "email": "[email protected]", "prompt": "Portrait of a woman with blue eyes, detailed, photorealistic", "reference": "face", "imageReference": "https://example.com/face.jpg", "faceStrength": 65, "faceNo": 1 }'
-
const token = "API token"; const email = "Previously configured account email"; const apiUrl = "https://api.useapi.net/v1/kling/images/kolors"; const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${token}`, }, body: JSON.stringify({ email: email, prompt: "Portrait of a woman with blue eyes, detailed, photorealistic", reference: "face", imageReference: "https://example.com/face.jpg", faceStrength: 65, faceNo: 1 }) }); const result = await response.json(); console.log("response", {response, result});
-
import requests token = "API token" email = "Previously configured account email" apiUrl = "https://api.useapi.net/v1/kling/images/kolors" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } data = { "email": email, "prompt": "Portrait of a woman with blue eyes, detailed, photorealistic", "reference": "face", "imageReference": "https://example.com/face.jpg", "faceStrength": 65, "faceNo": 1 } response = requests.post(apiUrl, headers=headers, json=data) print(response, response.json())