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

# Kling 4.0 Reference to Video

> Kling 4.0 reference-to-video. Guide generation with up to **10 reference images** (style, scene, subject) and up to **5 reference videos** (motion, camera work and other features to imitate — the videos are not edited). Single takes of up to **30 seconds**.

**Audio** — every generated video comes with a native audio track. It is always on: the model has no switch for it, so `sound` / `generate_audio` are rejected.

Refer to your assets in `prompt` as `<<<image_1>>>`, `<<<image_2>>>`, `<<<video_1>>>` …, numbered from 1 in the order of `image_urls` and `video_urls`. At least one image or video is required.

**Pricing** — in tokens (USD at $0.02/token). With reference images only, the price is the same as Kling 4.0 and only the generated seconds are billed. With reference videos, a lower per-second rate applies to **output seconds + max(total reference video seconds, output seconds)**:

| references | resolution | tokens/s | USD/s | billed seconds |
|---|---|---|---|---|
| images only | 720p | 10.205 | $0.2041 | output |
| images only | 1080p | 15.275 | $0.3055 | output |
| with reference videos | 720p | 6.11 | $0.1222 | output + max(reference videos, output) |
| with reference videos | 1080p | 9.165 | $0.1833 | output + max(reference videos, output) |

The total reference video length is measured from your files before any tokens are charged, and rounded up to a whole second. Reference images are not charged.

Examples at 720p:

- 5 seconds with reference images only: 51.03 tokens (= $1.0206)
- 5 seconds with an 8-second reference video: 13 billed seconds, 79.43 tokens (= $1.5886)
- 10 seconds with a 5-second reference video: 20 billed seconds, 122.2 tokens (= $2.444)

Returns an `img_uuid`; poll GET /api/v1/jobs/detail (or use `custom_callback_url`) to get the generated video.

**Not accepted by this model** (rejected before any tokens are charged): `image_url` / `image_end_url` / `keyframes` (use [Kling 4.0](/api-reference/video-generations/kling-4-0) for first, middle and last frames), `sound` / `generate_audio` (audio is always generated), `negative_prompt` (describe what to avoid in `prompt`), `model_params.multi_shot`, and 4K.



## OpenAPI

````yaml api-reference/video-generations/openapi-kling-4-0-refs.json POST /api/v1/videos/generations
openapi: 3.1.0
info:
  title: GoEnhance API - Kling 4.0 Reference to Video
  description: >-
    Video generation with Kling 4.0 Reference to Video. Same endpoint as the
    other Kling models; the model is selected by model.
  version: 1.0.0
servers:
  - url: https://api.goenhance.ai
