Kling O1

This guide shows how to generate images using Kling O1 model via the Leonardo.AI REST API.

This guide shows how to generate images using Kling O1 model via the Leonardo.AI REST API.

Sample Request

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
    }
}
'

Recipe

API Request Endpoint, Headers, Parameters

Endpoint

https://cloud.leonardo.ai/api/rest/v2/generations

Headers

--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"

Body Parameters

ParameterTypeDefinition
durationnumberLength of the generated video. Set to 5 or 10.
guidances.endframearrayMaximum 1 item. Each item includes image.id and image.type (GENERATED or UPLOADED). Only available when start_frame is provided. Only available when NO image_reference is provided.
guidances.image_referencearrayArray of up to four reference images used to guide the visual style or content of the generation. Each item includes image.id and image.type (GENERATED or UPLOADED). Only available when NO start_frame or end_frame is provided.
guidances.start_framearrayMaximum 1 item. Each item includes image.id and image.type (GENERATED or UPLOADED). Only available when NO image_reference is provided.
heightnumberSets the height of the output video in pixels.
modelstringSpecifies the model used for generation. Set to kling-video-o-1.
promptstringText description of the video content to generate. Maximum of 1500 characters.
publicbooleanControls whether the generated video is public (true) or private (false).
widthnumberSets the width of the output video in pixels.

Height and Width Combination

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