> ## 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 4.0 Flash

> Generate fast 720p videos of 3–20 seconds from text, a start frame, or visual references, and edit an existing video.

> [!TIP]
>
> 1. After submission, a `task_id` will be returned. If you provided a `callback_url`, when the task status becomes `finished` or `failed`, a POST request will be sent to the `callback_url`.
> 2. Regardless of whether `callback_url` is provided, you can retrieve the response result through the unified [Query Task Status](https://docs.poyo.ai/api-manual/task-management/status.md) endpoint.

Kling 4.0 Flash is the faster 720p tier of [Kling 4.0](https://docs.poyo.ai/api-manual/video-series/kling-4-0.md). It creates videos from text, animates a starting frame, combines visual references, or edits an existing video. The supplied media selects the mode automatically.

## Models

* **kling-4.0-flash** — Text-to-video, image-to-video, reference-to-video, and video editing at `720p`

## Features

* **Fast 720p output**: Generate 3–20 second videos at `720p`.
* **Starting frame**: Animate one starting image. Flash does not accept an ending frame.
* **Visual references**: Guide appearance and movement with reference images, reference videos, and subjects defined by images or a video.
* **Video editing**: Supply a source video and describe the changes. Editing also accepts reference images, reference videos, and subjects. Omit `duration` to retain the source video's duration.
* **Aspect ratios**: Use `16:9`, `9:16`, `1:1`, `21:9`, or `auto` in text and reference modes.

## Input modes

| Mode | Selected when |
| - | - |
| Video editing | `video_url` is provided |
| Reference-to-video | Reference images, reference videos, or `kling_elements` are non-empty |
| Image-to-video | `image_urls` is non-empty without reference materials |
| Text-to-video | No media is provided |

In reference mode, `image_urls` may contain one optional starting frame. In image mode, `prompt` is optional; omit `aspect_ratio`, because the output follows the starting frame's aspect ratio. Editing does not accept `image_urls` or `aspect_ratio`; the output follows the source video's aspect ratio.

## Required parameters

* `prompt` (string): Video instructions, 1–26,000 characters, containing at least one non-whitespace character. Required in every mode except image-to-video, where it is optional.

## Optional parameters

* `duration` (integer): Output duration from 3 to 20 seconds. Generation defaults to `5`. In editing, omit this field to retain the source video's duration; chargeable output duration is rounded up to whole seconds.
* `resolution` (string): `720p` only. Default: `720p`.
* `aspect_ratio` (string): `auto`, `16:9`, `9:16`, `1:1`, or `21:9`, for text and reference modes. Default: `16:9`. In text-to-video, `auto` is treated as `16:9`; in reference mode, `auto` adapts to the supplied materials. Omit this field in image and editing modes.
* `image_urls` (array of strings): One starting image.
* `video_url` (string): Source video for editing. Must last 3–20 seconds.
* `reference_image_urls` (array of strings): Up to 10 publicly accessible HTTP or HTTPS image URLs.
* `reference_video_urls` (array of strings): Publicly accessible HTTP or HTTPS video URLs, each lasting 3–20 seconds. Up to 5 in reference mode and up to 4 in editing mode.
* `kling_elements` (array of objects): Up to 7 subjects. Each subject supplies exactly one of:
  * `element_input_urls` (array of strings): 2–4 images, with the frontal view first and additional reference views after it.
  * `element_input_video_urls` (array of strings): Exactly one 3–8 second video. At most 3 subjects may use videos.

Subjects use their positions in the array and require no names. Refer to them as `@Element1`, `@Element2`, and so on. Reference images use `@Image1`, `@Image2`, and so on. In reference mode, reference videos start at `@Video1`; in editing mode, the source video is `@Video1` and reference videos start at `@Video2`. Existing `@image_1` and `@video_1` references remain supported.

## Examples

### Text to Video

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "callback_url": "https://your-domain.com/callback",
  "input": {
    "prompt": "A paper boat drifts through a miniature city at sunset, slow camera push-in",
    "duration": 5,
    "aspect_ratio": "16:9"
  }
}
```

### Image to Video

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "The red panda shakes the snow off its fur and turns toward the camera",
    "image_urls": ["https://example.com/start-frame.png"],
    "duration": 5
  }
}
```

### Reference Images and Subjects

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "@Element1 walks along the cliff path toward the lighthouse in @Image1 at golden hour",
    "reference_image_urls": ["https://example.com/lighthouse.png"],
    "kling_elements": [
      {
        "element_input_urls": [
          "https://example.com/keeper-front.png",
          "https://example.com/keeper-side.png"
        ]
      }
    ],
    "duration": 8,
    "aspect_ratio": "9:16"
  }
}
```

### Reference Videos

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "Follow the camera movement of @Video1 in the snowy mountain scene from @Image1",
    "reference_image_urls": ["https://example.com/mountain.png"],
    "reference_video_urls": ["https://example.com/camera-motion.mp4"],
    "duration": 8,
    "aspect_ratio": "16:9"
  }
}
```

