Generate with Kling O1

Guide for generating videos with Kling O1 using start and end frames, and image references

Follow this recipe to generate video using start and end frames:

Follow this recipe to generate video using image references:


Core Parameters

  • model
    • Set tokling-video-o-1 to use Kling O1.
  • prompt
    • Type: string
    • Max length: 1500 characters
    • Description: Text description of the video content to generate
  • 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 optional start/end frames, and image reference configurations.

📘

Note:

  • For best results, choose a start_frameandend_frame that matches the aspect ratio you want to generate.
  • start_frame/end_frame cannot be used with image_reference.
  • start_frame, end_frame, and image_reference can either be uploaded to Leonardo (type: "UPLOADED", or generated on the platform (type: "GENERATED")
  • Up to 5 image references are supported.
  • start_frame
    • Type: array
    • Max items: 1
    • Condition: Only available when NO image_reference is provided
    • Items: Each item is an object containing:
      • image (object):
        • id (string, uuid format)
        • type (enum: "UPLOADED", "GENERATED")
  • end_frame
    • Type: array
    • Max items: 1
    • Conditions:
      • Only available when NO image_reference is provided
      • Only available when start_frame IS provided
    • Items: Each item is an object containing:
      • image (object):
        • id (string, uuid format)
        • type (enum: "UPLOADED", "GENERATED")
  • image_reference
    • Type: array
    • Max items: 5
    • Condition: Only available when NO start_frame or end_frame is provided
    • Items: Each item is an object containing:
      • image (object):
        • id (string, uuid format)
        • type (enum: "UPLOADED", "GENERATED")

Sample Request Using Start and End Frames

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-video-o-1",
    "public": false,
    "parameters": {
    "prompt": "The woman plays with the cat",
    "guidances": {
      "start_frame": [
        {
          "image": {
            "id": "<YOUR_START_IMAGE_ID>",
            "type": "UPLOADED"
          }
        }
      ],
      "end_frame": [
        {
          "image": {
            "id": "<YOUR_END_IMAGE_ID>",
            "type": "UPLOADED"
          }
        }
      ]
    },
    "duration": 5,
    "width": 1080,
    "height": 1920
  }
}
'

Sample Request Using Image Reference

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-video-o-1",
    "public": false,
    "parameters": {
    "prompt": "The woman plays with the cat",
    "guidances": {
      "image_reference": [
        {
          "image": {
            "id": "<YOUR_IMAGE_ID_1>",
            "type": "GENERATED"
          }
        },
        {
          "image": {
            "id": "<YOUR_IMAGE_ID_1>",
            "type": "UPLOADED"
          }
        }
      ]
    },
    "duration": 5,
    "width": 1080,
    "height": 1920
  }
}
'

Cost

DurationAPI Credit Cost
5 seconds505 API Credits
10 seconds1010 API Credits