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

# Kling Text To Video

> Use DeerAPI to call the Kling Text To Video endpoint with request details, response details, examples, and an OpenAPI playground.

## Overview

Use this endpoint to call the Kling Text To Video workflow through DeerAPI. The API reference on this page shows the request schema, response schema, authentication requirements, and runnable examples for the configured endpoint.

## Before you start

Use the DeerAPI base URL and pass your API Key in the `Authorization` header:

```text theme={null}
https://api.deerapi.com
```

```text theme={null}
Authorization: Bearer $DEERAPI_KEY
```

## Model selection

Choose a current model ID from the [live pricing page](https://api.deerapi.com/pricing). Model availability changes over time, so avoid copying a model ID from an old project without checking the live list first.

## Implementation notes

* Use the OpenAPI playground for the exact request fields accepted by this endpoint.
* Keep API Keys on the server side when you build production applications.
* Log the request ID from failed calls so support can investigate the request.
* Retry `429`, `500`, and `503` responses with exponential backoff.


## OpenAPI

````yaml /api/openapi/video/kling/post-text-to-video.openapi.json POST /kling/v1/videos/text2video
openapi: 3.1.0
info:
  title: DeerAPI Kling Text to Video
  description: Use this field according to the endpoint schema.
  version: 1.0.0
servers:
  - url: https://api.deerapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/text2video:
    post:
      summary: DeerAPI Kling Text to Video
      description: Use this field according to the endpoint schema.
      operationId: createKlingTextToVideo
      parameters:
        - name: Content-Type
          in: header
          required: false
          description: ''
          schema:
            type: string
      requestBody:
        description: Use this field according to the endpoint schema.
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - prompt
              properties:
                prompt:
                  type: string
                  description: Use this field according to the endpoint schema.
                  default: Hello
                negative_prompt:
                  type: string
                  description: Use this field according to the endpoint schema.
                aspect_ratio:
                  type: string
                  description: Use this field according to the endpoint schema.
                callback_url:
                  type: string
                  description: Use this field according to the endpoint schema.
                model_name:
                  type: string
                  description: Use this field according to the endpoint schema.
                  default: kling-v1
                cfg_scale:
                  type: number
                  description: Use this field according to the endpoint schema.
                mode:
                  type: string
                  description: Use this field according to the endpoint schema.
                  enum:
                    - std
                    - pro
                duration:
                  type: string
                  description: Use this field according to the endpoint schema.
                camera_control:
                  type: object
                  description: Use this field according to the endpoint schema.
                  properties:
                    type:
                      type: string
                      enum:
                        - simple
                        - down_back
                        - forward_up
                        - right_turn_forward
                        - left_turn_forward
                    config:
                      type: object
                      description: Use this field according to the endpoint schema.
                      properties:
                        horizontal:
                          type: integer
                          description: Use this field according to the endpoint schema.
                        vertical:
                          type: integer
                          description: Use this field according to the endpoint schema.
                        pan:
                          type: integer
                          description: Use this field according to the endpoint schema.
                        tilt:
                          type: integer
                          description: Use this field according to the endpoint schema.
                        roll:
                          type: integer
                          description: Use this field according to the endpoint schema.
                        zoom:
                          type: integer
                          description: Use this field according to the endpoint schema.
                external_task_id:
                  type: string
                  description: Use this field according to the endpoint schema.
              default:
                prompt: A cinematic shot of a quiet city street at sunset.
              examples:
                default:
                  summary: DeerAPI Kling Text to Video
                  value:
                    model_name: kling-v2-6
                    prompt: >-
                      A cinematic shot of a modern glass workspace at sunrise
                      with smooth camera movement.
                    duration: '5'
                    mode: pro
                    aspect_ratio: '16:9'
                    callback_url: https://example.com/kling/callback
            example:
              prompt: A cinematic shot of a quiet city street at sunset.
            examples:
              Default:
                summary: Default request
                value:
                  prompt: A cinematic shot of a quiet city street at sunset.
      responses:
        '200':
          description: Use this field according to the endpoint schema.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - request_id
                  - data
                properties:
                  code:
                    type: integer
                    description: Use this field according to the endpoint schema.
                  message:
                    type: string
                    description: Use this field according to the endpoint schema.
                  request_id:
                    type: string
                    description: Use this field according to the endpoint schema.
                  data:
                    type: object
                    required:
                      - task_id
                      - task_status
                      - task_status_msg
                      - task_info
                      - task_result
                      - created_at
                      - updated_at
                    properties:
                      task_id:
                        type: string
                        description: Use this field according to the endpoint schema.
                      task_status:
                        type: string
                        description: Use this field according to the endpoint schema.
                      task_status_msg:
                        type: string
                      task_info:
                        type: object
                        required:
                          - external_task_id
                        properties:
                          external_task_id:
                            type: string
                      task_result:
                        type: object
                        required:
                          - videos
                        properties:
                          videos:
                            type: object
                            required:
                              - id
                              - duration
                              - url
                            properties:
                              id:
                                type: string
                              url:
                                type: string
                              duration:
                                type: string
                      created_at:
                        type: integer
                        description: Use this field according to the endpoint schema.
                      updated_at:
                        type: integer
                        description: Use this field according to the endpoint schema.
      x-codeSamples:
        - lang: Shell
          label: cURL
          source: |
            curl https://api.deerapi.com/kling/v1/videos/text2video \
              -H "Content-Type: application/json" \
              -H "Authorization: Bearer $DEERAPI_KEY" \
              -d '{
                "prompt": "A cinematic shot of a quiet city street at sunset."
              }'
        - lang: Python
          label: requests
          source: |
            import os
            import requests

            url = "https://api.deerapi.com/kling/v1/videos/text2video"
            headers = {
                "Authorization": "Bearer " + os.environ["DEERAPI_KEY"],
                "Content-Type": "application/json",
            }
            payload = {
              "prompt": "A cinematic shot of a quiet city street at sunset."
            }

            response = requests.post(url, headers=headers, json=payload)
            print(response.json())
        - lang: JavaScript
          label: fetch
          source: >
            const response = await
            fetch("https://api.deerapi.com/kling/v1/videos/text2video", {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.DEERAPI_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                "prompt": "A cinematic shot of a quiet city street at sunset."
              }),
            });


            console.log(await response.json());
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use a DeerAPI API Key as a Bearer token.

````