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:
Generate with Kling O1 Using Start and End Frames
Open Recipe
Follow this recipe to generate video using image references:
Generate with Kling O1 Using Image References
Open Recipe
Core Parameters
model- Set to
kling-video-o-1to use Kling O1.
- Set to
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 Ratio | Width | Height |
|---|---|---|
| 16:9 (Landscape) | 1920 | 1080 |
| 1:1 (Square) | 1440 | 1440 |
| 9:16 (Portrait) | 1080 | 1920 |
Guidances
The guidances object contains optional start/end frames, and image reference configurations.
Note:
- For best results, choose a
start_frameandend_framethat matches the aspect ratio you want to generate.start_frame/end_framecannot be used withimage_reference.start_frame,end_frame, andimage_referencecan 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_referenceis 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_referenceis provided - Only available when
start_frameIS provided
- Only available when NO
- 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_frameorend_frameis 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
| Duration | API Credit Cost |
|---|---|
| 5 seconds | 505 API Credits |
| 10 seconds | 1010 API Credits |
Updated about 11 hours ago
