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:
- Validates the model ID is not empty
- Sends a delete request to Leonardo AI API
- Removes the custom model from your account
- 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:
- Create Model
- Monitor with Get Model
- If status becomes "FAILED"
- 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:
- Create Model v2 with improved dataset
- Verify v2 works well with test generations
- Delete Model v1 to avoid confusion
- Keep only the latest version
Automated Model Lifecycle
Manage model versions automatically:
- Track model IDs and creation dates
- When creating a new model version:
- Create the new model
- Wait for training completion
- Test the new model
- If successful, delete old versions
- Maintain only current models
Delete Unused Models
Clean up models no longer in use:
- Review your model inventory
- Identify models not used in recent generations
- Backup any important model IDs
- 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