Skip to main content

Create Model

Creates a new custom model by training on a dataset of images.

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).
  • Dataset ID (String) - ID of the dataset containing training images (from Create Dataset node).
  • Instance Prompt (String) - Prompt that identifies the subject in the dataset (e.g., "a photo of TOK person" or "an illustration of TOK character").
  • Name (String) - Name for your custom model.

Options

  • API Key - Leonardo AI API key (optional if using Connection ID).
  • Description (String) - Optional description of what the custom model generates.
  • Model Type - Type of content the model will generate:
    • GENERAL (Default) - General purpose
    • BUILDINGS - Architecture and buildings
    • ENVIRONMENTS - Landscapes and environments
    • FASHION - Fashion and clothing
    • ILLUSTRATIONS - Illustrated art
    • GAME ITEMS - Game assets and items
    • GRAPHICAL ELEMENTS - UI and graphic elements
    • PHOTOGRAPHY - Photographic style
    • PIXEL ART - Pixel art style
    • PRODUCT DESIGN - Product designs
    • TEXTURES - Texture patterns
    • UI ELEMENTS - User interface elements
    • VECTOR - Vector graphics
  • NSFW (Boolean) - Allow NSFW content in the model. Default: False.
  • Resolution - Training image resolution:
    • 512 (Default) - Faster training, lower quality
    • 768 - Slower training, higher quality
  • Sd Version - Stable Diffusion version:
    • NONE (Default) - Auto-select
    • v1_5 - Stable Diffusion 1.5
    • v2 - Stable Diffusion 2
  • Strength - Training strength:
    • VERY_LOW - Minimal influence
    • LOW - Light influence
    • MEDIUM (Default) - Balanced
    • HIGH - Strong influence

Outputs

  • Response (String) - Custom model ID of the created model. Use this to generate images with your custom model.

How It Works

The Create Model node starts training a custom model. When executed, the node:

  1. Validates dataset ID, instance prompt, and name are not empty
  2. Configures training parameters (model type, resolution, strength, etc.)
  3. Submits the training job to Leonardo AI
  4. Returns the custom model ID for future use

Requirements

  • Valid Leonardo AI API key (via Connection ID or credentials)
  • Valid dataset ID with at least 5 training images
  • Instance prompt identifying the subject
  • Model name
  • Sufficient API credits for model training

Error Handling

The node will return specific errors in the following cases:

  • Empty dataset ID - "Dataset ID cannot be empty. Please provide the ID of the dataset to use for training."
  • Empty instance prompt - "Instance Prompt cannot be empty. Please provide a prompt that identifies the subject in the dataset."
  • Empty name - "Name cannot be empty. Please provide a name for the custom model."
  • API error - "Failed to create model. API returned no response. Please check your dataset and try again."
  • Runtime error - "Failed to create model: {details}. Please check your inputs and try again."

Usage Examples

Train Character Model

Create a custom model for a specific character:

  1. Create Dataset: "Space Marine Character"
  2. Upload 10-15 images of the character
  3. Create Model:
    • Dataset ID: (from step 1)
    • Instance Prompt: "a photo of TOK space marine"
    • Name: "Space Marine Model v1"
    • Model Type: CHARACTERS
    • Resolution: 768
    • Strength: MEDIUM
  4. Wait for training to complete (30-60 minutes)
  5. Use the model ID in Create Generation

Train Product Model

Create a model for product variations:

  • Dataset ID: Product dataset with 15 chair images
  • Instance Prompt: "a photo of TOK modern chair"
  • Name: "Modern Chair Generator"
  • Description: "Generates modern minimalist chairs"
  • Model Type: PRODUCT_DESIGN
  • Resolution: 768
  • Strength: HIGH

Train Art Style Model

Create a model for a specific art style:

  • Dataset ID: Dataset with 20 watercolor paintings
  • Instance Prompt: "a painting in TOK style"
  • Name: "Watercolor Style"
  • Description: "Generates images in watercolor painting style"
  • Model Type: ILLUSTRATIONS
  • Resolution: 512
  • Strength: MEDIUM

Automated Model Training Pipeline

Complete workflow from dataset to model:

// 1. Create dataset
// 2. Upload 10-15 training images
// 3. Verify dataset with Get Dataset
// 4. Create model with parameters
// 5. Store model ID for generation

Usage Notes

  • Model training takes 30-90 minutes depending on dataset size and resolution
  • Requires 5-15 high-quality training images minimum
  • The instance prompt should use a unique token (e.g., "TOK") to identify the subject
  • Higher resolution (768) produces better quality but takes longer
  • Higher strength makes the model more closely follow the training data
  • Model type should match your dataset content for best results
  • Training consumes API credits - check your balance first
  • The model ID can be used immediately in Create Generation once training completes
  • Monitor training status using Get Model node
  • Custom models remain in your account until deleted
  • Use consistent, high-quality images in your dataset
  • The model learns the style, subject, or concept from your training images
  • Good training data produces better models
  • Consider starting with MEDIUM strength and adjusting based on results