Skip to main content

Core Classes

ComfyNode

Base class for all custom nodes.

Schema

Defines node metadata.
string
required
Unique identifier for the node
string
required
Display name in the UI
string
required
Category path (e.g., “image/filters”)
list[Input]
required
List of input definitions
list[Output]
required
List of output definitions

Input Types

Image

Image data input/output.
Type: torch.Tensor with shape [B, H, W, C] where values are in range [0, 1]

Int

Integer input/output.
int
Minimum value
int
Maximum value
int
Slider step size
NumberDisplay
NumberDisplay.number or NumberDisplay.slider

Float

Floating-point input/output.
float
Precision to round to (defaults to step value)
list[list[float]]
For gradient slider mode

String

Text input/output.
bool
Enable multiline text area
bool
Enable wildcard/dynamic prompt syntax

Combo

Dropdown selection input.
list[str] | list[int] | Enum
required
Available options for selection

Boolean

Boolean toggle input.

Model Types

ComfyUI provides several model-specific input types:

Common Input Parameters

These parameters are available for most input types:
string
required
Unique identifier for the input
string
Display name in the UI (defaults to id)
bool
default:"false"
Whether the input is optional
string
Tooltip text shown on hover
bool
Enable lazy evaluation for this input
any
Default value for the input
bool
Mark as advanced option (hidden by default)
bool
Hide the connection socket (widget only)
bool
Force input socket even with widget

Enumerations

NumberDisplay

Display mode for numeric inputs:

ControlAfterGenerate

Behavior after generation:

UploadType

File upload types:

FolderType

Folder location types:

NodeOutput

Return type for the execute() method:

Extension Class

ComfyExtension

Base class for extensions:

Custom API Routes

Add custom HTTP endpoints to ComfyUI:

Frontend Extensions

Set the web directory for frontend JavaScript:
Any .js files in this directory will be loaded by the frontend.

Type Hints

Common type hints for node development:
All nodes execute in a class method context. Use cls instead of self in your methods.