Skip to main content

Delete Model

Deletes a custom model from Leonardo AI.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Connection Id (String) - Connection ID from the Connect node (optional if API Key credentials are provided directly).
  • Model ID (String) - ID of the custom model to delete.

Options

  • API Key - Leonardo AI API key (optional if using Connection ID).

Outputs

  • Response (String) - ID of the deleted model.

How It Works

The Delete Model node permanently removes a custom model. When executed, the node:

  1. Validates the model ID is not empty
  2. Sends a delete request to Leonardo AI API
  3. Removes the custom model from your account
  4. Returns the deleted model's ID

Requirements

  • Valid Leonardo AI API key (via Connection ID or credentials)
  • Valid model ID from a custom model you own
  • Permission to delete the model (must be the owner)

Error Handling

The node will return specific errors in the following cases:

  • Empty model ID - "Model ID cannot be empty. Please provide the ID of the model to delete."
  • API error - "Failed to delete model. The model may not exist or you may not have permission to delete it."
  • Runtime error - "Failed to delete model: {details}. Please verify the model ID and try again."

Usage Examples

Delete Failed Training

Remove a model that failed to train:

  1. Create Model
  2. Monitor with Get Model
  3. If status becomes "FAILED"
  4. Delete Model to clean up

Clean Up Test Models

Remove models created during testing:

// List of test model IDs
const testModels = [
'model-id-1',
'model-id-2',
'model-id-3'
];

// Loop through and delete each
testModels.forEach(modelId => {
// Use Delete Model with modelId
});

Delete Outdated Models

Remove old versions when creating new ones:

  1. Create Model v2 with improved dataset
  2. Verify v2 works well with test generations
  3. Delete Model v1 to avoid confusion
  4. Keep only the latest version

Automated Model Lifecycle

Manage model versions automatically:

  1. Track model IDs and creation dates
  2. When creating a new model version:
    • Create the new model
    • Wait for training completion
    • Test the new model
    • If successful, delete old versions
  3. Maintain only current models

Delete Unused Models

Clean up models no longer in use:

  1. Review your model inventory
  2. Identify models not used in recent generations
  3. Backup any important model IDs
  4. Delete unused models to free up space

Usage Notes

  • Deletion is permanent and cannot be undone
  • The model ID becomes invalid after deletion
  • Generations created with the model are NOT affected
  • You can only delete models you own
  • Failed models should be deleted to keep your account clean
  • Consider keeping a record of model parameters before deletion
  • Deleting a model doesn't delete the dataset it was trained from
  • Useful for managing your model library
  • Regular cleanup helps stay organized
  • Delete test or experimental models after validation
  • Keep production models until replaced with better versions
  • The dataset used to train the model remains available
  • You can retrain a model from the same dataset if needed