ComfyUI Workflow

Execute ComfyUI workflows such as image upscaling and video generation.

arrow-up-rightIntroduction

ComfyUI is an open-source program that allows users to use generative AI such as text-to-image, image-to-image, text-to-video and more through a flexible node-based interface. Xalora SDK abstracts away the complexity of ComfyUI, and provides simple functions in Node.js SDK to execute ComfyUI workflows on distributed GPU miners.

SDK source codearrow-up-right

arrow-up-rightAvailable Workflows

The SDK currently supports the following ComfyUI workflows:

  • Text to Video Generation - Generate videos from text descriptions

  • Image Upscaling - Upscale images while maintaining quality

arrow-up-rightCore Concepts

Each workflow in ComfyUI is represented by a WorkflowTask. The SDK provides a base class that handles common functionality, which specific workflow implementations extend with their unique requirements.

arrow-up-rightBefore you start

  1. Get an API key

  2. Define environment variables in .env file:

Copy

arrow-up-rightData Structures

Each WorkflowTask represents a task of a specific ComfyUI workflow (identified by a JSON workflow file describing the node structures in ComfyUI). A derived class of WorkflowTask is defined for each individual workflow, including necessary input parameters.

Copy

arrow-up-rightTask Option Type

Copy

arrow-up-rightTask Result Type

Copy

arrow-up-rightExecute a workflow

Executes a workflow task without waiting for the result.

Copy

Returns a Promise that resolves to the task ID.

arrow-up-rightQuery the task result

Queries the result of a previously executed task.

Copy

Returns a Promise that resolves to the task result.

arrow-up-rightExecute a workflow and wait for the result

Executes a workflow and waits until a result is returned. Internally, this function calls queryTaskResult at a fixed interval, and throws if the task times out.

Copy

arrow-up-rightCancel a task

Cancels a previously submitted task.

Copy

Returns a Promise that resolves to the task ID and message.

Last updated