> ## 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":"queued","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}`

### Request headers

<ParamField header="Authorization" type="string" required>Bearer authentication in the form `Bearer YOUR_API_KEY`.</ParamField>
<ParamField header="Content-Type" type="string" default="application/json" required>Data exchange format. Use `application/json`.</ParamField>

### Path parameters

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

```bash cURL theme={null}
curl --request GET \
  --url https://www.anyfast.ai/kling/v1/videos/image2video/TASK_ID \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json'
```

`data.task_status` is `submitted`, `processing`, `succeed`, or `failed`. When the task succeeds, `data.task_result.videos[]` contains the temporary result `url` and actual `duration`.

### Response fields

<ResponseField name="code" type="integer">`0` indicates that the query was accepted.</ResponseField>
<ResponseField name="message" type="string">Error information; empty for a successful query.</ResponseField>
<ResponseField name="data.task_id" type="string">Queried task ID.</ResponseField>
<ResponseField name="data.task_status" type="string">`submitted`, `processing`, `succeed`, or `failed`.</ResponseField>
<ResponseField name="data.task_status_msg" type="string">Failure details when the task fails.</ResponseField>
<ResponseField name="data.task_result.videos" type="object[]">Generated videos, returned after success.</ResponseField>
<ResponseField name="data.task_result.videos[].url" type="string">Temporary generated-video URL.</ResponseField>
<ResponseField name="data.task_result.videos[].duration" type="string">Actual duration in seconds.</ResponseField>
<ResponseField name="data.created_at" type="integer">Creation Unix timestamp in milliseconds.</ResponseField>
<ResponseField name="data.updated_at" type="integer">Last update Unix timestamp in milliseconds.</ResponseField>

```json 200 theme={null}
{
  "code": 0,
  "message": "",
  "data": {
    "task_id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "task_status": "succeed",
    "task_result": {"videos": [{"url": "https://example.com/result.mp4", "duration": "5"}]},
    "created_at": 1784720890000,
    "updated_at": 1784720949000
  }
}
```

<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" />