security: []
paths:
  /api/v1/videos/generations:
    post:
      tags:
        - VideoGenerations
      summary: Kling 4.0 Reference to Video
      description: >-
        Kling 4.0 reference-to-video. Guide generation with up to **10 reference
        images** (style, scene, subject) and up to **5 reference videos**
        (motion, camera work and other features to imitate — the videos are not
        edited). Single takes of up to **30 seconds**.


        **Audio** — every generated video comes with a native audio track. It is
        always on: the model has no switch for it, so `sound` / `generate_audio`
        are rejected.


        Refer to your assets in `prompt` as `<<<image_1>>>`, `<<<image_2>>>`,
        `<<<video_1>>>` …, numbered from 1 in the order of `image_urls` and
        `video_urls`. At least one image or video is required.


        **Pricing** — in tokens (USD at $0.02/token). With reference images
        only, the price is the same as Kling 4.0 and only the generated seconds
        are billed. With reference videos, a lower per-second rate applies to
        **output seconds + max(total reference video seconds, output seconds)**:


        | references | resolution | tokens/s | USD/s | billed seconds |

        |---|---|---|---|---|

        | images only | 720p | 10.205 | $0.2041 | output |

        | images only | 1080p | 15.275 | $0.3055 | output |

        | with reference videos | 720p | 6.11 | $0.1222 | output + max(reference
        videos, output) |

        | with reference videos | 1080p | 9.165 | $0.1833 | output +
        max(reference videos, output) |


        The total reference video length is measured from your files before any
        tokens are charged, and rounded up to a whole second. Reference images
        are not charged.


        Examples at 720p:


        - 5 seconds with reference images only: 51.03 tokens (= $1.0206)

        - 5 seconds with an 8-second reference video: 13 billed seconds, 79.43
        tokens (= $1.5886)

        - 10 seconds with a 5-second reference video: 20 billed seconds, 122.2
        tokens (= $2.444)


        Returns an `img_uuid`; poll GET /api/v1/jobs/detail (or use
        `custom_callback_url`) to get the generated video.


        **Not accepted by this model** (rejected before any tokens are charged):
        `image_url` / `image_end_url` / `keyframes` (use [Kling
        4.0](/api-reference/video-generations/kling-4-0) for first, middle and
        last frames), `sound` / `generate_audio` (audio is always generated),
        `negative_prompt` (describe what to avoid in `prompt`),
        `model_params.multi_shot`, and 4K.
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: '{{Authorization}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: >-
                Kling 4.0 reference-to-video (reference images and / or
                reference videos).


                **Pricing** — per billed second:


                - 720p, images only — 10.205 tokens ($0.2041)

                - 1080p, images only — 15.275 tokens ($0.3055)

                - 720p, with reference videos — 6.11 tokens ($0.1222)

                - 1080p, with reference videos — 9.165 tokens ($0.1833)
              properties:
                model:
                  type: string
                  enum:
                    - kling-4-0-refs
                  description: Model name. Must be `kling-4-0-refs` on this page.
                prompt:
                  type: string
                  maxLength: 2500
                  description: >-
                    Text prompt. Required, up to 2500 characters. Refer to
                    assets as `<<<image_1>>>` / `<<<video_1>>>` (numbered from 1
                    by array order); a number with no matching asset is
                    rejected.
                image_urls:
                  type: array
                  maxItems: 10
                  items:
                    type: string
                    format: uri
                  description: >-
                    Reference image URLs (up to 10), used as style, scene or
                    subject references. `<<<image_1>>>` is the first item.


                    Up to 10MB each, width and height at least 300px. Smaller
                    images are upscaled automatically.
                video_urls:
                  type: array
                  maxItems: 5
                  items:
                    type: string
                    format: uri
                  description: >-
                    Reference video URLs (up to 5). `<<<video_1>>>` is the first
                    item. Each video must be at least 3 seconds, and all videos
                    together at most 30 seconds. MP4 or MOV, up to 200MB, width
                    and height each 720-2160px, 24-60fps.


                    Adding reference videos switches billing to output +
                    max(reference videos, output) seconds at the reference-video
                    rate (see Pricing).
                duration:
                  type: integer
                  minimum: 3
                  maximum: 30
                  default: 5
                  description: Output duration in seconds, any integer from 3 to 30.
                resolution:
                  type: string
                  enum:
                    - 720p
                    - 1080p
                  default: 720p
                  description: >-
                    Output resolution. `quality` is accepted as a compatible
                    alias.
                ratio:
                  type: string
                  enum:
                    - '16:9'
                    - '9:16'
                    - '1:1'
                    - '21:9'
                  default: '16:9'
                  description: Aspect ratio of the output.
                custom_callback_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. A publicly accessible HTTPS URL. When the task
                    status changes (processing / success / failed), GoEnhance
                    sends a POST request to this URL. The request body is
                    identical to the response of GET /api/v1/jobs/detail. If
                    your server does not respond with HTTP 200, the notification
                    is retried up to 3 times, with a 3-second timeout per
                    attempt.
                  example: https://your-server.com/goenhance/callback
              required:
                - model
                - prompt
            example:
              model: kling-4-0-refs
              prompt: >-
                The woman in <<<image_1>>> dances in a snowy forest, following
                the moves and camera of <<<video_1>>>
              image_urls:
                - https://your-cdn.com/character.jpg
              video_urls:
                - https://your-cdn.com/dance-reference.mp4
              duration: 10
              ratio: '9:16'
              resolution: 720p
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                  data:
                    type: object
                    properties:
                      img_uuid:
                        type: string
                      cost:
                        type: number
                        description: >-
                          Tokens deducted for this request. This is the amount
                          actually charged, so it already reflects any discount
                          active on your account and can be lower than the
                          listed price. Tokens are deducted when the task is
                          accepted, and refunded automatically if the generation
                          ends in failure.
                        example: 5.82
                    required:
                      - img_uuid
                      - cost
                required:
                  - code
                  - msg
                  - data
              examples:
                '1':
                  summary: Success
                  value:
                    code: 0
                    msg: Success
                    data:
                      img_uuid: c12b656c-747a-44fd-9c80-add79b0c52d5
                      cost: 5.82
                '2':
                  summary: Insufficient tokens
                  value:
                    code: 100
                    msg: tokens is not enough
                quota:
                  summary: API key quota exceeded
                  value:
                    code: 101
                    msg: 'API key quota exceeded: 4990 of 5000 tokens used (monthly)'
          headers: {}
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                required:
                  - code
                  - msg
              examples:
                '1':
                  summary: Unauthorized
                  value:
                    code: 401
                    msg: Unauthorized
          headers: {}
      deprecated: false
      security: []

````

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