Generate with Kling 2.6

Guide for generating videos with Kling 2.6 using a start frame

Follow this recipe to generate video using a start frame:


Core Parameters

  • model
    • Set tokling-2.6 to use Kling 2.6.
  • prompt
    • Type: string
    • Max length: 1500 characters
    • Description: Text description of the video content to generate, can include description of audio
  • duration
    • Type: integer
    • Valid values: 5 or 10
    • Unit: seconds
    • Description: Length of the generated video

Dimensions

The API accepts width and height parameters in the following aspect ratio combinations:

Aspect RatioWidthHeight
16:9 (Landscape)19201080
1:1 (Square)14401440
9:16 (Portrait)10801920

Guidances

The guidances object contains an optional start frame (image-to-video) configuration.

📘

Note:

  • For best results, choose a start_frame that matches the aspect ratio you want to generate.
  • start_frame can either be uploaded to Leonardo (type: "UPLOADED"), or generated on the platform (type: "GENERATED")
  • start_frame
    • Type: array
    • Max items: 1
    • Items: Each item is an object containing:
      • image (object):
        • id (string, uuid format)
        • type (enum: "UPLOADED", "GENERATED")

Sample Request Using a Start Frame

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '
{
    "model": "kling-2.6",
    "public": false,
    "parameters": {
      "prompt": "The woman plays with the cat",
      "guidances": {
        "start_frame": [
          {
            "image": {
              "id": "<YOUR_START_IMAGE_ID>",
              "type": "GENERATED"
            }
          }
        ]
      },
      "duration": 5,
      "width": 1080,
      "height": 1920
    }
}
'

Cost

DurationAPI Credit Cost
5 seconds604 API Credits
10 seconds1208 API Credits