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

# Kling Text-to-Video

> <ul><li>Generate video from a text description with a Kling model.</li><li>Supported models: kling-v1, kling-v1-5, and others</li></ul>

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/kling/v1/videos/text2video' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
    "model": "kling-v3",
    "prompt": "A small kitten running through a sunny garden, cinematic, highly detailed",
    "image": "https://example.com/image.png",
    "duration": 5,
    "response_format": "json",
    "metadata": {}
  }'
  ```

  ```python Python theme={null} theme={null}
  import requests

  url = "https://api.elkapi.com/kling/v1/videos/text2video"
  headers = {
      "Authorization": "Bearer <token>"
  }
  headers["Content-Type"] = "application/json"
  payload = {
      "model": "kling-v3",
      "prompt": "A small kitten running through a sunny garden, cinematic, highly detailed",
      "image": "https://example.com/image.png",
      "duration": 5,
      "response_format": "json",
      "metadata": {}
  }

  response = requests.request("POST", url, headers=headers, json=payload)
  print(response.json())
  ```

  ```javascript JavaScript theme={null} theme={null}
  const url = "https://api.elkapi.com/kling/v1/videos/text2video";

  const headers = {
    "Authorization": "Bearer <token>"
  };
  headers["Content-Type"] = "application/json";
  const payload = {
    "model": "kling-v3",
    "prompt": "A small kitten running through a sunny garden, cinematic, highly detailed",
    "image": "https://example.com/image.png",
    "duration": 5,
    "response_format": "json",
    "metadata": {}
  };

  const response = await fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(payload)
  });

  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {
    "task_id": "task_1234567890",
    "status": "queued"
  }
  ```

  ```json 400 theme={null} theme={null}
  {
    "error": {
      "message": "message",
      "type": "type",
      "param": "param",
      "code": "code"
    }
  }
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  All endpoints require Bearer Token authentication.

  Add it to the request headers:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" default="kling-v3">
  Model/style ID

  Example: `kling-v3`
</ParamField>

<ParamField body="prompt" type="string">
  Text prompt

  Example: `The astronaut stands up and walks away`
</ParamField>

<ParamField body="image" type="string">
  Image input (URL or Base64)

  Example: `https://example.com/image.jpg`
</ParamField>

<ParamField body="duration" type="number">
  Video duration (seconds)

  Example: `5`
</ParamField>

<ParamField body="width" type="integer">
  Video width

  Example: `1280`
</ParamField>

<ParamField body="height" type="integer">
  Video height

  Example: `720`
</ParamField>

<ParamField body="fps" type="integer">
  Video frame rate

  Example: `30`
</ParamField>

<ParamField body="seed" type="integer">
  Random seed

  Example: `20231234`
</ParamField>

<ParamField body="n" type="integer">
  Number of videos to generate

  Example: `1`
</ParamField>

<ParamField body="response_format" type="string">
  Response format

  Example: `url`
</ParamField>

<ParamField body="user" type="string">
  User identifier

  Example: `user-1234`
</ParamField>

<ParamField body="metadata" type="object">
  Additional parameters (such as negative\_prompt, style, quality\_level)
</ParamField>

## Response

<ResponseField name="task_id" type="string">
  Task ID

  Example: `abcd1234efgh`
</ResponseField>

<ResponseField name="status" type="string">
  Task status

  Example: `queued`
</ResponseField>
