Kling O1
This guide shows how to generate video using Kling O1 model via the Leonardo.AI REST API.
This guide shows how to generate videos 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
}
}
'Sample Request - Video Editing
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": "add @image1 to the background",
"mode": "RESOLUTION_1080",
"prompt_enhance": "OFF",
"quantity": 1,
"duration": 5,
"seed": YOUR_SEED,
"width": 1920,
"height": 1080,
"guidances": {
"image_reference": [
{
"image": {
"id": "YOUR_UPLOADED_IMAGE_ID",
"type": "UPLOADED"
}
}
],
"video_reference_base": [
{
"video": {
"id": "YOUR_GENERATED_VIDEO_ID",
"type": "GENERATED"
}
}
]
}
}
}
'Recipe
API Request Endpoint, Headers, Parameters
Endpoint
https://cloud.leonardo.ai/api/rest/v2/generationsHeaders
--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"Body Parameters
Parameter | Type | Definition |
|---|---|---|
duration |
| Length of the generated video. Set to |
guidances.endframe |
| Maximum 1 item. Each item includes image.id and image.type ( |
guidances.image_reference |
| Array 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 ( |
guidances.start_frame |
| Maximum 1 item. Each item includes image.id and image.type ( |
guidances.video_reference_base |
| Duration of reference needs to be Reference height/width needs to be at least Referenced videos can currently only be of The video ID is the image ID of the associated image. i.e. the video is the video at |
height |
| Sets the height of the output video in pixels. |
model |
| Specifies the model used for generation. Set to |
prompt |
| Text description of the video content to generate. Maximum of 1500 characters. |
public |
| Controls whether the generated video is public (true) or private (false). |
width |
| Sets 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 Ratio | Width | Height |
|---|---|---|
| 16:9 (Landscape) | 1920 | 1080 |
| 1:1 (Square) | 1440 | 1440 |
| 9:16 (Portrait) | 1080 | 1920 |
Updated 10 days ago
