> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poyo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Kling Image 4.0 Long Image

> Kling Image 4.0 Long Image API 根据提示词把完整的网页或电商商品详情页设计成一张长图，可选商品图、风格参考图和主体参考图。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.poyo.ai/zh/api-manual/task-management/status.md)接口获取结果。

使用 `kling-4.0-long-image` 把完整的网站页面或电商商品详情页设计成一张长图，从首屏一直到页脚。适合落地页样稿、网站改版方案和网店商品详情页。Kling Image 4.0 Long Image 属于快手 Kling Image 4.0 系列。

## 模型

* **kling-4.0-long-image** — 网页和电商商品详情页的长图设计

## 功能

* 网页设计：在一张长图中呈现完整的网站版式，例如首屏、产品展示、品牌故事和页脚等区块。
* 电商商品详情页：围绕 1 到 3 张商品图设计，页面长度可选 short、medium 或 long。
* 网页设计支持风格参考图（`@StyleImage`）和主体参考图（`@SubjectImage`）。
* 输出 `1K`（1024 像素宽）或 `2K`（2048 像素宽），高度随内容变化。
* 输出 PNG。

## 输入模式

* **网页**（`skill`：`webpage`，默认）— 在 `prompt` 中描述网站及其各个区块。可选传入 `style_image_url`，让设计沿用它的视觉与版式风格（`@StyleImage`）；传入 `subject_image_url`，让设计围绕图中的主体展开（`@SubjectImage`）。
* **电商**（`skill`：`ecommerce`）— 在 `image_urls` 中传入 1 到 3 张商品图（`@Image1`、`@Image2`、`@Image3`），并在 `prompt` 中描述详情页。用 `length` 选择页面长度。

## 必填参数

* `prompt` (string)：描述页面及其各个区块的提示词，1–50,000 个字符，必须包含非空白文本。用 `@Image1`、`@Image2`、`@Image3` 指代商品图，用 `@StyleImage` 指代风格参考图，用 `@SubjectImage` 指代主体参考图。

## 可选参数

* `skill` (string)：`webpage` 或 `ecommerce`。默认为 `webpage`。
* `image_urls` (array of strings)：`ecommerce` 的商品图，1 到 3 个可公开访问的 HTTP(S) 图片 URL，该模式下必填。每张图片不超过 30 MB，宽和高至少 300 像素，宽高比（宽 / 高）在 0.4 到 2.5 之间。
* `style_image_url` (string)：`webpage` 的风格参考图 URL。设计会沿用它的视觉与版式风格。
* `subject_image_url` (string)：`webpage` 的主体参考图 URL。设计会围绕图中的主体展开。
* `length` (string)：`ecommerce` 的页面长度：`short`（约 2–5 个区块）、`medium`（约 6–10 个区块）或 `long`（约 11–18 个区块）。默认为 `medium`。
* `resolution` (string)：`1K` 或 `2K`。默认为 `1K`。

## 输出

* 在 `files` 中返回一张 PNG 长图。`1K` 时宽 1024 像素，`2K` 时宽 2048 像素；高度取决于内容和页面长度。
* 示例：`1K` 的 `webpage` 设计约为 1024×5848；`2K` 的 `ecommerce` `long` 页面可达 2048×54941（约 87 MB）。

## 示例

### 网页

参照参考图风格设计的咖啡品牌网站：

```json theme={"dark"}
{
  "model": "kling-4.0-long-image",
  "input": {
    "prompt": "Design a long image for a specialty coffee brand's official website, including the hero section, product showcase, roasting philosophy, store information, and footer. Follow the visual style of @StyleImage.",
    "skill": "webpage",
    "style_image_url": "https://example.com/style-reference.png",
    "resolution": "2K"
  }
}
```

### 电商详情页

根据一张商品图生成的中等长度商品详情页：

```json theme={"dark"}
{
  "model": "kling-4.0-long-image",
  "input": {
    "prompt": "Design a product detail page for the insulated water bottle in @Image1: hero shot, key features, capacity and size, materials, and lifestyle scenes.",
    "skill": "ecommerce",
    "image_urls": ["https://example.com/water-bottle.png"],
    "length": "medium",
    "resolution": "1K"
  }
}
```

## 注意事项

