Leonardo.AI

App · 20 actions

Generate images, improve prompts, manage datasets and inspect models, elements and generation jobs.

Actions

ActionWhat it does
Create datasetCreate dataset.
Create generationCreate generation.
Delete datasetDelete dataset.
Delete generationDelete generation.
Delete init imageDelete init image.
Generate random promptGenerate random prompt.
Get datasetGet dataset.
Get elementGet element.
Get generationGet generation.
Get init imageGet init image.
Get modelGet model.
Get userGet user.
Get variationsGet variations.
Improve promptImprove prompt.
List custom elementsList custom elements.
List custom modelsList custom models.
List elementsList elements.
List generationsList generations.
List platform modelsList platform models.
Upscale imageUpscale image.

Create dataset

Create dataset.

Inputs

NamenametextRequired
The name of the dataset.
Descriptiondescriptiontext
A description for the dataset.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "insert_datasets_one": {
      "id": "example"
    }
  }
}

Create generation

Create generation.

Inputs

Alchemyalchemytrue/false
Enable to use Alchemy. Note: The appropriate Alchemy version is selected for the specified model. For example, XL models will use Alchemy V2.Default: true.
Contrast ratiocontrast_rationumber
Contrast Ratio to use with Alchemy. Must be a float between 0 and 1 inclusive.
Contrastcontrastnumber
Adjusts the contrast level of the generated image. Used in Phoenix and Flux models. Accepts values [1.0, 1.3, 1.8, 2.5, 3, 3.5, 4, 4.5]. For Phoenix, if alchemy is true, contrast needs to be 2.5 or higher.From 1 to 4.5.
Controlnetscontrolnetslist
Controlnets.
Elementselementslist
Elements.
User elementsuser_elementslist
User elements.
Expanded domainexpanded_domaintrue/false
Enable to use the Expanded Domain feature of Alchemy.
Fantasy avatarfantasy_avatartrue/false
Enable to use the Fantasy Avatar feature.
Guidance scaleguidance_scalenumber
How strongly the generation should reflect the prompt. 7 is recommended. Must be between 1 and 20.
Heightheightnumber
The input height of the images. Must be between 32 and 1536 and be a multiple of 8. Note: Input resolution is not always the same as output resolution due to upscaling from other features.Default: 768.
High contrasthigh_contrasttrue/false
Enable to use the High Contrast feature of Prompt Magic. Note: Controls RAW mode. Set to false to enable RAW mode.
High resolutionhigh_resolutiontrue/false
Enable to use the High Resolution feature of Prompt Magic.
Image promptsimage_promptslist
Image prompts.
Image prompt weightimage_prompt_weightnumber
Image prompt weight.
Init generation image IDinit_generation_image_idtext
The ID of an existing image to use in image2image.
Init image IDinit_image_idtext
The ID of an Init Image to use in image2image.
Init strengthinit_strengthnumber
How strongly the generated images should reflect the original image in image2image. Must be a float between 0.1 and 0.9.
Modelmodel_idtext
The model ID used for image generation. If not provided, uses sd_version to determine the version of Stable Diffusion to use. In-app, model IDs are under the Finetune Models menu. Click on the platform model or your custom model, then click View More. For platform models, you can also use the List Platform Models API.
Negative promptnegative_prompttext
The negative prompt used for the image generation
Num imagesnum_imagesnumber
The number of images to generate. Must be between 1 and 8. If either width or height is over 768, must be between 1 and 4.Default: 1.
Num inference stepsnum_inference_stepsnumber
The Step Count to use for the generation. Must be between 10 and 60. Default is 15.
Photo realphoto_realtrue/false
Enable the photoReal feature. Requires enabling alchemy and unspecifying modelId (for photoRealVersion V1).
Photo real versionphoto_real_versiontext
The version of photoReal to use. Must be v1 or v2.
Photo real strengthphoto_real_strengthnumber
Depth of field of photoReal. Must be 0.55 for low, 0.5 for medium, or 0.45 for high. Defaults to 0.55 if not specified.
Preset stylepreset_styletext
The style to generate images with. When photoReal is enabled, refer to the Guide section for a full list. When alchemy is disabled, use LEONARDO or NONE. When alchemy is enabled, use ANIME, CREATIVE, DYNAMIC, ENVIRONMENT, GENERAL, ILLUSTRATION, PHOTOGRAPHY, RAYTRACED, RENDER_3D, SKETCH_BW, SKETCH_COLOR, or NONE.One of: ANIME, BOKEH, CINEMATIC, CINEMATIC_CLOSEUP (Cinematic closeup), CREATIVE, DYNAMIC, ENVIRONMENT, FASHION, FILM, FOOD, and 21 more. Default: DYNAMIC.
PromptprompttextRequired
The prompt used to generate images
Prompt magicprompt_magictrue/false
Enable to use Prompt Magic.
Prompt magic strengthprompt_magic_strengthnumber
Strength of prompt magic. Must be a float between 0.1 and 1.0
Prompt magic versionprompt_magic_versiontext
Prompt magic version v2 or v3, for use when promptMagic: true
Publicpublictrue/false
Whether the generated images should show in the community feed.
Schedulerschedulertext
The scheduler to generate images with. Defaults to EULER_DISCRETE if not specified.One of: KLMS, EULER_ANCESTRAL_DISCRETE (Euler ancestral discrete), EULER_DISCRETE (Euler discrete), DDIM, DPM_SOLVER (Dpm solver), PNDM, LEONARDO.
Sd versionsd_versiontext
The base version of stable diffusion to use if not using a custom model. v1_5 is 1.5, v2 is 2.1, if not specified it will default to v1_5. Also includes SDXL and SDXL Lightning modelsOne of: v1_5 (V1 5), v2, v3, SDXL_0_8 (Sdxl 0 8), SDXL_0_9 (Sdxl 0 9), SDXL_1_0 (Sdxl 1 0), SDXL_LIGHTNING (Sdxl lightning), PHOENIX, FLUX, FLUX_DEV (Flux dev), KINO_2_0 (Kino 2 0).
Seedseednumber
Apply a fixed seed to maintain consistency across generation sets. The maximum seed value is 2147483637 for Flux and 9999999998 for other models
Tilingtilingtrue/false
Whether the generated images should tile on all axis.
Transparencytransparencytext
Which type of transparency this image should useOne of: disabled, foreground_only (Foreground only).
Ultraultratrue/false
Enable to use Ultra mode. Note: can not be used with Alchemy.
Unzoomunzoomtrue/false
Whether the generated images should be unzoomed (requires unzoomAmount and init_image_id to be set).
Unzoom amountunzoom_amountnumber
How much the image should be unzoomed (requires an init_image_id and unzoom to be set to true).
Upscale ratioupscale_rationumber
How much the image should be upscaled. (Enterprise Only)
Widthwidthnumber
The input width of the images. Must be between 32 and 1536 and be a multiple of 8. Note: Input resolution is not always the same as output resolution due to upscaling from other features.Default: 1024.
Control netcontrol_nettrue/false
This parameter will be deprecated in September 2024. Please use the controlnets array instead.
Control net typecontrol_net_typetext
This parameter will be deprecated in September 2024. Please use the controlnets array instead.One of: POSE, CANNY, DEPTH.
Weightingweightingnumber
This parameter will be deprecated in September 2024. Please use the controlnets array instead.
Canvas requestcanvas_requesttrue/false
Whether the generation is for the Canvas Editor feature.
Canvas request typecanvas_request_typetext
The type of request for the Canvas Editor.One of: INPAINT, OUTPAINT, SKETCH2IMG, IMG2IMG.
Canvas init IDcanvas_init_idtext
The ID of an initial image to use in Canvas Editor request.
Canvas mask IDcanvas_mask_idtext
The ID of a mask image to use in Canvas Editor request.
Enhance promptenhance_prompttrue/false
When enabled, your prompt is expanded to include more detail.
Enhance prompt instructionenhance_prompt_instructiontext
When enhancePrompt is enabled, the prompt is enhanced based on the given instructions.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "sdGenerationJob": {
      "apiCreditCost": 1,
      "cost": {
        "amount": "example",
        "unit": "CREDITS"
      },
      "generationId": "example"
    }
  }
}

