Motion 2.0

This guide shows how to generate videos using the Motion 2.0 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": "motion_2.0",
    "public": false,
    "parameters": {
      "prompt": "A koala and a cat playing together in a sunlit meadow",
      "guidances": {
        "start_frame": [
          {
            "image": {
              "id": "<YOUR_START_IMAGE_ID>",
              "type": "UPLOADED"
            }
          }
        ]
      },
      "quantity": 1,
      "prompt_enhance": "OFF",
      "frame_interpolation": true,
      "width": 1280,
      "height": 720
    }
}
'

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
controlsarrayAn array of Motion Control items (same format, but are defined separately from Motion Elements). Maximum 1 item. Each item includes akUUID (required) and weight (-2 to 2, defaults to 1).
elementsarrayAn array of Motion Elements (same format, but are defined separately from Motion Control). Each item includes akUUID (required) and weight (-2 to 2, defaults to 1). Defaults to [].
frame_interpolationbooleanWhether the video generation will smoothly blend frames. Defaults to true.
guidances.start_framearrayCreative reinterpretation of vibe or structure from a reference image. Maximum 1 item. Each item includes image.id and image.type (UPLOADED, GENERATED, VARIATION, URL, or BASE64).
heightnumberSets the height of the output video in pixels.
modestringDeprecated. Width and height are the canonical inputs for this model. Retained for backwards compatibility. Valid values are RESOLUTION_480 and RESOLUTION_720. Defaults to RESOLUTION_480.
modelstringSpecifies the model used for generation. Set to motion_2.0.
negative_promptstringThe negative prompt to use for the generation. Maximum of 1000 characters.
promptstringText description of the video content to generate. Maximum of 9999 characters.
prompt_enhancestringEnables or disables prompt enhancement. Valid values are AUTO, ON, and OFF. Defaults to AUTO.
publicbooleanControls whether the generated video is public (true) or private (false).
quantitynumberThe number of outputs to generate. Set to 1. Defaults to 1.
seednumberThe seed value for video generation. Set to a value between 0 and 2147483637.
style_idsarrayAn array of zero or more style UUIDs for video models (vibe, lighting, color). Defaults to [].
widthnumberSets the width of the output video in pixels.

Dimensions

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

ResolutionAspect RatioPixel Values (Width x Height)
480p16:9 (Landscape)832x480
4:5576x720
2:3512x768
9:16 (Portrait)480x832
720p16:9 (Landscape)1280x720
9:16 (Portrait)720x1280
AutoDetermined by the model0x0

Both width and height must be supplied together, or omitted together.


Did this page help you?