* `image_urls` 和 `length` 用于 `skill` 为 `ecommerce` 的请求；`style_image_url` 和 `subject_image_url` 用于 `skill` 为 `webpage` 的请求。
* 即使只有一张图，`image_urls` 也必须是数组。
* 每次请求生成一张图片。
* 长图通常需要约 2 到 12 分钟：网页设计和 `1K` 电商页面约 2 到 4 分钟，`2K` 的 `long` 电商页面最长约 12 分钟。请使用 `callback_url` 或轮询[查询任务状态](https://docs.poyo.ai/zh/api-manual/task-management/status.md)直到任务完成。
* 如需生成普通图片、编辑图片或生成组图，请使用 [Kling Image 4.0](https://docs.poyo.ai/zh/api-manual/image-series/kling-4-0-image.md)。


## OpenAPI

````yaml zh/api-manual/image-series/kling-4-0-long-image.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: PoYo AI - Kling Image 4.0 Long Image API
  description: Kling Image 4.0 Long Image API 根据提示词把完整的网页或电商商品详情页设计成一张长图，可选商品图、风格参考图和主体参考图。
  version: 1.0.0
servers:
  - url: https://api.poyo.ai
    description: 生产环境
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Kling Image 4.0 Long Image
      summary: 提交 Kling Image 4.0 Long Image 任务
      description: Kling Image 4.0 长图设计，用于网页和电商商品详情页。
      operationId: submitKlingImage40LongImageTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              webpage:
                summary: 网页
                value:
                  model: kling-4.0-long-image
                  input:
                    prompt: >-
                      Design a long image for a specialty coffee brand's
                      official website, including the hero section, product
                      showcase, roasting philosophy, store information, and
                      footer. Follow the visual style of @StyleImage.
                    skill: webpage
                    style_image_url: https://example.com/style-reference.png
                    resolution: 2K
              ecommerce:
                summary: 电商详情页
                value:
                  model: kling-4.0-long-image
                  input:
                    prompt: >-
                      Design a product detail page for the insulated water
                      bottle in @Image1: hero shot, key features, capacity and
                      size, materials, and lifestyle scenes.
                    skill: ecommerce
                    image_urls:
                      - https://example.com/water-bottle.png
                    length: medium
                    resolution: 1K
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权：API Key 无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          enum:
            - kling-4.0-long-image
          description: Kling Image 4.0 Long Image 模型标识。
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook URL，用于任务完成或失败时的通知。
        input:
          type: object
          additionalProperties: false
          required:
            - prompt
          description: >-
            生成一张长图：网页设计（skill 为 webpage），或根据 1–3 张商品图设计的电商商品详情页（skill 为
            ecommerce）。
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 50000
              description: >-
                描述页面及其各个区块的提示词，必须包含非空白文本。用 @Image1、@Image2、@Image3 指代商品图，用
                @StyleImage 指代风格参考图，用 @SubjectImage 指代主体参考图。
            skill:
              type: string
              enum:
                - webpage
                - ecommerce
              default: webpage
              description: 设计类型。webpage 设计网站页面；ecommerce 根据 image_urls 中的 1–3 张商品图设计商品详情页。
            image_urls:
              type: array
              minItems: 1
              maxItems: 3
              items:
                type: string
                format: uri
              description: >-
                skill 为 ecommerce 时的商品图 URL，1–3
                张（该模式必填）。即使只有一张图也必须是数组。图片按顺序编号：@Image1、@Image2、@Image3。每个 URL
                必须是可公开访问的 HTTP 或 HTTPS 地址，图片不超过 30 MB，宽和高至少 300 像素，宽高比（宽 / 高）在
                0.4 到 2.5 之间。
              example:
                - https://example.com/water-bottle.png
            style_image_url:
              type: string
              format: uri
              description: >-
                可选，skill 为 webpage 时的风格参考图，用 @StyleImage
                指代。设计会沿用它的视觉与版式风格。可公开访问的 HTTP 或 HTTPS 图片 URL，要求与 image_urls 相同。
            subject_image_url:
              type: string
              format: uri
              description: >-
                可选，skill 为 webpage 时的主体参考图，用 @SubjectImage
                指代。设计会围绕图中的主体展开。可公开访问的 HTTP 或 HTTPS 图片 URL，要求与 image_urls 相同。
            length:
              type: string
              enum:
                - short
                - medium
                - long
              default: medium
              description: >-
                skill 为 ecommerce 时的页面长度：short（约 2–5 个区块）、medium（约 6–10 个区块）或
                long（约 11–18 个区块）。
            resolution:
              type: string
              enum:
                - 1K
                - 2K
              default: 1K
              description: 输出宽度：1K 为 1024 像素宽，2K 为 2048 像素宽。高度随内容变化。
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
          description: >-
            业务状态码。`200` 表示成功，其他值都表示请求失败。请务必检查这个字段：部分参数校验错误会以 HTTP 200 返回，响应体里的
            `code` 为 `400`。


            - `200`：成功

            - `400`：请求参数无效

            - `401`：API Key 缺失或无效

            - `402`：积分不足

            - `403`：没有权限

            - `404`：资源不存在

            - `408`：请求超时

            - `429`：请求频率超限

            - `500`：服务器内部错误

            - `502`：上游服务错误

            - `503`：服务暂不可用


            详见[错误码](/zh/api-manual/error-codes)。
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-unified-1794470400-abcd1234
              description: 任务唯一标识，用于查询任务状态
            status:
              type: string
              enum:
                - not_started
                - running
                - finished
                - failed
              example: not_started
              description: >-
                任务状态。提交后立即返回时始终为
                `not_started`。后续状态请通过[查询任务状态](/zh/api-manual/task-management/status)接口或
                `callback_url` 获取。


                - `not_started`：排队中，等待处理

                - `running`：生成中

                - `finished`：已完成，结果在 `files` 或 `output` 中

                - `failed`：失败，详情见 `error_message`
            created_time:
              type: string
              format: date-time
              example: '2026-11-12T10:30:00'
              description: 任务创建时间，ISO 8601 格式
    ErrorResponse:
      type: object
      required:
        - code
        - error
      properties:
        code:
          type: integer
          example: 400
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          description: >-
            业务状态码。`200` 表示成功，其他值都表示请求失败。请务必检查这个字段：部分参数校验错误会以 HTTP 200 返回，响应体里的
            `code` 为 `400`。


            - `200`：成功

            - `400`：请求参数无效

            - `401`：API Key 缺失或无效

            - `402`：积分不足

            - `403`：没有权限

            - `404`：资源不存在

            - `408`：请求超时

            - `429`：请求频率超限

            - `500`：服务器内部错误

            - `502`：上游服务错误

            - `503`：服务暂不可用


            详见[错误码](/zh/api-manual/error-codes)。
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        所有 API 接口都需要 Bearer Token 认证。


        创建 API Key：登录 PoYo，进入 **仪表盘 → API
        密钥**（[poyo.ai/zh/dashboard/api-key](https://poyo.ai/zh/dashboard/api-key)），点击创建
        Key。


        在请求头中添加：


        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.