### Video Editing

```json theme={"dark"}
{
  "model": "kling-4.0-flash",
  "input": {
    "prompt": "Change the season in @Video1 to spring using @Image1, keeping the motion and camera",
    "video_url": "https://example.com/source.mp4",
    "reference_image_urls": ["https://example.com/spring.png"]
  }
}
```

## Notes

* In reference mode, the optional starting frame and reference images together cannot exceed 10 images. The number of starting frames, reference images, reference videos, and subjects combined cannot exceed 15. Images inside a subject count as one subject, not as separate materials.
* The source video, reference videos, and video-based subjects must have a combined original duration of at most 20 seconds. Each source or reference video must last 3–20 seconds, and each subject video 3–8 seconds.
* Flash does not support `1080p`, ending frames, or `multi_prompt`. Use [Kling 4.0](https://docs.poyo.ai/api-manual/video-series/kling-4-0.md) for these.
* Reference indexes start at 1 and follow the order of the corresponding input array. Use publicly accessible media URLs and omit unused optional fields.


## OpenAPI

````yaml api-manual/video-series/kling-4-0-flash.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Kling 4.0 Flash
  description: >-
    Generate fast 720p videos from text, a start frame, or visual references,
    and edit an existing video.
  version: 1.0.0
servers:
  - url: https://api.poyo.ai
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      summary: Submit a Kling 4.0 Flash video task
      operationId: submit_kling_4_0_flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              text-to-video:
                summary: Generate video from a text prompt
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: A paper boat floats through a miniature city at sunset.
              image-to-video:
                summary: Animate a starting image
                value:
                  model: kling-4.0-flash
                  input:
                    image_urls:
                      - https://example.com/start.png
                    prompt: The camera slowly pushes in as the lanterns flicker.
                    duration: 10
              reference-image:
                summary: Guide the video with a reference image
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: >-
                      The character in @Image1 walks along a sunlit forest
                      trail.
                    reference_image_urls:
                      - https://example.com/character.png
                    aspect_ratio: '9:16'
              reference-video:
                summary: Guide movement with a reference video
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: >-
                      Recreate the camera movement from @Video1 in a snowy
                      mountain landscape.
                    reference_video_urls:
                      - https://example.com/camera-motion.mp4
                    duration: 8
              image-subject:
                summary: Guide a subject with a frontal view and reference views
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: '@Element1 walks through the city square shown in @Image1.'
                    reference_image_urls:
                      - https://example.com/square.png
                    kling_elements:
                      - element_input_urls:
                          - https://example.com/character-front.png
                          - https://example.com/character-side.png
              video-edit:
                summary: Edit a video while retaining its original duration
                value:
                  model: kling-4.0-flash
                  input:
                    prompt: >-
                      Replace the background of @Video1 with a snowy mountain
                      landscape while keeping the camera movement.
                    video_url: https://example.com/source.mp4
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - kling-4.0-flash
          description: Public model identifier.
        callback_url:
          type: string
          format: uri
          description: Optional webhook URL for task completion or failure notifications.
          example: https://your-domain.com/callback
        input:
          type: object
          additionalProperties: false
          description: >-
            Selects editing when video_url is supplied, reference-to-video when
            reference images, reference videos, or subjects are supplied,
            image-to-video when only image_urls is supplied, and text-to-video
            otherwise. All media URLs must be publicly accessible HTTP or HTTPS
            URLs.
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 26000
              description: >-
                Video instructions containing at least one non-whitespace
                character. Required in every mode except image-to-video, where
                it is optional. Reference images, videos, and subjects as
                @Image1, @Video1, and @Element1 in array order. In editing, the
                source video is @Video1 and reference videos start at @Video2.
                Existing @image_1 and @video_1 references remain supported.
              example: >-
                A paper boat drifts through a miniature city at sunset, slow
                camera push-in
            duration:
              type: integer
              minimum: 3
              maximum: 20
              description: >-
                Output duration in whole seconds. Generation defaults to 5
                seconds. In editing, omit this field to retain the source video
                duration; chargeable output duration is rounded up to whole
                seconds.
              example: 5
            resolution:
              type: string
              enum:
                - 720p
              default: 720p
              description: Output video resolution. Flash supports 720p only.
              example: 720p
            aspect_ratio:
              type: string
              enum:
                - auto
                - '16:9'
                - '9:16'
                - '1:1'
                - '21:9'
              default: '16:9'
              description: >-
                Output aspect ratio for text and reference modes. Defaults to
                16:9. In text-to-video, auto is treated as 16:9; in reference
                mode, auto adapts to the supplied materials. Do not provide this
                field in image or editing modes; those modes follow the aspect
                ratio of the starting frame or source video.
              example: '16:9'
            reference_image_urls:
              type: array
              maxItems: 10
              items:
                type: string
                format: uri
              description: >-
                Up to 10 publicly accessible HTTP or HTTPS reference images.
                Reference them as @Image1, @Image2, and so on. In reference
                mode, these images and the optional starting frame together
                cannot exceed 10 images. Supported in reference and editing
                modes.
              example:
                - https://example.com/reference-image.png
            reference_video_urls:
              type: array
              maxItems: 5
              x-video-duration-seconds:
                minimum: 3
                maximum: 20
              items:
                type: string
                format: uri
              description: >-
                Publicly accessible HTTP or HTTPS reference videos, each lasting
                3-20 seconds. Up to 5 in reference mode, referenced as @Video1,
                @Video2, and so on; up to 4 in editing mode, referenced as
                @Video2, @Video3, and so on. All input videos together must not
                exceed 20 seconds.
              example:
                - https://example.com/reference-video.mp4
            image_urls:
              type: array
              maxItems: 1
              items:
                type: string
                format: uri
              description: >-
                One publicly accessible HTTP or HTTPS starting frame. Flash does
                not accept an ending frame. Without references, selects
                image-to-video. In reference mode, the starting frame counts
                toward the 10-image and 15-material limits. Do not provide this
                field in editing mode.
              minItems: 1
              example:
                - https://example.com/start-frame.png
            video_url:
              type: string
              format: uri
              x-video-duration-seconds:
                minimum: 3
                maximum: 20
              description: >-
                Publicly accessible HTTP or HTTPS source video for editing,
                lasting 3-20 seconds. Selects editing mode. Supports reference
                images, reference videos, and subjects; cannot be combined with
                image_urls or aspect_ratio.
              example: https://example.com/source.mp4
            kling_elements:
              type: array
              maxItems: 7
              items:
                type: object
                additionalProperties: false
                minProperties: 1
                maxProperties: 1
                description: >-
                  Provide exactly one of element_input_urls and
                  element_input_video_urls. Subjects use array positions, such
                  as @Element1, and require no names.
                properties:
                  element_input_urls:
                    type: array
                    maxItems: 4
                    items:
                      type: string
                      format: uri
                    description: >-
                      Publicly accessible HTTP or HTTPS images of this subject:
                      frontal view first, followed by 1-3 additional reference
                      views.
                    minItems: 2
                  element_input_video_urls:
                    type: array
                    maxItems: 1
                    x-video-duration-seconds:
                      minimum: 3
                      maximum: 8
                    items:
                      type: string
                      format: uri
                    description: >-
                      Exactly one publicly accessible HTTP or HTTPS subject
                      video lasting 3-8 seconds. At most 3 subjects may use
                      videos.
                    minItems: 1
              description: >-
                Up to 7 position-based subjects. Use @Element1, @Element2, and
                so on in the prompt. At most 3 subjects may use videos.
                Supported in reference and editing modes. In reference mode,
                starting frames, reference images, reference videos, and
                subjects combined cannot exceed 15 materials; images inside a
                subject count as one subject.
              example:
                - element_input_urls:
                    - https://example.com/subject-front.png
                    - https://example.com/subject-side.png
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          description: >-
            Business status code. `200` means success; any other value means the
            request failed. Always check this field: some validation errors
            return HTTP 200 with `code: 400` in the body.


            - `200`: Success

            - `400`: Invalid request parameters

            - `401`: Missing or invalid API key

            - `402`: Insufficient credits

            - `403`: Permission denied

            - `404`: Resource not found

            - `408`: Request timeout

            - `429`: Rate limit exceeded

            - `500`: Internal server error

            - `502`: Upstream service error

            - `503`: Service unavailable


            See [Error Codes](/api-manual/error-codes) for details.
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-unified-1792741800-example
            status:
              type: string
              enum:
                - not_started
                - running
                - finished
                - failed
              example: not_started
              description: >-
                Task status. Always `not_started` right after submission. Use
                [Query Task Status](/api-manual/task-management/status) or
                `callback_url` to get later states.


                - `not_started`: Queued, waiting to be processed

                - `running`: Being generated

                - `finished`: Completed; results are in `files` or `output`

                - `failed`: Failed; details are in `error_message`
            created_time:
              type: string
              format: date-time
              example: '2026-10-23T10:30:00'
    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: >-
            Business status code. `200` means success; any other value means the
            request failed. Always check this field: some validation errors
            return HTTP 200 with `code: 400` in the body.


            - `200`: Success

            - `400`: Invalid request parameters

            - `401`: Missing or invalid API key

            - `402`: Insufficient credits

            - `403`: Permission denied

            - `404`: Resource not found

            - `408`: Request timeout

            - `429`: Rate limit exceeded

            - `500`: Internal server error

            - `502`: Upstream service error

            - `503`: Service unavailable


            See [Error Codes](/api-manual/error-codes) for details.
        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: >-
        All API endpoints require Bearer Token authentication.


        Create an API key: sign in to PoYo, open **Dashboard → API Key** at
        [poyo.ai/dashboard/api-key](https://poyo.ai/dashboard/api-key), and
        click to create a key.


        Add it to the request header:


        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````

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