Wan 2.7

This guide shows how to generate videos using the Wan 2.7 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": "wan-2.7",
    "public": false,
    "parameters": {
      "prompt": "The koala 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": 1920,
      "height": 1080
    }
}
'

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 in seconds. Set to 2, 3, 4, 5, 6, 7, 8, 9, or 10. Defaults to 5.
guidances.end_framearrayMaximum 1 item. Each item includes image.id and image.type (GENERATED or UPLOADED).
guidances.image_referencearrayReference images to guide the video generation. Each item includes image.id, image.type (GENERATED or UPLOADED), and strength (LOW, MID, or HIGH; defaults to MID).
guidances.start_framearrayMaximum 1 item. Each item includes image.id and image.type (GENERATED or UPLOADED).
guidances.video_reference_basearrayMaximum 1 item. Base video to be edited. Each item includes a video object with id and type (UPLOADED or GENERATED), and an optional item-level type (BASE or FEATURE): BASE routes to edit-video, FEATURE routes to reference-to-video.
heightnumberSets the height of the output video in pixels.
modelstringSpecifies the model used for generation. Set to wan-2.7.
promptstringText description of the video content to generate. Maximum of 2500 characters.
publicbooleanControls whether the generated video is public (true) or private (false).
quantitynumberNumber of outputs to generate. Defaults to 1 (maximum 1).
resolutionstringOutput resolution for edit mode. Set to 720p or 1080p. Defaults to 1080p.
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)
720p16:9 (Landscape)1280x720
1:1 (Square)960x960
9:16 (Portrait)720x1280
1080p16:9 (Landscape)1920x1080
1:1 (Square)1440x1440
9:16 (Portrait)1080x1920
Auto0x0