Kling Image 4.0 API reference (images, sets, long images)
The API for Kuaishou's Kling Image 4.0, under two model ids. kling-image-4.0 makes single images (1–9 per request) or image sets (mode series, 2–10 pictures that belong together), from text or with up to 10 reference images and named subjects, at 2K / 4K / 8K. kling-image-4.0-long makes one ultra-tall image per request: a webpage design or an e-commerce product detail page, at 1K / 2K. Both use POST /v1/images/generations and return a taskId.
Autenticación
All requests carry the API key in the header:
Authorization: Bearer YOUR_API_KEYPrecios
The same as Kling's own API price list. Kling bills inputs from 4.0 on, so a request costs images × the output price + inputs × $0.00314, where inputs are reference images, elements, and product, style or subject images. Failed requests are not charged.
| kling-image-4.0 | Per image | Note |
|---|---|---|
| 2K | $0.0628 | Default, PNG |
| 4K | $0.0942 | PNG |
| 8K | $0.157 | JPEG |
| Each reference image / element | +$0.00314 | e.g. a set of 4 at 2K + 2 reference images = $0.25748 |
| kling-image-4.0-long | 1K | 2K |
|---|---|---|
| E-commerce · short (about 2–5 sections) | $0.2355 | $0.2826 |
| E-commerce · medium (about 6–10, default) | $0.471 | $0.5495 |
| E-commerce · long (about 11–18) | $0.785 | $0.8635 |
| Webpage design | $0.5495 | $0.5966 |
| Each input image | +$0.00314 | +$0.00314 |
Text-to-image · single images
/v1/images/generationsAsync: create returns a taskId; poll GET ?task_id= until completed and read resultUrls (one URL per image), or receive a webhook via callback_url. n is the number of independent images, 1–9. Put text that should appear on the image in quotes. We ran this example on 19 November 2026: a 2720×1536 PNG in 51 seconds with "NOIR" spelled exactly — one request, not a typical timing. There is no exact pixel size: use resolution plus aspect_ratio.
# Text-to-image, 2K 16:9 — create returns a taskId, then poll for the result.
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-image-4.0",
"prompt": "A faceted glass perfume bottle on wet black slate, soft studio rim light, product photography, the label reads \"NOIR\"",
"resolution": "2K",
"aspect_ratio": "16:9",
"n": 1
}'
# → { "code": 200, "data": { "taskId": "...", "state": "pending", "model": "kling-image-4.0" } }
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# → { "code": 200, "data": { "state": "completed", "resultUrls": ["https://r2.apimodels.app/..."] } }Image sets (series)
Set mode to series with n from 2 to 10 for pictures that belong together: one character from morning to night, one product across a campaign, the panels of a storyboard. Without series, n tops out at 9; series with n below 2 returns a 400. A set is billed per image, so 4 at 2K is 4 × $0.0628.
# A coherent set of 4 at 2K: 4 × $0.0628 = $0.2512
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-image-4.0",
"prompt": "The same red-haired girl through one day: breakfast at home, riding a bike to school, painting in class, reading in bed",
"mode": "series",
"n": 4,
"resolution": "2K",
"aspect_ratio": "3:2"
}'Reference images and named subjects (elements)
Reference images go in image_urls (image / images also work) and are mentioned in order as @image_1, @image_2. An element is a name plus 2–4 photos of the same subject from different angles; mention it as @name to keep a person, product or prop the same in every image. The name is 1–20 letters, digits, underscores or Chinese characters, cannot look like image_1 or object_1, and must be unique within the request (case-insensitive); tag is optional (character, animal, prop, costume, scene, effect, others), and so is a description of up to 100 characters. Reference images and elements together are capped at 10, each +$0.00314. A prompt that mentions @image_3 when only 2 images are sent returns a 400. The playground offers reference images only; use the API for elements.
# Reference images (@image_1) + a named subject (@Mia), 4K: $0.0942 + 2 inputs × $0.00314 = $0.10048
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-image-4.0",
"prompt": "@Mia sitting on the sofa from @image_1, holding a cup of tea, warm evening light",
"image_urls": ["https://example.com/living-room.jpg"],
"elements": [
{
"name": "Mia",
"image_urls": ["https://example.com/mia-front.jpg", "https://example.com/mia-side.jpg", "https://example.com/mia-back.jpg"],
"tag": "character",
"description": "young woman, short black hair, green knit sweater"
}
],
"resolution": "4K",
"aspect_ratio": "4:3"
}'Long images: e-commerce pages and webpage designs (kling-image-4.0-long)
Each request returns one ultra-tall image (n must be 1), with two skills. ecommerce: 1–3 product images in image_urls (@image_1…) and a length of short (about 2–5 sections), medium (about 6–10, the default) or long (about 11–18). webpage: a prompt alone, optionally a style_image (@style) whose look to follow and a subject_image (@subject) to feature. The two skills' fields cannot be mixed: image_urls / length with webpage, or style_image / subject_image with ecommerce, return a 400. Without skill, a request with images is treated as ecommerce and one without as webpage. Resolution 1K / 2K (default 2K); no aspect-ratio choice, no mode, no elements. Input images should be JPG / PNG, up to 20 MB, ideally at least 300 px on each side, aspect ratio 2:5 to 5:2 (others fail during generation). Our short 1K e-commerce test on 19 November 2026 came back 1024×8002 in 101 seconds, with one heading cut off — proofread the text.
# E-commerce detail page: skill ecommerce + 1-3 product images + length. Short, 1K: $0.2355 + $0.00314
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-image-4.0-long",
"skill": "ecommerce",
"prompt": "A product detail page for @image_1, a stainless steel travel mug for commuters: keeps drinks hot for 8 hours, leak-proof lid, fits car cup holders",
"image_urls": ["https://example.com/mug.jpg"],
"length": "short",
"resolution": "1K"
}'
# Webpage design: skill webpage + optional style_image (@style) and subject_image (@subject). 2K: $0.5966 + 2 × $0.00314
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-image-4.0-long",
"skill": "webpage",
"prompt": "A landing page for a coffee subscription in the style of @style, with @subject in the hero section",
"style_image": "https://example.com/style.png",
"subject_image": "https://example.com/coffee-bag.png",
"resolution": "2K"
}'Parameters · kling-image-4.0
| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | kling-image-4.0 |
| prompt | Yes | string | Up to 20,000 characters; put on-image text in quotes; mention references as @image_1 and elements as @name |
| image_urls / image / images | No | string[] / string | Reference images (public URL or data URI); up to 10 together with elements, +$0.00314 each |
| elements | No | object[] | Named subjects: { name, image_urls (2–4), tag?, description? (≤ 100 chars) }; +$0.00314 each |
| mode | No | string | default (single images) or series (a coherent set) |
| n | No | integer | Number of images: 1–9 in default mode (default 1), 2–10 in series mode (required there); count / num_images also work |
| resolution | No | string | 2K (default), 4K or 8K; 1K returns a 400 |
| aspect_ratio | No | string | auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 |
| callback_url | No | string | Webhook URL called when the task completes |
Parameters · kling-image-4.0-long
| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | kling-image-4.0-long |
| prompt | Yes | string | Up to 20,000 characters; mention inputs as @image_1…, @style, @subject |
| skill | No | string | ecommerce or webpage; if omitted, ecommerce with images, webpage without |
| image_urls / image / images | ecommerce: yes | string[] | 1–3 product images (ecommerce only), +$0.00314 each |
| length | No | string | short / medium (default) / long (ecommerce only) |
| style_image | No | string | Style reference, @style (webpage only), +$0.00314 |
| subject_image | No | string | Subject image, @subject (webpage only), +$0.00314 |
| resolution | No | string | 1K or 2K (default) |
| callback_url | No | string | Webhook URL called when the task completes |
Limits
- kling-image-4.0 has no 1K and no exact pixel size (no WIDTHxHEIGHT), only the nine aspect ratios above; for 1K drafts or exact sizes, use MiniMax H3 Image or MAI Image 2.7.
- 8K returns JPEG, 2K / 4K return PNG; there are no transparent backgrounds, masks, seeds or negative prompts.
- Reference images and elements are capped at 10 combined; skill, length, style_image and subject_image belong to the long-image model and return a 400 on kling-image-4.0.
- The long-image model returns one image per request, not HTML or layers, so its text cannot be edited afterwards; split pages beyond about 18 sections into several requests.
- Generation takes time: 51 s for a 2K image and 101 s for a short 1K long image in our tests (one each). Poll or use a callback_url rather than a client that expects an answer within seconds.
Not every request succeeds
Content review can refuse a prompt or an image, an input image can be unreadable or outside the allowed aspect ratio, and temporary errors happen. Failed requests are not charged, and the response carries the reason: for review refusals, change the prompt or the image; for temporary errors, retry. Result files are deleted after 30 days, so download or re-host them promptly.
Try it in the playground: Kling Image 4.0 / Kling Image 4.0 Long Image (the playground covers single images and sets, reference images and 2K / 4K / 8K, plus both long-image skills; use the API for elements).
Preguntas frecuentes
How do I make an image set with Kling Image 4.0?
Send model kling-image-4.0 with "mode": "series" and n from 2 to 10. Add an element (a name plus 2–4 photos of one subject) and mention it as @name to keep a person or product the same in every picture. Each image costs $0.0628 at 2K, plus $0.00314 per reference image or element.
How do I make an e-commerce detail page?
Send model kling-image-4.0-long with skill "ecommerce", 1–3 product photos in image_urls (@image_1…), length short, medium or long and resolution 1K or 2K. A short page at 1K is $0.2355 plus $0.00314 per product photo.
Does Kling Image 4.0 support 1K?
Not for kling-image-4.0: it renders at 2K, 4K or 8K, and 1K returns a 400. The long-image model kling-image-4.0-long does offer 1K and 2K.