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

# kling-v2-1-master

> Kling 2.1 Master text-to-video and image-to-video Legacy APIs.

<Tabs>
  <Tab title="Text to Video">
    ## Create task

    `POST /kling/v1/videos/text2video`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/kling/v1/videos/text2video \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model_name": "kling-2.1-master",
          "prompt": "A train crosses a snow-covered valley",
          "negative_prompt": "blurry, distorted",
          "duration": "5",
          "mode": "pro",
          "aspect_ratio": "16:9",
          "watermark_info": {"enabled": false}
        }'
      ```

      ```json 200 theme={null}
      {"id":"860260753860210752","task_id":"860260753860210752","object":"video","model":"kling-v2-1-master","status":"","progress":0,"created_at":1773130665}
      ```
    </div>

    <ParamField body="model_name" type="string" required>Must be `kling-2.1-master`.</ParamField>
    <ParamField body="prompt" type="string" required>Positive prompt, up to 2,500 characters.</ParamField>
    <ParamField body="negative_prompt" type="string">Content to avoid, up to 2,500 characters.</ParamField>
    <ParamField body="mode" type="string" default="std">`std` for 720p or `pro` for 1080p.</ParamField>
    <ParamField body="duration" type="string" default="5">`5` or `10` seconds.</ParamField>
    <ParamField body="aspect_ratio" type="string" default="16:9">`16:9`, `9:16`, or `1:1`.</ParamField>
    <ParamField body="watermark_info" type="object">Set `enabled` to request an additional watermarked result.</ParamField>

    ## Query task by ID

    `GET /kling/v1/videos/text2video/{task_id}`

    ```bash cURL theme={null}
    curl --request GET \
      --url https://www.anyfast.ai/kling/v1/videos/text2video/TASK_ID \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </Tab>

  <Tab title="Image to Video">
    ## Create task

    `POST /kling/v1/videos/image2video`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/kling/v1/videos/image2video \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model_name": "kling-2.1-master",
          "image": "https://example.com/frame.png",
          "prompt": "Snow begins to fall around the subject",
          "duration": "5",
          "mode": "pro",
          "watermark_info": {"enabled": false}
        }'
      ```

      ```json 200 theme={null}
      {"id":"860260753860210752","task_id":"860260753860210752","object":"video","model":"kling-v2-1-master","status":"","progress":0,"created_at":1773130665}
      ```
    </div>

    <ParamField body="model_name" type="string" required>Must be `kling-2.1-master`.</ParamField>
    <ParamField body="image" type="string" required>Start-frame URL or raw Base64.</ParamField>
    <ParamField body="prompt" type="string">Positive prompt, up to 2,500 characters.</ParamField>
    <ParamField body="negative_prompt" type="string">Negative prompt, up to 2,500 characters.</ParamField>
    <ParamField body="mode" type="string" default="std">`std` for 720p or `pro` for 1080p.</ParamField>
    <ParamField body="duration" type="string" default="5">`5` or `10` seconds.</ParamField>
    <ParamField body="watermark_info" type="object">Set `enabled` to request an additional watermarked result.</ParamField>

    ### Image requirements

    Use a public URL or raw Base64 without a data URI prefix. JPG, JPEG, and PNG are supported. Files must be no larger than 10 MB, both sides at least 300 px, and the aspect ratio between 1:2.5 and 2.5:1.

    <Warning>Kling 2.1 Master does not support `image_tail`; provide only `image`.</Warning>

    ## Query task by ID

    `GET /kling/v1/videos/image2video/{task_id}`

    ```bash cURL theme={null}
    curl --request GET \
      --url https://www.anyfast.ai/kling/v1/videos/image2video/TASK_ID \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </Tab>
</Tabs>

## Task result

<ParamField path="task_id" type="string" required>Use the ID returned by the matching create endpoint.</ParamField>

Task status is `submitted`, `processing`, `succeed`, or `failed`. Successful output is in `data.task_result.videos`; failure details are in `data.task_status_msg`. Result items contain `id`, `url`, `watermark_url`, and `duration`.

```json 200 theme={null}
{
  "code": 0,
  "message": "SUCCEED",
  "request_id": "request-id",
  "data": {
    "task_id": "task-id",
    "task_status": "succeed",
    "task_status_msg": "",
    "watermark_info": {"enabled": false},
    "task_result": {"videos": [{"id": "video-id", "url": "https://example.com/result.mp4", "watermark_url": "", "duration": "5"}]},
    "final_unit_deduction": "string",
    "final_balance_deduction": {"quota": "string", "list_price": "string"},
    "created_at": 1722769557708,
    "updated_at": 1722769657708
  }
}
```

<Warning>Generated result URLs are removed after 30 days. Save the files promptly.</Warning>

<Note>This Legacy model does not support an end frame, audio, specified voices, multi-shot, motion brush, camera control, or `cfg_scale`.</Note>

<script src="/feedback.js" />