Delete dataset

Delete dataset.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "delete_datasets_by_pk": {
      "id": "example"
    }
  }
}

Delete generation

Delete generation.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "delete_generations_by_pk": {
      "id": "example"
    }
  }
}

Delete init image

Delete init image.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "delete_init_images_by_pk": {
      "id": "example"
    }
  }
}

Generate random prompt

Generate random prompt.

Inputs

None.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "promptGeneration": {
      "apiCreditCost": 1,
      "cost": {
        "amount": "example",
        "unit": "CREDITS"
      },
      "prompt": "example"
    }
  }
}

Get dataset

Get dataset.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "datasets_by_pk": {
      "createdAt": "example",
      "dataset_images": [],
      "description": "example",
      "id": "example",
      "name": "example",
      "updatedAt": "example"
    }
  }
}

Get element

Get element.

Inputs

IdidnumberRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "user_loras_by_pk": {
      "baseModel": "example",
      "createdAt": "example",
      "description": "example",
      "focus": "example",
      "id": 1,
      "instancePrompt": "example",
      "learningRate": 1.0,
      "name": "example",
      "resolution": 1,
      "status": "PENDING",
      "trainTextEncoder": false,
      "trainingEpoch": 1,
      "updatedAt": "example"
    }
  }
}

Get generation

