KI
Kling Image API
AI image generation supporting text-to-image, image-to-image, multi-image reference, style transfer, and image expand.
Quick Start
1
Get your API key from the Console2
Choose a Kling image model3
Send POST request to create task4
Poll GET request for image resultAuthentication
Add Authorization header with Bearer token to all requests:
Authorization: Bearer YOUR_API_KEY
Available Models
| Model | API Name | Operations | Price (90% off) |
|---|---|---|---|
| Kling V2 | kling-v2 | text2img / img2img / multi-img | 0.076 / 0.151 / 0.302 |
| Kling V2 New | kling-v2-new | Style transfer img2img | 0.151 |
| Kling V2.1 | kling-v2-1 | text2img / multi-img | 0.076 / 0.302 |
| Kling V3 Image | kling-v3-image | text2img / img2img (1K/2K) | 0.151 |
| Kling Multi-Image | kling-multi-image | Multi-image reference | 0.302 |
| Kling Expand | kling-expand | Image outpainting | 0.151 |
| Kling Omni-Image | kling-image-o1 | text2img / img editing / multi-img (1K/2K) | 1.80 |
Pricing (90% off)
| Model | Operation | Credits/image |
|---|---|---|
kling-v2 | text2img | 0.076 |
kling-v2 | img2img | 0.151 |
kling-v2 | multi-img | 0.302 |
kling-v2-new | Style transfer img2img | 0.151 |
kling-v2-1 | text2img | 0.076 |
kling-v2-1 | multi-img | 0.302 |
kling-v3-image | text2img / img2img (1K/2K) | 0.151 |
kling-multi-image | Multi-image reference | 0.302 |
kling-expand | Image outpainting | 0.151 |
kling-image-o1 | text2img / img editing / multi-img (1K/2K) | 1.80 |
Endpoints
POST
/api/v1/images/generationsCreate a Kling image generation task. Routes to text-to-image, image-to-image, multi-image reference, style transfer, or image expand based on the model parameter.
GET
/api/v1/images/generations?task_id=xxxQuery task status and get image URL
Request Parameters
Text-to-Image / Image-to-Image
modelrequiredstring
"kling-v2", "kling-v2-1", "kling-v3-image", "kling-image-o1", etc.
promptrequiredstring
Text prompt, max 2500 characters (required for text-to-image)
image_urlstring
Reference image URL for image-to-image
negative_promptstring
Negative prompt
image_referencestring
"subject" or "face"
image_fidelitynumber
Image fidelity [0, 1]
human_fidelitynumber
Human fidelity [0, 1]
resolutionstring
"1k" or "2k"
nnumber
Number of images, 1-9, default 1
aspect_ratiostring
"16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"
callback_urlstring
Webhook URL for completion notification
Multi-Image Reference (kling-multi-image)
modelrequiredstring
"kling-multi-image"
multi_model_namestring
"kling-v2" or "kling-v2-1", default "kling-v2-1"
subject_image_listrequiredarray
Array of { subject_image: "url" }, max 4 images
scene_imagestring
Scene reference image URL
style_imagestring
Style reference image URL
promptstring
Text prompt
nnumber
Number of images, 1-9, default 1
aspect_ratiostring
"16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"
callback_urlstring
Webhook URL for completion notification
Image Expand (kling-expand)
modelrequiredstring
"kling-expand"
image_urlrequiredstring
Source image URL
up_expansion_ratiorequirednumber
Upward expansion ratio [0, 2]
down_expansion_ratiorequirednumber
Downward expansion ratio [0, 2]
left_expansion_ratiorequirednumber
Left expansion ratio [0, 2]
right_expansion_ratiorequirednumber
Right expansion ratio [0, 2]. Total area <= 3x original.
promptstring
Text prompt for expanded area
nnumber
Number of images, 1-9, default 1
callback_urlstring
Webhook URL for completion notification
Code Examples
curl -X POST https://apimodels.app/api/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-image",
"prompt": "A majestic snow-capped mountain at sunrise with golden light",
"aspect_ratio": "16:9",
"resolution": "2k",
"n": 1
}'Response Format
Create Task Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "pending",
"model": "kling-image-gen/kling-v3"
}
}Success Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "completed",
"model": "kling-image-gen/kling-v3",
"resultUrls": ["https://...image.png"],
"createTime": 1705123450000,
"completeTime": 1705123500000
}
}Failed Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "failed",
"model": "kling-image-gen/kling-v3",
"failMsg": "Content policy violation"
}
}Task States
pendingTask queued, waiting to processprocessingImage is being generatedcompletedImage generation successfulfailedImage generation failedError Codes
400Bad Request - Missing or invalid parameters401Unauthorized - Invalid API key402Payment Required - Insufficient credits404Not Found - Task ID not found500Internal Server ErrorImportant Notes
- *Image files are stored for 7 days, download promptly
- *All prices are per image; multiply by n for total cost
- *Prompt supports max 2500 characters
- *Multi-image reference supports up to 4 subject images
- *Image expand total area must not exceed 3x original
- *Poll every 5-10 seconds to check status
- *kling-v2-new style transfer resolution matches input image