Generate Images Using Fantasy Avatar [Beta]

❗️

Deprecating Feature

The Fantasy Avatar Feature will be deprecating in the near future. We recommend using Character Reference for a more accurate character control feature, this will be compatible with other multiple Control Nets.

Left: Input image of a face (face_image.jpg). Right: Output image with the prompt “a witch”

Left: Input image of a face (face_image.jpg). Right: Output image with the prompt “a witch”

Fantasy Avatar is a feature for generating images with a face input image and a prompt. The face is used to influence the output, great for generating creative selfies and portraits.

📘

Fantasy Avatar is currently on public beta.

Please let us know your feedback by reaching out to support.

Follow this recipe to generate images using Fantasy Avatar:

Sample Request

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v1/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '
{
  "height": 512,
  "fantasyAvatar": true,
  "prompt": "A witch",
  "width": 512,
  "num_images": 1,
  "init_image_id": <YOUR_INIT_IMAGE_ID>
}
'

Required Parameters

  • fantasyAvatar - Enable the Fantasy Avatar feature.
  • prompt - The prompt used to generate images.
  • init_image_id - Image ID of uploaded photo. Must be a single human face facing forward.

Recommended Parameters

  • width - The input width of the images. Default is 512. Max is 1024 and must be a multiple of 8. Best set to 640.
  • height - The input height of the images. Default is 512. Max is 1024 and must be a multiple of 8. Best set to 832.
  • negative_prompt - The negative prompt used to generate images. Best to have negative prompts.
  • num_images - The number of output images. Default is 4.

Other Parameters

  • seed - Default is no seed.
  • guidance_scale - The strength of the influence of the input image. Recommended and default is 7. Must be between 1 and 20.

Ignored Parameters

All other parameters listed in the Create a Generation of Images API endpoint that are not listed above are ignored. Enabling fantasyAvatar will disable other additional settings.

Cost

Image DimensionAPI Credit Cost
512 x 51220 per image
640 x 83224 per image
1024 x 102425 per image