Skip to main content
Custom nodes extend ComfyUI’s functionality by adding new processing capabilities to your workflows. This guide covers creating nodes using the modern ComfyUI API.

Basic Node Structure

Custom nodes in ComfyUI are Python classes that inherit from io.ComfyNode and define a schema for inputs, outputs, and execution logic.

Minimal Example

Schema Definition

The define_schema() method tells ComfyUI about your node’s metadata, inputs, and outputs.

Schema Parameters

string
required
Unique identifier for your node
string
required
Human-readable name shown in the UI
string
required
Category path for organizing nodes (e.g., “image/processing”)
list[Input]
required
List of input definitions
list[Output]
required
List of output definitions

Input Types

ComfyUI provides various input types for different data:

Image Input

Numeric Inputs

String Input

Combo (Dropdown) Input

Complete Example

Here’s a complete example from the ComfyUI source code:
The comfy_entrypoint() function is the entry point that ComfyUI calls to load your extension and its nodes.

Lazy Evaluation

Inputs marked with lazy=True are only evaluated when needed, which can improve performance:
Use check_lazy_status() to control which lazy inputs are evaluated based on other input values.

Input Caching

Control when your node re-executes using fingerprint_inputs():

Extension Class

Wrap your nodes in a ComfyExtension class:

Next Steps

Node API Reference

Explore the complete API reference

Best Practices

Learn best practices for node development