> ## 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 Video Edit

> Kling 4.0 video edit. Change an existing clip with a prompt — swap outfits, restyle the scene, regrade the colors — optionally guided by up to **10 style reference images**. The output keeps the aspect ratio and the original audio of your video.

Refer to the source video in `prompt` as `<<<video_1>>>` and to reference images as `<<<image_1>>>`, `<<<image_2>>>` … in the order of `image_urls`.

**Pricing** — in tokens (USD at $0.02/token), billed on **output seconds + max(source video seconds, output seconds)**:

| resolution | tokens/s | USD/s |
|---|---|---|
| 720p | 6.11 | $0.1222 |
| 1080p | 9.165 | $0.1833 |

The source video length is measured from your file before any tokens are charged, and rounded up to a whole second. With the default `duration: "auto"` the output is as long as the source, so a request is billed for twice the source length. Reference images are not charged.

Examples at 720p:

- 5-second source, `duration` auto: 10 billed seconds, 61.1 tokens (= $1.222)
- 10-second source, `duration` 20: 40 billed seconds, 244.4 tokens (= $4.888)

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

**Not accepted by this model** (rejected before any tokens are charged): `ratio` / `aspect_ratio` (the output follows the source video), `sound` / `generate_audio` (the output always keeps the audio of your video), `negative_prompt`, `image_url` / `image_end_url` / `keyframes`, and 4K.



## OpenAPI

````yaml api-reference/video-generations/openapi-kling-4-0-edit.json POST /api/v1/videos/generations
openapi: 3.1.0
info:
  title: GoEnhance API - Kling 4.0 Video Edit
  description: >-
    Video generation with Kling 4.0 Video Edit. 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 Video Edit
      description: >-
        Kling 4.0 video edit. Change an existing clip with a prompt — swap
        outfits, restyle the scene, regrade the colors — optionally guided by up
        to **10 style reference images**. The output keeps the aspect ratio and
        the original audio of your video.


        Refer to the source video in `prompt` as `<<<video_1>>>` and to
        reference images as `<<<image_1>>>`, `<<<image_2>>>` … in the order of
        `image_urls`.


        **Pricing** — in tokens (USD at $0.02/token), billed on **output seconds
        + max(source video seconds, output seconds)**:


        | resolution | tokens/s | USD/s |

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

        | 720p | 6.11 | $0.1222 |

        | 1080p | 9.165 | $0.1833 |


        The source video length is measured from your file before any tokens are
        charged, and rounded up to a whole second. With the default `duration:
        "auto"` the output is as long as the source, so a request is billed for
        twice the source length. Reference images are not charged.


        Examples at 720p:


        - 5-second source, `duration` auto: 10 billed seconds, 61.1 tokens (=
        $1.222)

        - 10-second source, `duration` 20: 40 billed seconds, 244.4 tokens (=
        $4.888)


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


        **Not accepted by this model** (rejected before any tokens are charged):
        `ratio` / `aspect_ratio` (the output follows the source video), `sound`
        / `generate_audio` (the output always keeps the audio of your video),
        `negative_prompt`, `image_url` / `image_end_url` / `keyframes`, 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 video edit (one source video, optional style reference
                images).


                **Pricing** — per billed second (output + max(source, output)):


                - 720p — 6.11 tokens ($0.1222)

                - 1080p — 9.165 tokens ($0.1833)
              properties:
                model:
                  type: string
                  enum:
                    - kling-4-0-edit
                  description: Model name. Must be `kling-4-0-edit` on this page.
                prompt:
                  type: string
                  maxLength: 2500
                  description: >-
                    Editing instructions. Required, up to 2500 characters. Refer
                    to the source video as `<<<video_1>>>` and to reference
                    images as `<<<image_1>>>` …; a number with no matching asset
                    is rejected.
                video_urls:
                  type: array
                  minItems: 1
                  maxItems: 1
                  items:
                    type: string
                    format: uri
                  description: >-
                    The video to edit — exactly one URL. 3 to 30 seconds. MP4 or
                    MOV, up to 200MB, width and height each 720-2160px,
                    24-60fps.
                image_urls:
                  type: array
                  maxItems: 10
                  items:
                    type: string
                    format: uri
                  description: >-
                    Optional style reference image URLs (up to 10).
                    `<<<image_1>>>` is the first item.


                    Up to 10MB each, width and height at least 300px. Smaller
                    images are upscaled automatically.
                duration:
                  oneOf:
                    - type: integer
                      minimum: 3
                      maximum: 30
                    - type: string
                      enum:
                        - auto
                  default: auto
                  description: >-
                    Output duration: `"auto"` (default) matches the source
                    video, or any integer from 3 to 30 seconds. Billing uses
                    output + max(source, output) seconds.
                resolution:
                  type: string
                  enum:
                    - 720p
                    - 1080p
                  default: 720p
                  description: >-
                    Output resolution. `quality` is accepted as a compatible
                    alias.
                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
                - video_urls
            example:
              model: kling-4-0-edit
              prompt: >-
                Replace the coat worn by the person in <<<video_1>>> with the
                style in <<<image_1>>>
              video_urls:
                - https://your-cdn.com/original.mp4
              image_urls:
                - https://your-cdn.com/coat-style.jpg
              resolution: 1080p
      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.