Leonardo.AI
App · 20 actions
Generate images, improve prompts, manage datasets and inspect models, elements and generation jobs.
Actions
| Action | What it does |
|---|---|
| Create dataset | Create dataset. |
| Create generation | Create generation. |
| Delete dataset | Delete dataset. |
| Delete generation | Delete generation. |
| Delete init image | Delete init image. |
| Generate random prompt | Generate random prompt. |
| Get dataset | Get dataset. |
| Get element | Get element. |
| Get generation | Get generation. |
| Get init image | Get init image. |
| Get model | Get model. |
| Get user | Get user. |
| Get variations | Get variations. |
| Improve prompt | Improve prompt. |
| List custom elements | List custom elements. |
| List custom models | List custom models. |
| List elements | List elements. |
| List generations | List generations. |
| List platform models | List platform models. |
| Upscale image | Upscale image. |
Create dataset
Create dataset.
Inputs
- Name
nametextRequired - The name of the dataset.
- Description
descriptiontext - A description for the dataset.
Outputs
dataobject- Response.
Example output
{
"data": {
"insert_datasets_one": {
"id": "example"
}
}
}Create generation
Create generation.
Inputs
- Alchemy
alchemytrue/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 ratio
contrast_rationumber - Contrast Ratio to use with Alchemy. Must be a float between 0 and 1 inclusive.
- Contrast
contrastnumber - 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.
- Controlnets
controlnetslist - Controlnets.
- Elements
elementslist - Elements.
- User elements
user_elementslist - User elements.
- Expanded domain
expanded_domaintrue/false - Enable to use the Expanded Domain feature of Alchemy.
- Fantasy avatar
fantasy_avatartrue/false - Enable to use the Fantasy Avatar feature.
- Guidance scale
guidance_scalenumber - How strongly the generation should reflect the prompt. 7 is recommended. Must be between 1 and 20.
- Height
heightnumber - 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 contrast
high_contrasttrue/false - Enable to use the High Contrast feature of Prompt Magic. Note: Controls RAW mode. Set to false to enable RAW mode.
- High resolution
high_resolutiontrue/false - Enable to use the High Resolution feature of Prompt Magic.
- Image prompts
image_promptslist - Image prompts.
- Image prompt weight
image_prompt_weightnumber - Image prompt weight.
- Init generation image ID
init_generation_image_idtext - The ID of an existing image to use in image2image.
- Init image ID
init_image_idtext - The ID of an Init Image to use in image2image.
- Init strength
init_strengthnumber - How strongly the generated images should reflect the original image in image2image. Must be a float between 0.1 and 0.9.
- Model
model_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 prompt
negative_prompttext - The negative prompt used for the image generation
- Num images
num_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 steps
num_inference_stepsnumber - The Step Count to use for the generation. Must be between 10 and 60. Default is 15.
- Photo real
photo_realtrue/false - Enable the photoReal feature. Requires enabling alchemy and unspecifying modelId (for photoRealVersion V1).
- Photo real version
photo_real_versiontext - The version of photoReal to use. Must be v1 or v2.
- Photo real strength
photo_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 style
preset_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. - Prompt
prompttextRequired - The prompt used to generate images
- Prompt magic
prompt_magictrue/false - Enable to use Prompt Magic.
- Prompt magic strength
prompt_magic_strengthnumber - Strength of prompt magic. Must be a float between 0.1 and 1.0
- Prompt magic version
prompt_magic_versiontext - Prompt magic version v2 or v3, for use when promptMagic: true
- Public
publictrue/false - Whether the generated images should show in the community feed.
- Scheduler
schedulertext - 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 version
sd_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). - Seed
seednumber - Apply a fixed seed to maintain consistency across generation sets. The maximum seed value is 2147483637 for Flux and 9999999998 for other models
- Tiling
tilingtrue/false - Whether the generated images should tile on all axis.
- Transparency
transparencytext - Which type of transparency this image should useOne of:
disabled,foreground_only(Foreground only). - Ultra
ultratrue/false - Enable to use Ultra mode. Note: can not be used with Alchemy.
- Unzoom
unzoomtrue/false - Whether the generated images should be unzoomed (requires unzoomAmount and init_image_id to be set).
- Unzoom amount
unzoom_amountnumber - How much the image should be unzoomed (requires an init_image_id and unzoom to be set to true).
- Upscale ratio
upscale_rationumber - How much the image should be upscaled. (Enterprise Only)
- Width
widthnumber - 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 net
control_nettrue/false - This parameter will be deprecated in September 2024. Please use the controlnets array instead.
- Control net type
control_net_typetext - This parameter will be deprecated in September 2024. Please use the controlnets array instead.One of:
POSE,CANNY,DEPTH. - Weighting
weightingnumber - This parameter will be deprecated in September 2024. Please use the controlnets array instead.
- Canvas request
canvas_requesttrue/false - Whether the generation is for the Canvas Editor feature.
- Canvas request type
canvas_request_typetext - The type of request for the Canvas Editor.One of:
INPAINT,OUTPAINT,SKETCH2IMG,IMG2IMG. - Canvas init ID
canvas_init_idtext - The ID of an initial image to use in Canvas Editor request.
- Canvas mask ID
canvas_mask_idtext - The ID of a mask image to use in Canvas Editor request.
- Enhance prompt
enhance_prompttrue/false - When enabled, your prompt is expanded to include more detail.
- Enhance prompt instruction
enhance_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
- Id
idtextRequired - Id.
Outputs
dataobject- Response.
Example output
{
"data": {
"delete_datasets_by_pk": {
"id": "example"
}
}
}Delete generation
Delete generation.
Inputs
- Id
idtextRequired - Id.
Outputs
dataobject- Response.
Example output
{
"data": {
"delete_generations_by_pk": {
"id": "example"
}
}
}Delete init image
Delete init image.
Inputs
- Id
idtextRequired - 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
- Id
idtextRequired - 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
- Id
idnumberRequired - 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
- Id
idtextRequired - 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
- Id
idtextRequired - Id.
Outputs
dataobject- Response.
Example output
{
"data": {
"init_images_by_pk": {
"createdAt": "example",
"id": "example",
"url": "example"
}
}
}Get model
Get model.
Inputs
- Id
idtextRequired - 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
- Id
idtextRequired - Id.
Outputs
dataobject- Response.
Example output
{
"data": {
"generated_image_variation_generic": []
}
}Improve prompt
Improve prompt.
Inputs
- Prompt
prompttextRequired - The prompt to improve.
- Prompt instructions
prompt_instructionstext - The prompt is improved based on the given instructions.
- Is video
is_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 ID
leonardo_user_idtextRequired - User ID.
Outputs
dataobject- Response.
Example output
{
"data": {
"user_loras": []
}
}List custom models
List custom models.
Inputs
- Leonardo user ID
leonardo_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
- Offset
offsetnumber - Offset.Default:
0. - Limit
limitnumber - Limit.Default:
10. - Leonardo user ID
leonardo_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
- Id
idtextRequired - Id.
Outputs
dataobject- Response.
Example output
{
"data": {
"sdUpscaleJob": {
"apiCreditCost": 1,
"cost": {
"amount": "example",
"unit": "CREDITS"
},
"id": "example"
}
}
}