Kling Image 4.0 Long Image
Generate complete vertical ecommerce product detail pages and full-scroll webpage designs with Kling Image 4.0 Long Image on reAPI. Parameters, examples, output, and billing.
Generate a single continuous tall PNG for an ecommerce product detail page or a full webpage layout from one prompt and mode-specific reference images. See the Kling Image 4.0 Long Image pricing table for current rates.
Quick example
These requests create a 1K webpage layout from a text brief and return a task ID.
curl https://reapi.ai/api/v1/images/generations \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "kling-image-4-0-long-image",
"contents": [
{"type": "prompt", "text": "Design a tall landing page for a specialty coffee roastery with a hero banner, three single-origin bean cards, roasting notes, and store hours."}
],
"settings": {"skill": "webpage", "resolution": "1k"}
}'import requests
response = requests.post(
"https://reapi.ai/api/v1/images/generations",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "kling-image-4-0-long-image",
"contents": [
{
"type": "prompt",
"text": "Design a tall landing page for a specialty coffee roastery with a hero banner, three single-origin bean cards, roasting notes, and store hours.",
}
],
"settings": {"skill": "webpage", "resolution": "1k"},
},
timeout=60,
)
response.raise_for_status()
print(response.json()["id"])const response = await fetch("https://reapi.ai/api/v1/images/generations", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "kling-image-4-0-long-image",
contents: [
{
type: "prompt",
text: "Design a tall landing page for a specialty coffee roastery with a hero banner, three single-origin bean cards, roasting notes, and store hours.",
},
],
settings: { skill: "webpage", resolution: "1k" },
}),
});
if (!response.ok) throw new Error(await response.text());
console.log((await response.json()).id);package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
)
func main() {
body := `{"model":"kling-image-4-0-long-image","contents":[{"type":"prompt","text":"Design a tall landing page for a specialty coffee roastery with a hero banner, three single-origin bean cards, roasting notes, and store hours."}],"settings":{"skill":"webpage","resolution":"1k"}}`
req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 60 * time.Second}
response, err := client.Do(req)
if err != nil {
panic(err)
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
message, _ := io.ReadAll(response.Body)
panic(string(message))
}
var task struct{ ID string }
if err := json.NewDecoder(response.Body).Decode(&task); err != nil {
panic(err)
}
fmt.Println(task.ID)
}Endpoint
Send JSON to POST https://reapi.ai/api/v1/images/generations with Authorization: Bearer YOUR_API_KEY and Content-Type: application/json. The response is JSON.
Parameters
| Field | Type | Requirement and default |
|---|---|---|
model | string | Required. Set to kling-image-4-0-long-image. |
contents | array | Required. One prompt item plus mode-specific reference image items. |
contents[].type | string | Required. prompt, refer_image (ecommerce only, 1–3 required), style_refer_image (webpage only, at most 1), or subject_refer_image (webpage only, at most 1). element is not supported. |
contents[].text | string | Required for prompt. Up to 166,000 English characters or 71,000 non-English characters. Mixed text must satisfy english / 166000 + non_english / 71000 <= 1 (checked after @id mention conversion). |
contents[].url | string | Required for each reference item. Public HTTP(S) URL to a JPEG or PNG up to 30 MB, at least 300 pixels per side, aspect ratio from 2:5 to 5:2. Base64 and data: URIs are rejected. |
contents[].id | string | Optional unique reference ID across all image items in the request. Mention it as @id in the prompt. |
settings.skill | string | Required. ecommerce for product detail pages or webpage for webpage designs. |
settings.length | string | Optional. short (about 2–5 sections), medium (default, about 6–10 sections), or long (about 11–18 sections). Applies to ecommerce rendering and billing only; omit for webpage (if supplied in webpage mode, it must still be a valid enum value). |
settings.resolution | string | Optional. 1k (default, 1024 px wide) or 2k (2048 px wide). Output height adapts to content. 4k is not supported. |
options.watermark_info.enabled | boolean | Optional. Only false is supported. |
webhook_url | string | Optional reAPI callback. See task webhooks. |
Ecommerce and webpage modes
Ecommerce product detail page
Ecommerce mode requires 1 to 3 refer_image entries. Reference each product photo by its id in the prompt.
{
"model": "kling-image-4-0-long-image",
"contents": [
{"type": "refer_image", "url": "https://example.com/kettle-front.png", "id": "front"},
{"type": "refer_image", "url": "https://example.com/kettle-spout.jpg", "id": "spout"},
{"type": "prompt", "text": "Build an ecommerce product detail page for the gooseneck kettle in @front with a close-up section highlighting @spout. Include hero visual, temperature control callouts, brewing scenes, and care notes."}
],
"settings": {"skill": "ecommerce", "length": "medium", "resolution": "2k"}
}Webpage design with style and subject references
Webpage mode accepts optional style_refer_image (at most 1) and subject_refer_image (at most 1) entries. Omit settings.length in webpage mode.
{
"model": "kling-image-4-0-long-image",
"contents": [
{"type": "style_refer_image", "url": "https://example.com/editorial-grid.png", "id": "layout"},
{"type": "subject_refer_image", "url": "https://example.com/watch.jpg", "id": "watch"},
{"type": "prompt", "text": "Design a watch launch webpage matching the typography and grid rhythm of @layout while showcasing @watch across the hero, movement breakdown, and spec table."}
],
"settings": {"skill": "webpage", "resolution": "2k"}
}Replace example URLs with publicly reachable HTTP(S) image URLs before submitting.
Pricing and billing
The pricing table lists all eight output tier rates (ecommerce by resolution × length, or webpage by resolution) and the per-reference image rate. Every input reference image, including the first, is billed once on a completed task.
- Estimate total USD as
output tier rate + input reference count × reference rate. - One credit equals
$0.001USD ($1 = 1,000 credits). At submission, reAPI reservesceil(total_usd × 1000)whole credits against the pricing snapshot active at submission. - On completion, the task settles to exact microdollars and returns any sub-credit reservation remainder to the wallet.
- A failed generation without delivered output releases its full reserve.
Output
The POST response returns id, model, status, and created_at. Poll GET /api/v1/tasks/{id} with the same API key until status is completed or failed. Tall-page renders typically take several minutes, especially for long + 2k layouts.
On completion, read the single PNG URL from output.image_urls[0]. At 2k, tall PNG files can exceed 50 MB, so size download timeouts and image viewers accordingly and copy files you need to retain into your own storage.
{
"id": "task_example",
"model": "kling-image-4-0-long-image",
"status": "completed",
"output": {"image_urls": ["https://example.com/long-page.png"]}
}Errors
See the reAPI error catalog for the full list.
| Code | What to check |
|---|---|
10001, 10003 | Provide a valid API key. |
20002, 20003 | Check settings.skill (ecommerce or webpage), settings.resolution (1k or 2k), settings.length, and HTTP(S) image URLs. |
30001, 30002 | Check balance or retry after pricing loads. |
40001 | Confirm the task ID and use the API key from the account that created it. |
50001, 50002 | Wait for rate limits or in-flight task limits to clear. |
80006, 80007 | Review the task error for policy rejections or upstream input validation failures (such as missing 1–3 refer_image items in ecommerce mode, mixed reference types, or duplicate IDs). |
Tips
- State the exact vertical section order in your prompt from hero banner down to specifications or footer.
- Include only verified product specs and copy in the brief so rendered callouts remain accurate.
- Start with
1k(shortfor ecommerce) to verify hierarchy and section flow before rendering2korlong. - In
webpagemode, usestyle_refer_imagefor layout rhythm and palette, andsubject_refer_imagefor the product or hero object.