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

# Kling 4.0 Long Image

> Kling's image-to-image model for designing a single long image for a webpage or an e-commerce product detail page.

Poll the returned task URL to retrieve the image. See [Query Task Result](https://docs.modellix.ai/api/get-task-result.md).


## OpenAPI

````yaml /media-model-api/kling/kling-i2i.json post /kling/kling-4.0-long-image
openapi: 3.1.0
info:
  description: The image-to-image models API from Kling AI.
  version: 1.0.0
  contact:
    name: Modellix Support
    email: support@modellix.ai
  title: Kling Image-to-Image Models API
servers:
  - url: https://api.modellix.ai/api/v1
    description: The image-to-image models API from Kling AI.
security:
  - bearerAuth: []
paths:
  /kling/kling-4.0-long-image:
    post:
      summary: Kling 4.0 Long Image
      description: >-
        Kling's image-to-image model for designing a single long image for a
        webpage or an e-commerce product detail page.
      operationId: kling4LongImageAsync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Kling4LongImageRequest'
            examples:
              webpage:
                summary: Webpage With a Style Reference
                value:
                  skill: webpage
                  resolution: 2k
                  prompt: >-
                    Design a bakery landing page inspired by the colors and
                    layout of @id1.
                  images:
                    - image_url: >-
                        https://storage.googleapis.com/cloud-samples-data/generative-ai/image/scones.jpg
                      reference_type: style_refer_image
                      id: id1
              ecommerce:
                summary: Short Product Detail Page
                value:
                  skill: ecommerce
                  length: short
                  resolution: 4k
                  prompt: Design a short product detail page for these scones.
                  images:
                    - >-
                      https://storage.googleapis.com/cloud-samples-data/generative-ai/image/scones.jpg
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncTaskResponse'
              example:
                code: 0
                message: success
                data:
                  status: pending
                  task_id: task-kling-4-0-long-image-001
                  model_id: kling/kling-4.0-long-image
                  get_result:
                    method: GET
                    url: >-
                      https://api.modellix.ai/api/v1/tasks/task-kling-4-0-long-image-001
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 400
                message: >-
                  Invalid parameters: images[0].reference_type is required for
                  skill=webpage
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Kling4LongImageRequest:
      type: object
      required:
        - skill
        - images
      additionalProperties: false
      properties:
        skill:
          type: string
          enum:
            - ecommerce
            - webpage
          description: >-
            Select `ecommerce` for a product detail page or `webpage` for a
            webpage design.
        images:
          type: array
          minItems: 1
          description: >-
            For `webpage`, every image must be an object with `image_url` and
            `reference_type`. Use `style_refer_image` to guide the page's visual
            style or `subject_refer_image` for its subject. For `ecommerce`,
            each image can be a URL string or an image object. Use public
            HTTP(S) URLs without credentials, query strings, or fragments.
          items:
            oneOf:
              - type: string
                format: uri
              - $ref: '#/components/schemas/Kling4ImageReference'
        prompt:
          type: string
          pattern: \S
          description: >-
            Instructions for the layout, style, or content. Provide non-blank
            text when you include this field.
        resolution:
          type: string
          enum:
            - 2k
            - 4k
          description: Output resolution.
        length:
          type: string
          enum:
            - short
            - medium
            - long
          description: Optional length for `ecommerce`.
      if:
        properties:
          skill:
            const: webpage
        required:
          - skill
      then:
        properties:
          images:
            items:
              type: object
              required:
                - reference_type
          length: false
    AsyncTaskResponse:
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          type: integer
          description: Response code, 0 indicates success
          example: 0
        message:
          type: string
          description: Response message
          example: success
        data:
          type: object
          required:
            - status
            - task_id
            - model_id
          properties:
            status:
              type: string
              enum:
                - pending
                - processing
              description: Task status
              example: pending
            task_id:
              type: string
              description: Unique task identifier
              example: task-abc123
            model_id:
              type: string
              description: Model ID
              example: model-123
            get_result:
              type: object
              description: API information to query the task result
              properties:
                method:
                  type: string
                  description: HTTP method
                  example: GET
                url:
                  type: string
                  description: Full URL to query the task result
                  example: https://api.modellix.ai/api/v1/tasks/task-abc123
          description: Detailed data about the submitted asynchronous task.
    ErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: Error code (equals HTTP status code)
          example: 400
        message:
          type: string
          description: 'Error message in format ''Category: detail'''
          example: 'Invalid parameters: parameter ''image'' is required'
    Kling4ImageReference:
      type: object
      required:
        - image_url
      additionalProperties: false
      properties:
        image_url:
          type: string
          format: uri
          description: Public URL of the reference image.
        reference_type:
          type: string
          enum:
            - refer_image
            - style_refer_image
            - subject_refer_image
          description: Role of the reference image.
        id:
          type: string
          pattern: \S
          description: >-
            Optional image identifier. Refer to it in `prompt` with `@id`, for
            example `@id1`.
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API Key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 401
            message: 'Authentication failed: invalid API key'
    TooManyRequests:
      description: Too many requests - Rate limit exceeded
      headers:
        X-RateLimit-Limit:
          description: Maximum requests per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Remaining quota in current window
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset:
          description: Rate limit window reset time (Unix timestamp)
          schema:
            type: integer
            example: 1704067260
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 429
            message: >-
              Rate limit exceeded: 100 requests per minute, retry after 60
              seconds
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 500
            message: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API Key authentication. Format: `Bearer YOUR_API_KEY`.'

````

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