Skip to main content

Get Model

Retrieves details and status of a custom model by its ID.

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 retrieve (from Create Model node).

Options

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

Outputs

  • Response (Object) - Custom model details including:
    • Model ID
    • Name
    • Description
    • Instance prompt
    • Model type
    • Status (TRAINING, COMPLETE, FAILED)
    • Model dimensions (width, height)
    • Stable Diffusion version
    • Public/private status
    • Created timestamp
    • Updated timestamp

How It Works

The Get Model node retrieves information about a custom model. When executed, the node:

  1. Validates the model ID is not empty
  2. Sends a request to Leonardo AI API to fetch model details
  3. Returns the complete model object with status and configuration

Requirements

  • Valid Leonardo AI API key (via Connection ID or credentials)
  • Valid model ID from a Create Model node

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 retrieve."
  • Model not found - "Model not found. Please verify the model ID is correct."
  • Runtime error - "Failed to get model details: {details}. Please verify the model ID and try again."

Usage Examples

Check Training Status

Monitor model training progress:

  1. Create Model and get the model ID
  2. Wait a few minutes (training takes 30-90 minutes)
  3. Use Get Model to check status
  4. If status is "TRAINING", wait and check again
  5. When status is "COMPLETE", model is ready to use
  6. If status is "FAILED", review the error details

Verify Model Before Use

Confirm model is ready for generation:

// After calling Get Model
const model = $.response[0];

if (model.status === 'COMPLETE') {
// Model is ready - proceed with generation
const modelId = model.id;
// Use in Create Generation
} else if (model.status === 'TRAINING') {
// Still training - wait longer
} else if (model.status === 'FAILED') {
// Training failed - check logs
}

Get Model Dimensions

Retrieve optimal dimensions for the model:

const model = $.response[0];
const width = model.model_width;
const height = model.model_height;

// Use these dimensions in Create Generation
// for best results with this model

List Model Details

Display model information:

const model = $.response[0];

console.log(`Name: ${model.name}`);
console.log(`Type: ${model.type}`);
console.log(`Status: ${model.status}`);
console.log(`Instance Prompt: ${model.instance_prompt}`);
console.log(`Dimensions: ${model.model_width}x${model.model_height}`);
console.log(`Created: ${model.created_at}`);

Wait for Training Completion

Poll until model training is done:

  1. Create Model
  2. Loop:
    • Wait 5 minutes (Delay node)
    • Get Model
    • Check status
    • If COMPLETE, exit loop
    • If FAILED, handle error
    • If TRAINING, continue loop
  3. Use completed model

Usage Notes

  • Model training is asynchronous - use this node to check status
  • Poll this node every 5-10 minutes to monitor training progress
  • Status values: TRAINING (in progress), COMPLETE (ready), FAILED (error)
  • The response is an array - access model via $.response[0]
  • Model dimensions indicate optimal size for generation
  • Instance prompt shows the token used during training
  • Use the model ID in Create Generation once status is COMPLETE
  • The public field indicates if the model is shared publicly
  • Created and updated timestamps help track model age
  • Useful for debugging training issues
  • Failed models may include error information
  • Check this before attempting to use a model for generation