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

# Kling Image 4.0 长图

> Kling Image 4.0 长图 API 根据提示词和最多 3 张参考图，把整页网页或电商详情页设计成一张 1K 或 2K 宽的长图。

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

Kling Image 4.0 长图把整页设计成一张长图：网站页面（`skill: webpage`），或基于 1–3 张商品图的电商详情页（`skill: ecommerce`）。宽度由 `resolution` 决定，高度随内容变化，一次请求即可得到包含全部版块的完整页面效果图。

生成普通图片请使用 [Kling Image 4.0 文生图](https://docs.vidgo.ai/zh/api-manual/image-series/kwaivgi-kling-image-v4-0-text-to-image.md) 或 [Kling Image 4.0 图像编辑](https://docs.vidgo.ai/zh/api-manual/image-series/kwaivgi-kling-image-v4-0-edit.md)。

## 模型

* **kwaivgi/kling-image-v4.0/long-image** — 每次生成一张网页或电商详情页长图，宽 1K 或 2K。

## 功能

* 网页设计，可选风格参考图（`@StyleImage`）和主体参考图（`@SubjectImage`）。
* 基于 1–3 张商品图的电商详情页，三种长度（`short`、`medium`、`long`）。
* 1K（宽 1024 像素）或 2K（宽 2048 像素）输出，高度随内容变化。

## 输入模式

| `skill` | 输入 | 可选 |
| - | - | - |
| `webpage`（默认） | `prompt` | `style_image_url`、`subject_image_url`、`resolution` |
| `ecommerce` | `prompt`、`image_urls`（1–3 张商品图） | `length`、`resolution` |

## 必填参数

* `prompt` (string)：页面及各版块的描述。1–50,000 个字符的文本。用 `@Image1`–`@Image3` 引用商品图，用 `@StyleImage` 引用风格参考图，用 `@SubjectImage` 引用主体参考图。
* `image_urls` (string\[])：用于 `skill: ecommerce`，该模式下必填：1–3 张商品图，按顺序编号为 `@Image1`–`@Image3`。每张图片须是公开可访问的 HTTP(S) URL，最大 30 MB，宽和高都至少 300 像素，宽高比（宽 / 高）在 0.4 到 2.5 之间。

## 可选参数

* `skill` (string)：`webpage` 或 `ecommerce`。默认 `webpage`。
* `style_image_url` (string)：仅 `skill: webpage`。设计沿用这张图的视觉和版式风格（`@StyleImage`）。
* `subject_image_url` (string)：仅 `skill: webpage`。设计围绕这张图中的主体展开（`@SubjectImage`）。
* `length` (string)：仅 `skill: ecommerce`。`short`（约 2–5 个版块）、`medium`（约 6–10 个）或 `long`（约 11–18 个）。默认 `medium`。
* `resolution` (string)：`1K`（宽 1024 像素）或 `2K`（宽 2048 像素）。默认 `1K`。

## 输出

* 每次请求返回一张 PNG 长图。1K 网页通常约 1024x5800 像素；2K 长版电商详情页高度可超过 50,000 像素、体积超过 80 MB。
* 生成通常需要 1.5–4 分钟，2K 长版页面最长约 12 分钟。

## 示例

* **网页**：参照风格图设计的咖啡品牌官网，`2K`。
* **电商详情页**：基于一张商品图的 `medium` 长度详情页，`1K`。

## 注意事项

* 每种 skill 使用各自的字段：`skill: ecommerce` 使用 1–3 张 `image_urls` 和 `length`，`skill: webpage` 使用 `style_image_url` 和 `subject_image_url`。传入另一种 skill 的字段会返回 400。
* `model` 和 `callback_url` 放在请求根级，与 `input` 并列。`input` 接收上文列出的字段，其他字段返回 400。
* 每次请求按固定积分计费，取决于 `skill`、`length`（`ecommerce` 时）和 `resolution`，每张参考图（商品图、风格图或主体图）另有加价。任务失败会全额退还。当前费率见[定价页](https://vidgo.ai/apis/api-pricing)。


## OpenAPI

````yaml zh/api-manual/image-series/kwaivgi-kling-image-v4-0-long-image.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Kling Image 4.0 长图
  description: Kling Image 4.0 长图 API 根据提示词和最多 3 张参考图，把整页网页或电商详情页设计成一张 1K 或 2K 宽的长图。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境服务器
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Kling Image 4.0 Long Image
      summary: 提交 Kling Image 4.0 长图 任务
      operationId: submitKlingImage40LongImageTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              webpage:
                summary: 使用风格参考图的网页
                value:
                  model: kwaivgi/kling-image-v4.0/long-image
                  input:
                    skill: webpage
                    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.
                    style_image_url: https://cdn.vidgo.ai/temp/style-reference.png
                    resolution: 2K
              ecommerce:
                summary: 电商详情页
                value:
                  model: kwaivgi/kling-image-v4.0/long-image
                  input:
                    skill: ecommerce
                    prompt: >-
                      Design a product detail page for the insulated water
                      bottle in @Image1: hero shot, key features, capacity and
                      size, materials, and lifestyle scenes.
                    image_urls:
                      - https://cdn.vidgo.ai/temp/water-bottle.png
                    length: medium
                    resolution: 1K
      responses:
        '200':
          description: 任务提交结果。任务 ID 标识一项异步任务；生成可能仍在进行中。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          example: kwaivgi/kling-image-v4.0/long-image
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook URL，用于接收完成或失败通知。
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - prompt
          additionalProperties: false
          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: 使用公开可访问的 HTTP(S) 下载链接。
              description: >-
                skill 为 ecommerce 时的商品图，1–3 张（该模式必填）。按顺序编号为
                @Image1、@Image2、@Image3。


                每张图片须是公开可访问的 HTTP(S) URL，最大 30 MB，宽和高都至少 300 像素，宽高比（宽 / 高）在 0.4
                到 2.5 之间。
            style_image_url:
              type: string
              format: uri
              description: |-
                skill 为 webpage 时可选的风格参考图，用 @StyleImage 引用。设计沿用其视觉和版式风格。

                使用公开可访问的 HTTP(S) 下载链接，限制与 image_urls 相同。
            subject_image_url:
              type: string
              format: uri
              description: |-
                skill 为 webpage 时可选的主体参考图，用 @SubjectImage 引用。设计围绕图中主体展开。

                使用公开可访问的 HTTP(S) 下载链接，限制与 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
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-example-001
            status:
              type: string
              example: not_started
            created_time:
              type: string
              format: date-time
              example: '2026-11-19T10:30:00'
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: 错误信息。参见[错误码](/zh/api-manual/error-codes)。
          example: prompt is required
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '使用 `Authorization: Bearer VIDGO_API_KEY`。'

````

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