Get generation.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "generations_by_pk": {
      "createdAt": "example",
      "generated_images": [],
      "generation_elements": [],
      "guidanceScale": 1.0,
      "id": "example",
      "imageHeight": 1,
      "imageWidth": 1,
      "inferenceSteps": 1,
      "initStrength": 1.0,
      "modelId": "example",
      "negativePrompt": "example",
      "photoReal": false,
      "photoRealStrength": 1.0,
      "presetStyle": "ANIME",
      "prompt": "example",
      "promptMagic": false,
      "promptMagicStrength": 1.0,
      "promptMagicVersion": "example",
      "public": false,
      "scheduler": "KLMS",
      "sdVersion": "v1_5",
      "seed": 1,
      "status": "PENDING",
      "ultra": false
    }
  }
}

Get init image

Get init image.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "init_images_by_pk": {
      "createdAt": "example",
      "id": "example",
      "url": "example"
    }
  }
}

Get model

Get model.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "custom_models_by_pk": {
      "createdAt": "example",
      "description": "example",
      "id": "example",
      "instancePrompt": "example",
      "modelHeight": 1,
      "modelWidth": 1,
      "name": "example",
      "public": false,
      "sdVersion": "v1_5",
      "status": "PENDING",
      "type": "GENERAL",
      "updatedAt": "example"
    }
  }
}

Get user

Get user.

Inputs

None.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "user_details": []
  }
}

Get variations

Get variations.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "generated_image_variation_generic": []
  }
}

Improve prompt

Improve prompt.

Inputs

PromptprompttextRequired
The prompt to improve.
Prompt instructionsprompt_instructionstext
The prompt is improved based on the given instructions.
Is videois_videotrue/false
Specifies whether the prompt is for a video generation. Defaults to false (image prompt).

Outputs

dataobject
Response.
Example output
{
  "data": {
    "promptGeneration": {
      "apiCreditCost": 1,
      "cost": {
        "amount": "example",
        "unit": "CREDITS"
      },
      "prompt": "example"
    }
  }
}

List custom elements

List custom elements.

Inputs

Leonardo user IDleonardo_user_idtextRequired
User ID.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "user_loras": []
  }
}

List custom models

List custom models.

Inputs

Leonardo user IDleonardo_user_idtextRequired
User ID.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "custom_models": []
  }
}

List elements

List elements.

Inputs

None.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "loras": []
  }
}

List generations

List generations.

Inputs

Offsetoffsetnumber
Offset.Default: 0.
Limitlimitnumber
Limit.Default: 10.
Leonardo user IDleonardo_user_idtextRequired
User ID.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "generations": []
  }
}

List platform models

List platform models.

Inputs

None.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "custom_models": []
  }
}

Upscale image

Upscale image.

Inputs

IdidtextRequired
Id.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "sdUpscaleJob": {
      "apiCreditCost": 1,
      "cost": {
        "amount": "example",
        "unit": "CREDITS"
      },
      "id": "example"
    }
  }
}

On this page