openapi: 3.0.0
info:
title: Leonardo.AI 3D Model Assets Elements API
description: Upload, retrieve, and delete 3D model assets for use with Rodin and other 3D-capable workflows.
version: v1.0.0
contact:
name: Leonardo.AI Support
url: https://docs.leonardo.ai/docs/need-more-support
license:
name: Leonardo.AI Terms of Service
url: https://leonardo.ai/terms-of-service/
servers:
- url: https://cloud.leonardo.ai/api/rest/v1
description: Leonardo.AI Production API
security:
- bearerAuth: []
tags:
- name: Elements
paths:
/elements/{id}:
get:
tags:
- Elements
summary: Get a Single Custom Element by ID
description: This endpoint gets the specific custom element.
operationId: getElementById
parameters:
- required: true
description: The ID of the custom element to return.
in: path
name: id
schema:
pattern: '[0-9]{*}'
type: integer
responses:
'200':
content:
application/json:
schema:
type: object
properties:
user_loras_by_pk:
description: columns and relationships of "user_loras".
nullable: true
properties:
createdAt:
$ref: '#/components/schemas/timestamp'
description:
nullable: false
title: String
type: string
id:
nullable: false
title: Int
type: integer
instancePrompt:
nullable: true
title: String
type: string
resolution:
nullable: false
title: Int
type: integer
learningRate:
nullable: false
title: Float
type: number
trainingEpoch:
nullable: false
title: Int
type: integer
name:
nullable: false
title: String
type: string
trainTextEncoder:
nullable: false
title: Boolean
type: boolean
baseModel:
nullable: false
title: String
type: string
status:
$ref: '#/components/schemas/job_status'
focus:
nullable: false
title: String
type: string
updatedAt:
$ref: '#/components/schemas/timestamp'
title: user_loras
type: object
description: Responses for GET /elements/{id}.
delete:
tags:
- Elements
summary: Delete a Single Custom Element by ID
description: This endpoint will delete a specific custom model.
operationId: deleteElementById
parameters:
- required: true
description: The ID of the element to delete.
in: path
name: id
schema:
pattern: '[0-9]{*}'
type: integer
responses:
'200':
content:
application/json:
schema:
type: object
properties:
delete_user_loras_by_pk:
description: columns and relationships of "user_loras".
nullable: true
properties:
id:
nullable: false
title: Int
type: integer
title: user_loras
type: object
description: Responses for DELETE /models/{id}
/elements/user/{userId}:
get:
tags:
- Elements
summary: Get a list of Custom Elements by User ID
description: This endpoint gets the list of custom elements belongs to the user.
operationId: getCustomElementsByUserId
parameters:
- required: true
description: The ID of the user to return.
in: path
name: userId
schema:
pattern: '[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}'
type: string
responses:
'200':
content:
application/json:
schema:
properties:
user_loras:
items:
description: columns and relationships of "user_loras".
nullable: true
title: user_loras
type: object
properties:
createdAt:
$ref: '#/components/schemas/timestamp'
description:
nullable: false
title: String
type: string
id:
nullable: false
title: Int
type: integer
instancePrompt:
nullable: true
title: String
type: string
resolution:
nullable: false
title: Int
type: integer
learningRate:
nullable: false
title: Float
type: number
trainingEpoch:
nullable: false
title: Int
type: integer
name:
nullable: false
title: String
type: string
trainTextEncoder:
nullable: false
title: Boolean
type: boolean
baseModel:
nullable: false
title: String
type: string
status:
$ref: '#/components/schemas/job_status'
focus:
nullable: false
title: String
type: string
updatedAt:
$ref: '#/components/schemas/timestamp'
nullable: true
type: array
description: Responses for GET /elements/user/{userId}.
/elements:
post:
tags:
- Elements
summary: Train a Custom Element
description: This endpoint will train a new custom element.
operationId: createElement
requestBody:
content:
application/json:
schema:
properties:
name:
default: placeholder
nullable: false
title: String
type: string
description: The name of the element.
description:
default: ''
nullable: true
title: String
type: string
description: The description of the element.
datasetId:
default: ''
nullable: false
title: String
type: string
description: The ID of the dataset to train the element on.
instance_prompt:
default: ''
nullable: true
title: String
type: string
description: Use a word that is closely related to what you're training that isn't too common. For example, instead of 'dog,' try something unique like 'jackthedog' or 'magicdonut'. Required for all non-FLUX_DEV models and FLUX_DEV Character model training.
lora_focus:
nullable: false
title: String
type: string
description: The category determines how the element will be trained. Options are 'General' | 'Character' | 'Style' | 'Object'. FLUX_DEV doesn't support General category.
train_text_encoder:
default: true
nullable: false
title: Boolean
type: boolean
description: Whether or not encode the train text.
resolution:
default: 1024
nullable: true
title: Int
type: integer
description: The resolution for training. Must be 1024.
sd_version:
nullable: false
default: FLUX_DEV
title: sd_versions
enum:
- SDXL_0_9
- SDXL_1_0
- LEONARDO_DIFFUSION_XL
- LEONARDO_LIGHTNING_XL
- VISION_XL
- KINO_XL
- ALBEDO_XL
- FLUX_DEV
description: The base version to use if not using a custom model.
num_train_epochs:
nullable: false
title: Int
type: integer
description: The number of times the entire training dataset is passed through the element.
| Model Type | Lora Focus | Min | Max | Default |
|---|
| Default | General | Style | Character | Object | 1 | 250 | 100 |
| FLUX_DEV | Style | 30 | 120 | 60 |
| Object | 120 | 220 | 140 |
| Character | 100 | 200 | 135 |
| General | NA |
learning_rate:
nullable: false
title: Float
type: number
description: The speed at which the model learns during training.
| Model Type | Lora Focus | Min | Max | Default |
|---|
| Default | General | Style | Character | Object | 0.00000001 | 0.00001 | 0.000001 |
| FLUX_DEV | Style | 0.000001 | 0.00003 | 0.00001 |
| Object | 0.00001 | 0.001 | 0.0004 |
| Character | 0.00001 | 0.001 | 0.0005 |
| General | NA |
required:
- name
- datasetId
- lora_focus
- sd_version
- learning_rate
- num_train_epochs
- train_text_encoder
type: object
description: Query parameters to be provided in the request body as a JSON object.
required: true
responses:
'200':
content:
application/json:
schema:
type: object
properties:
sdTrainingJob:
nullable: true
properties:
userLoraId:
nullable: false
title: Int
type: integer
apiCreditCost:
nullable: true
type: integer
description: 'API Credits Cost for Model Training. Available for Production API Users. Note: it will be deprecated. Please use the cost instead.'
deprecated: true
cost:
$ref: '#/components/schemas/cost'
title: SDTrainingOutput
type: object
example:
sdTrainingJob:
userLoraId: 123456
apiCreditCost: null
cost:
amount: '0.0147'
unit: DOLLARS
description: Responses for POST /elements.
get:
tags:
- Elements
summary: List Elements
description: Get a list of public Elements available for use with generations.
operationId: listElements
responses:
'200':
content:
application/json:
schema:
properties:
loras:
items:
description: columns and relationships of "elements".
nullable: false
properties:
akUUID:
$ref: '#/components/schemas/lora/properties/akUUID'
baseModel:
$ref: '#/components/schemas/sd_versions'
creatorName:
$ref: '#/components/schemas/lora/properties/creatorName'
description:
$ref: '#/components/schemas/lora/properties/description'
name:
$ref: '#/components/schemas/lora/properties/name'
urlImage:
$ref: '#/components/schemas/lora/properties/urlImage'
weightDefault:
$ref: '#/components/schemas/lora/properties/weightDefault'
weightMax:
$ref: '#/components/schemas/lora/properties/weightMax'
weightMin:
$ref: '#/components/schemas/lora/properties/weightMin'
title: loras
type: object
nullable: false
type: array
description: Responses for GET /api/rest/v1/elements.
components:
schemas:
timestamp:
type: string
nullable: false
title: timestamp
lora:
properties:
weightDefault:
nullable: true
type: integer
description: Default weight for the element
description:
nullable: true
type: string
description: Description for the element
name:
nullable: true
type: string
description: Name of the element
creatorName:
nullable: true
type: string
description: Name of the creator of the element
urlImage:
nullable: true
type: string
description: URL of the element image
weightMin:
nullable: true
type: integer
description: Minimum weight for the element
weightMax:
nullable: true
type: integer
description: Maximum weight for the element
akUUID:
nullable: true
type: string
description: Unique identifier for the element. Elements can be found from the List Elements endpoint.
sd_versions:
type: string
nullable: false
title: sd_versions
enum:
- v1_5
- v2
- v3
- SDXL_0_8
- SDXL_0_9
- SDXL_1_0
- SDXL_LIGHTNING
- PHOENIX
- FLUX
- FLUX_DEV
- KINO_2_0
description: 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 models
job_status:
type: string
nullable: false
title: job_status
enum:
- PENDING
- COMPLETE
- FAILED
description: The status of the current task.
cost:
nullable: true
type: object
title: Cost
description: The cost of the operation.
properties:
amount:
type: string
description: The amount of the cost.
unit:
type: string
enum:
- CREDITS
- DOLLARS
description: 'The unit of the cost. Can be CREDITS or DOLLARS. Note: DOLLARS unit only supports PAYG plan.'
securitySchemes:
bearerAuth:
type: http
bearerFormat: auth-scheme
description: 'Bearer HTTP authentication. Allowed headers `Authorization: Bearer `'
scheme: bearer