> ## 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 4.0 Text to Video

> The Kling 4.0 Text to Video API generates 3–30 second videos from a prompt or multi-shot prompts at 720p or 1080p, with stereo audio and five aspect ratios.

> [!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 result through the unified [Query Task Status](https://docs.vidgo.ai/api-manual/task-management/status.md) endpoint.

Kling 4.0 Text to Video generates a 3–30 second video from a single prompt or from a multi-shot script, at 720p or 1080p, with an audio track in the output. Use it for single-take ads, short-drama scenes and social clips when you have no source image.

Kling 4.0 is Kuaishou's Kling AI video model. Vidgo exposes it as four model IDs: [Text to Video](https://docs.vidgo.ai/api-manual/video-series/kwaivgi-kling-v4-0-text-to-video.md), [Image to Video](https://docs.vidgo.ai/api-manual/video-series/kwaivgi-kling-v4-0-image-to-video.md), [Reference to Video](https://docs.vidgo.ai/api-manual/video-series/kwaivgi-kling-v4-0-reference-to-video.md) and [Video Edit](https://docs.vidgo.ai/api-manual/video-series/kwaivgi-kling-v4-0-video-edit.md).

## Models

* **kwaivgi/kling-v4.0/text-to-video** — Text-to-video with Kling 4.0, 3–30 seconds, single or multi-shot prompts, 720p or 1080p.

## Features

* Text-to-video up to 30 seconds in one pass.
* Multi-shot prompts with per-shot durations via `multi_prompt`.
* 720p or 1080p output.
* Five aspect ratios: `auto`, `16:9`, `9:16`, `1:1`, `21:9`.
* Output includes an audio track; describe dialogue, sound effects or ambience in the prompt.

## Input modes

* **Single prompt**: send `prompt` and, optionally, `duration`.
* **Multi-shot**: send `multi_prompt` with one entry per shot. The clip length is the sum of the shot durations; leave `duration` out or set it to that sum.

## Required parameters

* `prompt` (string) **or** `multi_prompt` (object\[]): send exactly one.
  * `prompt`: 1–26,000 characters after trimming.
  * `multi_prompt`: a non-empty list of shots `{prompt, duration?}`. Each shot `prompt` is 1–512 characters; each shot `duration` is an integer `1`–`30` (default `5`). The shot durations must total 3–30 seconds.

## Optional parameters

* `duration` (integer): Output length, `3`–`30` seconds. Default `5`; with `multi_prompt` the default is the shot total, and an explicit value must equal it.
* `resolution` (string): `720p` or `1080p`. Default `720p`.
* `aspect_ratio` (string): `auto`, `16:9`, `9:16`, `1:1` or `21:9`. Default `auto`.

## Output

The finished task returns one MP4 video, with an audio track, in the `files` array of [Query Task Status](https://docs.vidgo.ai/api-manual/task-management/status.md) and the callback payload.

## Examples

* **Single prompt, 10 seconds**: one `prompt` with scene, camera and sound cues, `16:9`, 720p.
* **Three-shot 1080p sequence with callback**: `multi_prompt` with shots of 4, 6 and 5 seconds (15 seconds in total), `9:16`, and a `callback_url`.

## Notes

* Sending both `prompt` and `multi_prompt`, or neither, returns 400. With `multi_prompt`, a `duration` that differs from the shot total returns 400.
* This ID accepts text only. To start from an image, use [Kling 4.0 Image to Video](https://docs.vidgo.ai/api-manual/video-series/kwaivgi-kling-v4-0-image-to-video.md); to guide the video with images, videos or subjects, use [Kling 4.0 Reference to Video](https://docs.vidgo.ai/api-manual/video-series/kwaivgi-kling-v4-0-reference-to-video.md).
* Fields not listed above return 400. `model` and `callback_url` belong at the request root, not inside `input`.
* Credits are reserved at submission and depend on `resolution` and the output `duration`. A failed task is refunded in full. See the [pricing page](https://vidgo.ai/apis/api-pricing) for current rates.
* Output is 720p or 1080p only; there is no 4K or HDR tier, no audio on/off switch and no `seed` on this model.


## OpenAPI

````yaml api-manual/video-series/kwaivgi-kling-v4-0-text-to-video.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Kling 4.0 Text to Video
  description: >-
    The Kling 4.0 Text to Video API generates 3–30 second videos from a prompt
    or multi-shot prompts at 720p or 1080p, with stereo audio and five aspect
    ratios.
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Video Series
      summary: Kling 4.0 Text to Video
      description: >-
        Send exactly one of `prompt` or `multi_prompt`. Only the `input` fields
        listed for this model are accepted; image and video fields return 400.
      operationId: submit_kwaivgi_kling_v4_0_text_to_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              properties:
                model:
                  type: string
                  description: Model ID. Use `kwaivgi/kling-v4.0/text-to-video`.
                  example: kwaivgi/kling-v4.0/text-to-video
                callback_url:
                  type: string
                  format: uri
                  nullable: true
                  description: >-
                    Optional public HTTP(S) endpoint that receives a POST when
                    the task becomes `finished` or `failed`. HTTPS is
                    recommended. Omit it, or send `null` or an empty string, to
                    disable callbacks.
                  example: https://your-domain.com/callback
                input:
                  type: object
                  properties:
                    prompt:
                      type: string
                      minLength: 1
                      maxLength: 26000
                      description: >-
                        Text prompt, 1–26,000 characters after trimming. Send
                        exactly one of `prompt` or `multi_prompt`.
                    multi_prompt:
                      type: array
                      items:
                        type: object
                        required:
                          - prompt
                        properties:
                          prompt:
                            type: string
                            minLength: 1
                            maxLength: 512
                            description: Shot prompt, 1–512 characters.
                          duration:
                            type: integer
                            minimum: 1
                            maximum: 30
                            default: 5
                            description: Shot length in seconds (integer).
                        additionalProperties: false
                        description: One shot.
                      minItems: 1
                      description: >-
                        Multi-shot prompt: a non-empty list of shots, each with
                        its own `prompt` and optional `duration`. Shot durations
                        must total 3–30 seconds. Send exactly one of `prompt` or
                        `multi_prompt`.
                    duration:
                      type: integer
                      minimum: 3
                      maximum: 30
                      default: 5
                      description: >-
                        Output length in seconds (integer). With `multi_prompt`
                        it defaults to the shot total and, if sent, must equal
                        it.
                    resolution:
                      type: string
                      enum:
                        - 720p
                        - 1080p
                      default: 720p
                      description: Output resolution. It sets the billing rate.
                    aspect_ratio:
                      type: string
                      enum:
                        - auto
                        - '16:9'
                        - '9:16'
                        - '1:1'
                        - '21:9'
                      default: auto
                      description: Output aspect ratio. `auto` lets the model choose.
                  additionalProperties: false
                  description: Generation parameters.
            examples:
              single_prompt:
                summary: Single prompt, 10 seconds
                value:
                  model: kwaivgi/kling-v4.0/text-to-video
                  input:
                    prompt: >-
                      A lighthouse keeper climbs the spiral stairs at night,
                      lantern swinging, storm waves crashing outside, handheld
                      camera, the wind howling
                    duration: 10
                    resolution: 720p
                    aspect_ratio: '16:9'
              multi_shot:
                summary: Three-shot 1080p sequence with callback
                value:
                  model: kwaivgi/kling-v4.0/text-to-video
                  callback_url: https://your-domain.com/callback
                  input:
                    multi_prompt:
                      - prompt: >-
                          Wide shot: a food truck opens its shutter at sunrise
                          on an empty street
                        duration: 4
                      - prompt: >-
                          Close-up: the chef flips noodles in a flaming wok,
                          sizzling sound
                        duration: 6
                      - prompt: >-
                          Medium shot: a line of customers laughs as the first
                          bowl is handed out
                        duration: 5
                    resolution: 1080p
                    aspect_ratio: '9:16'
      responses:
        '200':
          description: Task submitted
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - data
                properties:
                  code:
                    type: integer
                    enum:
                      - 200
                    description: HTTP status code.
                  data:
                    type: object
                    required:
                      - task_id
                      - status
                      - created_time
                    properties:
                      task_id:
                        type: string
                        description: >-
                          Task ID. Use it with [Query Task
                          Status](/api-manual/task-management/status).
                      status:
                        type: string
                        enum:
                          - not_started
                        description: Initial task status.
                      created_time:
                        type: string
                        format: date-time
                        description: Time the task was created (ISO 8601).
              example:
                code: 200
                data:
                  task_id: task-unified-1762160000-abc123
                  status: not_started
                  created_time: '2026-11-03T10:30:00'
        '400':
          description: >-
            Invalid input, unsupported field, inaccessible media, or
            insufficient credits
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '404':
          description: Unknown or disabled model
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '408':
          description: Request timed out
          content:
            text/plain:
              schema:
                type: string
              example: Request timeout
        '422':
          description: Invalid JSON or non-object request body
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '429':
          description: Rate or API key credit limit exceeded
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '502':
          description: Unable to create the upstream generation task
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
        '503':
          description: The requested model is temporarily unavailable
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: Error message.
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        All API endpoints require Bearer Token authentication


        Get your API Key:


        Go to **Dashboard → API Key** ([API Key Management
        Page](https://vidgo.ai/apis/dashboard/api-key)) to get your API Key


        Add it to the request header:


        ```

        Authorization: Bearer VIDGO_API_KEY

        ```

````

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