Kling 3.0

This guide shows how to generate videos using Kling 3.0 models via the Leonardo.AI REST API.

This guide shows how to generate videos using Kling 3.0 models 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-3.0",
    "public": false,
    "parameters": {
    "prompt": "Animate this landscape with birds flying and wind blowing through trees",
      "duration": 5,
      "width": 1920,
      "height": 1080,
      "mode": "RESOLUTION_1080",
      "motion_has_audio": true,
      "guidances": {
        "start_frame": [
          {
            "image": {
              "id": "<YOUR_START_IMAGE_ID>",
              "type": "GENERATED"
            }
          }
        ]
      }
    }
}
'

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 3 up to 15.
guidances.end_framearrayMaximum 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 7 reference images used to guide the visual style or content of the generation, or up to 4 when specifying a video reference. 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 video in pixels.
modestringQuality modes. Specify RESOLUTION_720 for Standard or RESOLUTION_1080 for Pro. Default is RESOLUTION_1080.
modelstringSpecifies the model used for generation. Set to kling-3.0.
motion_has_audiobooleanControls whether to generate audio (true) or not (false).
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 video in pixels.

Dimensions

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

ResolutionAspect RatioPixel Values (Width x Height)
720p16:91280x720
1:1960x960
9:16720x1280
1080p16:91920x1080
1:11440x1440
9:161080x1920

Note: When width and heightare not specified, and guidances.start_frame is specified, the generation will base the dimensions on the guidances.start_frame image.