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

> Kling 2.1 image-to-video Legacy API.

## 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",
      "image": "https://example.com/start.png",
      "image_tail": "https://example.com/end.png",
      "prompt": "The subject turns and smiles",
      "negative_prompt": "blurry, distorted",
      "duration": "5",
      "mode": "pro",
      "watermark_info": {"enabled": false}
    }'
  ```

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

## Request body

<ParamField body="model_name" type="string" required>Must be `kling-2.1`.</ParamField>
<ParamField body="image" type="string" required>Start-frame URL or raw Base64.</ParamField>
<ParamField body="image_tail" type="string">Optional end frame. Start-and-end-frame generation requires 1080p `pro` mode.</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.

## 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'
```

<ParamField path="task_id" type="string" required>The task ID returned by the 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>Kling 2.1 does not provide text-to-video. It also does not support audio, specified voices, multi-shot, motion brush, camera control, or `cfg_scale`.</Note>

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