Basic Node Structure
Custom nodes in ComfyUI are Python classes that inherit fromio.ComfyNode and define a schema for inputs, outputs, and execution logic.
Minimal Example
Schema Definition
Thedefine_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 withlazy=True are only evaluated when needed, which can improve performance:
Input Caching
Control when your node re-executes usingfingerprint_inputs():
Extension Class
Wrap your nodes in aComfyExtension class:
Next Steps
Node API Reference
Explore the complete API reference
Best Practices
Learn best practices for node development