Skip to main content
POST
/
kling
/
v1
/
images
/
generations
Kling image generation task
curl --request POST \
  --url https://api.powertokens.ai/kling/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model_name": "kling-v3",
  "prompt": "A clean product photo on a white background",
  "aspect_ratio": "1:1",
  "n": 1
}
'
{
  "code": 123,
  "message": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "submitted",
    "task_info": {
      "external_task_id": "<string>"
    },
    "created_at": 123,
    "updated_at": 123
  },
  "request_id": "<string>"
}

Authorizations

Authorization
string
header
required

Pass Authorization: Bearer <token> in the request header.

Body

application/json
model_name
enum<string>
required

Model name

Available options:
kling-v3
prompt
string
required

Positive text prompt

Maximum string length: 2500
negative_prompt
string

Negative text prompt Note: Negative prompts are not supported in image-to-image mode (i.e., when the image field is not empty).

Maximum string length: 2500
image
string

Reference image

  • Supports image Base64 encoding or image URL (must be accessible)

Base64 encoding notes: Please ensure all image data parameters use Base64 encoding format. When using Base64, do not add any prefix such as data:image/png;base64, — provide only the Base64 encoded string itself.

Correct example: iVBORw0KGgoAAAANSUhEUgAAAAUA

Incorrect example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...

  • Supported image formats: .jpg / .jpeg / .png
  • Image file size must not exceed 10MB, image dimensions must be at least 300px, aspect ratio between 1:2.5 ~ 2.5:1
  • This parameter is required when image_reference is not empty
image_reference
enum<string>

Image reference type.

  • subject (character feature reference), face (facial appearance reference)
  • When using face (facial appearance reference), the uploaded image must contain only 1 face
Available options:
subject,
face
image_fidelity
number
default:0.8

Reference strength for the uploaded image during generation.

Required range: 0 <= x <= 1
human_fidelity
number
default:0.8

Facial reference strength, i.e., facial feature similarity to the reference image.

Required range: 0 <= x <= 1
element_list
object[]

Element reference list, configured based on element IDs in the element library. Use key:value format as shown: "element_list":[{ "element_id": long },{ "element_id": long }] The total number of reference elements and reference images must not exceed 10

resolution
enum<string>
default:1k

Generated image resolution.

Available options:
1k,
2k
n
integer
default:1

Number of images to generate.

Required range: 1 <= x <= 9
aspect_ratio
enum<string>
default:16:9

Aspect ratio of generated images (width:height)

Available options:
1:1,
16:9,
4:3,
3:2,
2:3,
3:4,
9:16,
21:9
watermark_info
object

Whether to also generate a watermarked result.

callback_url
string

Callback notification URL for this task. If configured, the server will proactively notify when the task status changes.

external_task_id
string

Custom task ID

Response

Task accepted.

code
integer
required

Kling response code. 0 indicates the task has been accepted.

message
string
required

Kling response message.

data
object
required
request_id
string

Upstream request identifier (if provided).