(model)
- createModel - Train a Custom Model
- delete3DModelById - Delete 3D Model by ID
- deleteModelById - Delete a Single Custom Model by ID
- getModelById - Get a Single Custom Model by ID
- listPlatformModels - List Platform Models
- uploadModelAsset - Upload 3D Model
This endpoint will train a new custom model
import { Leonardo } from "@leonardo-ai/sdk";
const leonardo = new Leonardo({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await leonardo.model.createModel({
datasetId: "<value>",
instancePrompt: "<value>",
name: "<value>",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateModelRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.CreateModelResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
This endpoint deletes the specific 3D Model
import { Leonardo } from "@leonardo-ai/sdk";
const leonardo = new Leonardo({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await leonardo.model.delete3DModelById("<value>", {});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | "id" is required (enter it either in parameters or request body) |
requestBody |
operations.Delete3DModelByIdRequestBody | ➖ | Query parameters can also be provided in the request body as a JSON object |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.Delete3DModelByIdResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
This endpoint will delete a specific custom model
import { Leonardo } from "@leonardo-ai/sdk";
const leonardo = new Leonardo({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await leonardo.model.deleteModelById("<value>");
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The ID of the model to delete. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.DeleteModelByIdResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
This endpoint gets the specific custom model
import { Leonardo } from "@leonardo-ai/sdk";
const leonardo = new Leonardo({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await leonardo.model.getModelById("<value>");
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The ID of the custom model to return. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.GetModelByIdResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Get a list of public Platform Models available for use with generations.
import { Leonardo } from "@leonardo-ai/sdk";
const leonardo = new Leonardo({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await leonardo.model.listPlatformModels();
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.ListPlatformModelsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
This endpoint returns presigned details to upload a 3D model to S3
import { Leonardo } from "@leonardo-ai/sdk";
const leonardo = new Leonardo({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await leonardo.model.uploadModelAsset({});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UploadModelAssetRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.UploadModelAssetResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |