Wan 2.6

This guide shows how to generate videos using the Wan 2.6 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.6",
    "public": false,
    "parameters": {
      "prompt": "The koala plays with the cat",
      "guidances": {
        "start_frame": [
          {
            "image": {
              "id": "<YOUR_START_IMAGE_ID>",
              "type": "UPLOADED"
            }
          }
        ]
      },
      "duration": 5,
      "negative_prompt": "",
      "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
durationnumberDuration of the video in seconds. Set to 5, 10, or 15. Defaults to 5.
guidances.audio_referencearrayMaximum 1 item. Each item includes audio.id and audio.type (UPLOADED). Specifies an audio reference for guidance.
guidances.start_framearrayMaximum 1 item. Each item includes image.id and image.type (INIT, GENERATION, UPLOADED, GENERATED, or VARIATION).
guidances.video_reference_basearrayMaximum 3 items. Each item includes video.id and video.type (UPLOADED or GENERATED). Base video to be edited.
heightnumberSets the height of the output video in pixels. See Dimensions for valid width and height combinations.
modelstringSpecifies the model used for generation. Set to wan-2.6.
negative_promptstringText description of content to avoid in the generated video. Maximum of 500 characters. Defaults to "".
promptstringText description of the video content to generate. Maximum of 1500 characters.
publicbooleanControls whether the generated video is public (true) or private (false).
quantitynumberThe number of outputs to generate. Set to 1. Defaults to 1.
resolutionstringOutput resolution when using AUTO dimensions (width: 0, height: 0) for image-to-video. Valid values are 720p and 1080p. Determines cost tier. Defaults to 1080p.
seednumberRandom seed for reproducible generation. Set between 0 and 2147483647.
widthnumberSets the width of the output video in pixels. See Dimensions for valid width and height combinations.

Dimensions

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

ResolutionAspect RatioPixel Values (Width x Height)
720p16:9 (Landscape)1280x720
4:3960x720
1:1 (Square)960x960
3:4720x960
9:16 (Portrait)720x1280
1080p16:9 (Landscape)1920x1080
4:31440x1080
1:1 (Square)1440x1440
3:41080x1440
9:16 (Portrait)1080x1920
Auto0x0

Setting width: 0 and height: 0 (AUTO) lets the model infer dimensions; use the resolution parameter to control the output resolution tier.


Did this page help you?