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

> Kling 2.6 Legacy APIs for text to video, image to video, motion control, and voice management.

<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.6",
          "prompt": "A corgi runs along a beach at sunset as waves cross the sand",
          "negative_prompt": "blurry, shaky",
          "duration": "5",
          "mode": "pro",
          "sound": "on",
          "aspect_ratio": "16:9",
          "watermark_info": {"enabled": false}
        }'
      ```

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

    ## 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>Must be `application/json`.</ParamField>

    ## Request body

    <ParamField body="model_name" type="string" required>Must be `kling-2.6`.</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="voice_list" type="object[]">Up to two voices. Each item contains a `voice_id` from Voice Management.</ParamField>
    <ParamField body="sound" type="string" default="off">`on` or `off`. Must be `on` when `voice_list` is used.</ParamField>
    <ParamField body="mode" type="string" default="std">`std` for 720p or `pro` for 1080p.</ParamField>
    <ParamField body="duration" type="string" default="5">Fixed duration: `5` or `10` seconds.</ParamField>
    <ParamField body="aspect_ratio" type="string" default="16:9">`16:9`, `9:16`, or `1:1`.</ParamField>
    <ParamField body="camera_control" type="object">Preset or custom camera movement.</ParamField>
    <ParamField body="watermark_info" type="object">Use `enabled` to request an additional watermarked result.</ParamField>

    ### Specified voice

    `voice_list` accepts up to two voices. Reference them as `<<<voice_1>>>` and `<<<voice_2>>>` in list order, and set `sound` to `on`.

    ```json theme={null}
    {
      "model_name": "kling-2.6",
      "prompt": "<<<voice_1>>> says: 'Welcome to today's program'",
      "voice_list": [{"voice_id": "voice-id"}],
      "duration": "5",
      "mode": "pro",
      "sound": "on",
      "aspect_ratio": "16:9"
    }
    ```

    ### Camera control

    `camera_control.type` supports `simple`, `down_back`, `forward_up`, `right_turn_forward`, and `left_turn_forward`. In `simple` mode, set one nonzero property in `config`: `horizontal`, `vertical`, `pan`, `tilt`, `roll`, or `zoom`. Each property ranges from -10 to 10.

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

    <ParamField path="task_id" type="string" required>The `task_id` returned by the create request.</ParamField>

    `data.task_status` can be `submitted`, `processing`, `succeed`, or `failed`. Successful output is in `data.task_result.videos`; each item contains `id`, `url`, `watermark_url`, and `duration`. Failure details are in `data.task_status_msg`.

    <Warning>Generated result URLs are removed after 30 days. Save the files promptly.</Warning>
  </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.6",
          "image": "https://example.com/first-frame.png",
          "image_tail": "https://example.com/end-frame.png",
          "prompt": "The camera slowly pulls back as the person smiles",
          "duration": "5",
          "mode": "pro",
          "sound": "off"
        }'
      ```

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

    ## 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>Must be `application/json`.</ParamField>

    ## Request body

    <ParamField body="model_name" type="string" required>Must be `kling-2.6`.</ParamField>
    <ParamField body="image" type="string">Start frame URL or raw Base64. At least one of `image` and `image_tail` is required.</ParamField>
    <ParamField body="image_tail" type="string">End frame. It cannot be combined with `dynamic_masks`, `static_mask`, or `camera_control`.</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="voice_list" type="object[]">Up to two items, each containing `voice_id`.</ParamField>
    <ParamField body="sound" type="string" default="off">`on` or `off`. Must be `on` when a voice is referenced.</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="static_mask" type="string">Static motion mask as a URL or raw Base64.</ParamField>
    <ParamField body="dynamic_masks" type="object[]">Up to six dynamic motion-brush masks.</ParamField>
    <ParamField body="camera_control" type="object">Preset or custom camera movement.</ParamField>
    <ParamField body="watermark_info" type="object">Use `enabled` to request an additional watermarked result.</ParamField>

    ### Image requirements

    * Use a public URL or raw Base64 without a `data:image/...;base64,` prefix.
    * Use JPG, JPEG, or PNG. Files must be no larger than 10 MB, each side must be at least 300 px, and the aspect ratio must be between 1:2.5 and 2.5:1.
    * At least one of `image` and `image_tail` is required.
    * End-frame control, motion brush, and `camera_control` cannot be used together.

    ### Motion brush

    <ParamField body="dynamic_masks[].mask" type="string" required>A dynamic-area mask matching the input image dimensions.</ParamField>
    <ParamField body="dynamic_masks[].trajectories" type="object[]" required>Trajectory coordinates. A 5-second video accepts 2–77 points.</ParamField>
    <ParamField body="dynamic_masks[].trajectories[].x" type="integer" required>X coordinate, using the image's bottom-left corner as the origin.</ParamField>
    <ParamField body="dynamic_masks[].trajectories[].y" type="integer" required>Y coordinate, using the image's bottom-left corner as the origin.</ParamField>

    ### Specified voice example

    ```json theme={null}
    {
      "model_name": "kling-2.6",
      "image": "https://example.com/person.png",
      "prompt": "<<<voice_1>>> makes the person say: 'Welcome everyone'",
      "voice_list": [{"voice_id": "voice-id"}],
      "duration": "5",
      "mode": "pro",
      "sound": "on"
    }
    ```

    ## 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 image-to-video task ID.</ParamField>

    Successful results return `id`, `url`, `watermark_url`, and `duration` in `data.task_result.videos`. `data.final_unit_deduction` and `data.final_balance_deduction` describe the final charge.

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

  <Tab title="Motion Control">
    ## Create task

    `POST /kling/v1/videos/motion-control`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/kling/v1/videos/motion-control \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model_name": "kling-2.6",
          "image_url": "https://example.com/character.png",
          "video_url": "https://example.com/motion.mp4",
          "prompt": "Preserve the character and reproduce the reference motion",
          "character_orientation": "video",
          "keep_original_sound": "yes",
          "mode": "pro"
        }'
      ```

      ```json 200 theme={null}
      {"code":0,"message":"SUCCEED","request_id":"request-id","data":{"task_id":"task-id","task_status":"submitted"}}
      ```
    </div>

    ## Request body

    <ParamField body="model_name" type="string" required>Must be `kling-2.6`.</ParamField>
    <ParamField body="prompt" type="string">Additional visual or camera instructions, up to 2,500 characters.</ParamField>
    <ParamField body="image_url" type="string" required>Character image URL or raw Base64.</ParamField>
    <ParamField body="video_url" type="string" required>Public URL for the motion reference video.</ParamField>
    <ParamField body="element_list" type="object[]">Up to one legacy element. When used, `character_orientation` must be `video`.</ParamField>
    <ParamField body="element_list[].element_id" type="string" required>Element ID returned by the Legacy Element Management API.</ParamField>
    <ParamField body="keep_original_sound" type="string" default="yes">Keep reference-video audio: `yes` or `no`.</ParamField>
    <ParamField body="character_orientation" type="string" required>Character orientation source: `image` or `video`.</ParamField>
    <ParamField body="mode" type="string" default="std">`std` or `pro`.</ParamField>
    <ParamField body="watermark_info" type="object">Use `enabled` to request an additional watermarked result.</ParamField>

    ### Media requirements

    * Images: JPG, JPEG, or PNG; up to 10 MB; each side 300–65,536 px; aspect ratio 1:2.5 through 2.5:1. Keep the head, upper body, or full body visible and avoid occlusion or extreme orientation.
    * Videos: MP4 or MOV; up to 100 MB; each side 340–3,850 px; at least 3 seconds long.
    * Maximum duration is 10 seconds for `character_orientation: "image"` and 30 seconds for `character_orientation: "video"`.
    * Use one continuous shot, keep the person in frame, avoid cuts and aggressive camera movement, and prefer a single person with moderate motion speed.

    <Warning>
      For difficult or fast motion, the model may extract only the usable continuous segment and return a result shorter than the uploaded video. A task can still run when at least 3 seconds of continuous usable motion is found, and consumed credits are not refunded. Reduce the motion difficulty or speed when needed.
    </Warning>

    ## Query task by ID

    `GET /kling/v1/videos/motion-control/{task_id}`

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

    <ParamField path="task_id" type="string" required>The motion-control task ID.</ParamField>

    Successful output is in `data.task_result.videos`. Task status can be `submitted`, `processing`, `succeed`, or `failed`.

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

  <Tab title="Voice Management">
    ## Endpoints

    | Operation           | Method and path                            |
    | ------------------- | ------------------------------------------ |
    | Create custom voice | `POST /kling/v1/general/custom-voices`     |
    | Query custom voice  | `GET /kling/v1/general/custom-voices/{id}` |
    | List custom voices  | `GET /kling/v1/general/custom-voices`      |
    | List preset voices  | `GET /kling/v1/general/presets-voices`     |
    | Delete custom voice | `POST /kling/v1/general/delete-voices`     |

    ## Create custom voice

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/kling/v1/general/custom-voices \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "voice_name": "Narrator",
          "voice_url": "https://example.com/voice.mp3"
        }'
      ```

      ```json 200 theme={null}
      {"code":0,"message":"SUCCEED","request_id":"request-id","data":{"task_id":"voice-task-id","task_status":"submitted"}}
      ```
    </div>

    <ParamField body="voice_name" type="string" required>Custom voice name, up to 20 characters.</ParamField>
    <ParamField body="voice_url" type="string">Public MP3, WAV, MP4, or MOV URL. At least one of `voice_url` and `video_id` is required.</ParamField>
    <ParamField body="video_id" type="string">An eligible previously generated video ID. At least one of `voice_url` and `video_id` is required.</ParamField>

    The source must contain one clear speaker and be 5–30 seconds long. Creation status can be `submitted`, `processing`, `succeed`, or `failed`. A successful result provides `voice_id` and `trial_url`.

    ## Query custom voice

    ```bash cURL theme={null}
    curl --request GET \
      --url https://www.anyfast.ai/kling/v1/general/custom-voices/VOICE_TASK_ID \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```

    A successful voice item contains `voice_id`, `voice_name`, `trial_url`, and `owned_by`.

    ## List voices

    ```bash cURL theme={null}
    curl --request GET \
      --url 'https://www.anyfast.ai/kling/v1/general/custom-voices?pageNum=1&pageSize=30' \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```

    ```bash cURL theme={null}
    curl --request GET \
      --url 'https://www.anyfast.ai/kling/v1/general/presets-voices?pageNum=1&pageSize=30' \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```

    <ParamField query="pageNum" type="integer" default={1}>Page number from 1 to 1,000.</ParamField>
    <ParamField query="pageSize" type="integer" default={30}>Page size from 1 to 1,000.</ParamField>

    Preset voices have `owned_by: "kling"`. They can be used directly but cannot be deleted.

    ## Delete custom voice

    ```bash cURL theme={null}
    curl --request POST \
      --url https://www.anyfast.ai/kling/v1/general/delete-voices \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{"voice_id":"VOICE_ID"}'
    ```

    <ParamField body="voice_id" type="string" required>The custom voice ID to delete.</ParamField>
  </Tab>
</Tabs>

<Note>
  This page uses the Kling Legacy request structure. AnyFast adds the `/kling` routing prefix to Legacy paths. It does not include new model-specific endpoints or the unavailable video task-list queries.
</Note>

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