Skip to content
Questa pagina non è ancora disponibile nella tua lingua, quindi viene mostrata in inglese.

Kling V4 Long Image Generation

Generate tall product detail images or webpage designs in 1K / 2K. Supports short, medium, and long ecommerce layouts and product, style, and subject references. Returns one PNG per request.

Tutta la documentazione
POST/v1/images/generations

Submit an asynchronous request to POST /v1/images/generations with model: "kling-v4-long-image". Read data[0].task_id, then query GET /v1/tasks/{task_id}. Each request returns one tall PNG; webpage mode produces a webpage design image.

Esempi di richieste

curl --request POST \
  --url https://api.apisea.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "kling-v4-long-image",
  "skill": "ecommerce",
  "prompt": "Create a product detail page for the coffee maker in @Image1, with a hero section, key features, and everyday use scenes",
  "image_urls": [
    "https://example.com/product.png"
  ],
  "length": "medium",
  "resolution": "1K",
  "nsfw_check": true
}'

Choose a mode

ModeskillReferencesLength
Product detail pageecommerceimage_urls: 1–3 product images requiredshort / medium / long
Webpage designwebpageimage_with_roles: optional style and subject images, at most one of eachOmit length

Authentication

Authorizationstringrequired

Use Authorization: Bearer <token>, where <token> is your APISea API key.

Request parameters

modelstringrequired

Must be kling-v4-long-image.

nsfw_checkbooleandefault: false

Whether to run content moderation before submitting the image task.

  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
promptstringrequired

Required and must not be blank. Limits are 166,000 characters for English-only text and 71,000 for Chinese-only text and similar languages; mixed-language limits are proportional. Describe the layout, sections, copy, style, and subject.

skillstringrequired

Required: ecommerce for product detail pages or webpage for webpage designs, case-insensitive. The modes use different reference-image fields as shown above.

lengthstringdefault: medium

Only for skill: "ecommerce": short, medium (default), or long, roughly corresponding to 2–5, 6–10, or 11–18 content sections. Actual content and height depend on generation. Omit this field in webpage mode; sending it returns HTTP 400.

resolutionstringdefault: 1K

Supports 1K (default) and 2K, case-insensitive. Both resolutions support every ecommerce length, including long + 2K. Output widths are 1024 px and 2048 px respectively; height depends on content. 4K is not supported.

image_urlsstring[]

Only for ecommerce: 1–3 product images are required. Omit this field in webpage mode and use image_with_roles. Supply publicly accessible direct image URLs. For local files, use the image upload API and pass the returned url.

image_with_rolesobject[]

Only for webpage mode; optional. Provide at most one style image and one subject image. Either or both may be omitted. Omit this field in ecommerce mode.

Array item

urlstringrequired

A publicly accessible direct reference-image URL.

rolestringrequired

style guides visual and layout style; subject identifies the subject to preserve. Each role may appear only once.

ninteger

Each request generates one tall image. Omit this field or use the integer 1; other values return HTTP 400.

watermarkboolean

Omit this field or use false; true returns HTTP 400.

Warning

Do not send size, aspect_ratio, width, height, mask_url, sequential_image_generation, or sequential_image_generation_options. These fields return HTTP 400 even when set to null or an empty string.

Reference requirements and prompt markers

Supports JPG / JPEG / PNG. Each image must be at most 30 MB, at least 300 px in both dimensions, and have a ratio from 2:5 to 5:2. A URL returning HTTP 403 / 404 / 410, invalid dimensions or ratio, or an oversized file returns HTTP 400 synchronously, without creating a task or charging for generation. Other fetch failures, such as an origin timeout, are accepted initially; the task then fails and prepaid charges are refunded.

Use @Image1, @Image2, and so on in the prompt. Ecommerce numbers images in image_urls order; webpage numbers them in style-then-subject order. If only one role is supplied, its image is @Image1.

Request examples

Send these requests to POST /v1/images/generations. Replace example image URLs with accessible direct links.

Long ecommerce layout in 2K

bash
curl --request POST \
  --url https://api.apisea.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "kling-v4-long-image",
  "skill": "ecommerce",
  "prompt": "Create a long product detail page using the front view in @Image1, side view in @Image2, and close-up in @Image3. Include key features, materials, use scenes, and care instructions.",
  "image_urls": [
    "https://example.com/product-front.jpg",
    "https://example.com/product-side.jpg",
    "https://example.com/product-detail.png"
  ],
  "length": "long",
  "resolution": "2K"
}'

Webpage with style and subject references

bash
curl --request POST \
  --url https://api.apisea.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "kling-v4-long-image",
  "skill": "webpage",
  "prompt": "Design a product landing page using the visual style of @Image1 and preserving the product in @Image2. Include a hero section, features, and a call to action.",
  "image_with_roles": [
    {
      "url": "https://example.com/style.png",
      "role": "style"
    },
    {
      "url": "https://example.com/product.jpg",
      "role": "subject"
    }
  ],
  "resolution": "2K"
}'

