Learn how to create custom nodes for ComfyUI using the modern node API
Custom nodes extend ComfyUI’s functionality by adding new processing capabilities to your workflows. This guide covers creating nodes using the modern ComfyUI API.
Inputs marked with lazy=True are only evaluated when needed, which can improve performance:
@classmethoddef check_lazy_status(cls, image, string_field, int_field, float_field, print_to_screen): """ Return a list of input names that need to be evaluated. Unevaluated inputs will have the value None. """ if print_to_screen == "enable": return ["int_field", "float_field", "string_field"] else: return []
Use check_lazy_status() to control which lazy inputs are evaluated based on other input values.
Control when your node re-executes using fingerprint_inputs():
@classmethoddef fingerprint_inputs(cls, image, string_field, int_field, float_field, print_to_screen): """ Return a value that changes when the node should re-execute. If this returns the same value as the last execution, the node will not run again. """ import hashlib # Example: hash the image data return hashlib.md5(image.numpy().tobytes()).hexdigest()