comfyui/comfy/comfy_types
Robin Huang 0738e4ea5d
[API nodes] Add backbone for supporting api nodes in ComfyUI (#7745)
* Add Ideogram generate node.

* Add staging api.

* COMFY_API_NODE_NAME node property

* switch to boolean flag and use original node name for id

* add optional to type

* Add API_NODE and common error for missing auth token (#5)

* Add Minimax Video Generation + Async Task queue polling example (#6)

* [Minimax] Show video preview and embed workflow in ouput (#7)

* [API Nodes] Send empty request body instead of empty dictionary. (#8)

* Fixed: removed function from rebase.

* Add pydantic.

* Remove uv.lock

* Remove polling operations.

* Update stubs workflow.

* Remove polling comments.

* Update stubs.

* Use pydantic v2.

* Use pydantic v2.

* Add basic OpenAITextToImage node

* Add.

* convert image to tensor.

* Improve types.

* Ruff.

* Push tests.

* Handle multi-form data.

- Don't set content-type for multi-part/form
- Use data field instead of JSON

* Change to api.comfy.org

* Handle error code 409.

* Remove nodes.

---------

Co-authored-by: bymyself <cbyrne@comfy.org>
Co-authored-by: Yoland Y <4950057+yoland68@users.noreply.github.com>
2025-04-23 02:18:08 -04:00
..

Comfy Typing

Type hinting for ComfyUI Node development

This module provides type hinting and concrete convenience types for node developers. If cloned to the custom_nodes directory of ComfyUI, types can be imported using:

from comfy.comfy_types import IO, ComfyNodeABC, CheckLazyMixin

class ExampleNode(ComfyNodeABC):
    @classmethod
    def INPUT_TYPES(s) -> InputTypeDict:
        return {"required": {}}

Full example is in examples/example_nodes.py.

Types

A few primary types are documented below. More complete information is available via the docstrings on each type.

IO

A string enum of built-in and a few custom data types. Includes the following special types and their requisite plumbing:

  • ANY: "*"
  • NUMBER: "FLOAT,INT"
  • PRIMITIVE: "STRING,FLOAT,INT,BOOLEAN"

ComfyNodeABC

An abstract base class for nodes, offering type-hinting / autocomplete, and somewhat-alright docstrings.

Type hinting for INPUT_TYPES

INPUT_TYPES auto-completion in Visual Studio Code

INPUT_TYPES return dict

INPUT_TYPES return value type hinting in Visual Studio Code

Options for individual inputs

INPUT_TYPES return value option auto-completion in Visual Studio Code