Webpage from a prompt only

bash
curl --request POST \
  --url https://api.apisea.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "kling-v4-long-image",
  "skill": "webpage",
  "prompt": "Design a welcoming coffee shop webpage with warm colors, a hero section, a menu, and store information",
  "resolution": "1K"
}'

Query the task

Poll the task query API, preferably every 10 seconds. Keep the task_id and avoid duplicate generation requests during a long wait.

bash
curl --request GET \
  --url 'https://api.apisea.ai/v1/tasks/task_example_kling_v4_long_image' \
  --header 'Authorization: Bearer <token>'
Status (data.status)Handling
pending / processingContinue polling. data.cost is the prepaid amount and data.billing_status is held.
completedRead data.result.images[0].url[0]. data.billing_status is settled and data.cost is the final charge.
failedRead data.error.message. data.billing_status is refunded and data.cost is 0; prepaid charges are fully refunded.

The following illustrates a successful result. Both images and url are arrays; this model returns one tall image per request.

json
{
  "code": 200,
  "data": {
    "id": "task_example_kling_v4_long_image",
    "status": "completed",
    "progress": 100,
    "billing_status": "settled",
    "result": {
      "images": [
        {
          "url": [
            "https://example.com/generated-long-image.png"
          ],
          "expires_at": 1795331293
        }
      ]
    }
  }
}

Download the image before the Unix timestamp in seconds given by data.result.images[0].expires_at; the link expires afterward.

Note

Generation usually takes several minutes; one long + 2K sample took 432 seconds. estimated_time currently always returns 60 seconds and must not be used as a countdown or timeout threshold. Timing varies with content and service load; the sample is not an upper bound.

Image height and file size vary with content. One long + 2K sample was 2048×46615 and 63.9 MB; these are examples, not output limits. Results can exceed 50 MB, so account for large-image download and display costs.

Billing

Each request is billed for one tall image at the selected output tier, plus reference images: output tier price + reference count × reference image price. Product, style, and subject images all count; the first reference is also charged.

There are 8 output tiers below. Price keys are kling-v4-long-image@<tier> and kling-v4-long-image@input for references. These are billing tiers; the generation request still uses only 1K or 2K for resolution.

ModeLength1K2K
Product detail pageshort1K-SHORT2K-SHORT
Product detail pagemedium1K-MEDIUM2K-MEDIUM
Product detail pagelong1K-LONG2K-LONG
Webpage designOmit length1K-WEBPAGE2K-WEBPAGE

Charges are reserved at submission, settled on success, and fully refunded on failure. See the pricing page for rates and account discounts.

Common errors

These validation errors return HTTP 400 synchronously, without creating a task or charging for generation. Read error.message for submission errors and data.error.message for failures after task creation.

Error excerptResolution
`prompt` is required for kling-v4-long-imageProvide a non-empty prompt.
`skill` is required for kling-v4-long-imageProvide skill.
`skill` must be ecommerce or webpage for kling-v4-long-imageUse ecommerce or webpage.
skill=ecommerce on kling-v4-long-image requires 1 to 3 product images in `image_urls`Ecommerce requires 1–3 product images.
skill=ecommerce on kling-v4-long-image supports at most 3 product images in `image_urls`Provide no more than 3 product images.
`image_with_roles` is only for skill=webpage on kling-v4-long-imageFor ecommerce, use image_urls and omit image_with_roles.
`length` must be short, medium or long for kling-v4-long-imageUse short, medium, or long for ecommerce.
`length` only applies to skill=ecommerce for kling-v4-long-imageOmit length in webpage mode.
skill=webpage on kling-v4-long-image does not take `image_urls`For webpage, omit image_urls and use image_with_roles.
`image_with_roles[0].role` must be style or subject for kling-v4-long-imageUse only style or subject.
kling-v4-long-image supports at most 1 image with role styleProvide at most one image per role; duplicate subject images are also invalid.
`resolution` must be 1K or 2K for kling-v4-long-imageUse 1K or 2K.
`size` is not supported by kling-v4-long-imageRemove unsupported size, ratio, or series fields; do not send null or empty strings.
`n` is not supported by kling-v4-long-image: each request returns one long imageOmit n or use the integer 1.
reference image is not accessible for kling-v4-long-imageCheck public access and URL validity, including HTTP 403 / 404 / 410.
unsupported reference image dimensions for kling-v4-long-imageBoth dimensions must be at least 300 px, with a ratio from 2:5 to 5:2.
reference image too large for kling-v4-long-imageEach reference image must be at most 30 MB.

Risposte

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_example_kling_v4_long_image"
    }
  ]
}

Hai trovato un problema in questa documentazione? Scrivi a support@apisea.ai.