Wan 3.0

This guide shows how to generate videos using the Wan 3.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": "alibaba/wan-3.0",
    "public": false,
    "parameters": {
      "prompt": "The koala plays with the cat in a sunlit eucalyptus grove",
      "guidances": {
        "start_frame": [
          {
            "image": {
              "id": "<YOUR_START_IMAGE_ID>",
              "type": "UPLOADED"
            }
          }
        ],
        "end_frame": [
          {
            "image": {
              "id": "<YOUR_END_IMAGE_ID>",
              "type": "UPLOADED"
            }
          }
        ]
      },
      "duration": 5,
      "resolution": "1080p",
      "motion_has_audio": true,
      "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. Any whole number from 2 to 30. Defaults to 5.
guidances.audio_referencearrayAudio references used to guide the generation. Maximum 5 items. Each item includes audio.id and audio.type (GENERATED or UPLOADED), and optionally audio.url and audio.duration.
guidances.end_framearrayMaximum 1 item. Each item includes image.id and image.type (UPLOADED, GENERATED, VARIATION, URL, or BASE64). Creative reinterpretation of vibe or structure from a reference image.
guidances.image_referencearrayReferences images to guide your video generation. Maximum 10 items. Each item includes image.id and image.type, and optionally order to control its position in the list of guidances.
guidances.start_framearrayMaximum 1 item. Each item includes image.id and image.type (UPLOADED, GENERATED, VARIATION, URL, or BASE64). Creative reinterpretation of vibe or structure from a reference image.
guidances.video_reference_basearrayBase video to be edited. Maximum 5 items. Each item includes video.id and video.type (GENERATED or UPLOADED).
guidances.webpage_referencearrayA public webpage URL whose content guides the generation. Maximum 1 item. Each item includes webpage.url, which must be publicly accessible.
heightnumberSets the height of the output video in pixels. Set to 0 to derive the height from resolution.
modelstringSpecifies the model used for generation. Set to alibaba/wan-3.0. Required.
motion_has_audiobooleanWhether the video generation will include audio. Defaults to true.
promptstringText description of the video content to generate. Maximum of 5000 characters. Required.
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 tier, used when width and height are automatic (0). Explicit dimensions take precedence. Valid values are 480p, 720p, and 1080p. Defaults to 480p.
seednumberThe seed value for generation. Supports 0 to 2147483647.
widthnumberSets the width of the output video in pixels. Set to 0 to derive the width from resolution.

Dimensions

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

ResolutionAspect RatioPixel Values (Width x Height)
480p16:9 (Landscape)854x480
4:3736x552
1:1 (Square)640x640
3:4552x736
9:16 (Portrait)480x854
720p16:9 (Landscape)1280x720
4:31104x828
1:1 (Square)960x960
3:4828x1104
9:16 (Portrait)720x1280
1080p16:9 (Landscape)1920x1080
4:31656x1242
1:1 (Square)1440x1440
3:41242x1656
9:16 (Portrait)1080x1920
AutomaticDerived from resolution0x0

Did this page help you?