A comprehensive toolkit for standardizing, packaging and deploying ComfyUI workflows as reproducible environments and production-ready REST services
comfy-pack is a comprehensive toolkit for reliably packing and unpacking environments for ComfyUI workflows.
.cpack.zip
artifact with Python package versions, ComfyUI and custom node revisions, and model hashes..cpack.zip
artifact to recreate the same environment with the exact Python package versions, ComfyUI and custom node revisions, and model weights.ComfyUI Manager is great for find missing custom nodes. But when sharing ComfyUI workflows to others(your audience or team members), you've still likely heard these responses:
These are fundamental challenges in workflow sharing – every component should match exactly: custom nodes, model files, and Python dependencies. Modern pacakge managers like npm and poetry intruduced "lock" feature, which means record the exact version for every requirement. ComfyUI Manager isn't designed for that.
We learned it from our community and developed comfy-pack to address these problems. With a single click, it captures and locks your entire workflow environment into a .cpack.zip
file, including Python packages, custom nodes, model hashes, and required assets.
Users can recreate the exact environment with one command:
comfy-pack unpack workflow.cpack.zip
This means you can focus on your creative work while comfy-pack handles the rest.
We recommend you use ComfyUI Manager to install comfy-pack. Simply search for comfy-pack
and click Install. Restart the server and refresh your ComfyUI interface to apply changes.
Alternatively, clone the project repository through git
.
cd ComfyUI/custom_nodes
git clone https://github.com/bentoml/comfy-pack.git
To install the comfy-pack CLI, run:
pip install comfy-pack
You can package a workflow and the environment required to run the workflow into an artifact that can be unpacked elsewhere.
.cpack.zip
artifact.Unpacking a .cpack.zip
artifact will restore the ComfyUI environment for the workflow. During unpacking, comfy-pack will perform the following steps.
To unpack:
comfy-pack unpack workflow.cpack.zip
For example cpack files, check our examples folder.
You can turn a ComfyUI workflow into an API endpoint callable using any clients through HTTP.
<details> <summary> 1. Annotate input & output </summary>Use custom nodes provided by comfy-pack to annotate the fields to be used as input and output parameters. To add a comfy-pack node, right-click and select Add Node > ComfyPack > output/input > [Select a type]
Input nodes:
image
type input, similar to the official LoadImage
nodestring
type input (e.g., prompts)int
type input (e.g., dimensions, seeds)combo
type and more input (e.g., custom nodes)Output nodes:
image
type, similar to the official SaveImage
nodestring
type and saves the file under that pathMore field types are under way.
</details> <details> <summary> 2. Serve the workflow </summary>Start an HTTP server at http://127.0.0.1:3000
(default) to serve the workflow under the /generate
path.
You can call the /generate
endpoint by specifying parameters configured through your comfy-pack nodes, such as prompt, width, height, and seed.
[!NOTE] The name of a comfy-pack node is the parameter name used for API calls.
Examples to call the endpoint:
CURL
curl -X 'POST' \
'http://127.0.0.1:3000/generate' \
-H 'accept: application/octet-stream' \
-H 'Content-Type: application/json' \
-d '{
"prompt": "rocks in a bottle",
"width": 512,
"height": 512,
"seed": 1
}'
BentoML client
Under the hood, comfy-pack leverages BentoML, the unified model serving framework. You can invoke the endpoint using the BentoML Python client:
import bentoml
with bentoml.SyncHTTPClient("http://127.0.0.1:3000") as client:
result = client.generate(
prompt="rocks in a bottle",
width=512,
height=512,
seed=1
)
</details>
<details>
<summary> 3. (Optional) Pack the workflow and environment </summary>
Pack the workflow and environment into an artifact that can be unpacked elsewhere to recreate the workflow.
# Get the workflow input spec
comfy-pack run workflow.cpack.zip --help
# Run
comfy-pack run workflow.cpack.zip --src-image image.png --video video.mp4
</details>
<details>
<summary> 4. (Optional) Deploy to the cloud </summary>
Deploy to BentoCloud with access to a variety of GPUs and blazing fast scaling.
Follow the instructions here to get your BentoCloud access token. If you don’t have a BentoCloud account, you can sign up for free.
</details>This project is under active development. Currently we are working on:
.cpack
file management with version controlcomfy-pack is actively maintained by the BentoML team. Feel free to reach out 👉 Join our Slack community!
As an open-source project, we welcome contributions of all kinds, such as new features, bug fixes, and documentation. Here are some of the ways to contribute: