Minimal ComfyUI runtime for deploying custom nodes as microservices
Project description
comfy-runtime
Run any ComfyUI node as a Python function. No server, no UI, no workflow graph.
Install
pip install comfy-runtime
Usage
1. Configure & run built-in nodes
import comfy_runtime
comfy_runtime.configure(models_dir="/path/to/models", output_dir="./output")
# Text-to-image with SD 1.5
model, clip, vae = comfy_runtime.execute_node("CheckpointLoaderSimple", ckpt_name="v1-5-pruned-emaonly.safetensors")
positive = comfy_runtime.execute_node("CLIPTextEncode", clip=clip, text="a castle on a hill, fantasy art")[0]
negative = comfy_runtime.execute_node("CLIPTextEncode", clip=clip, text="blurry, low quality")[0]
latent = comfy_runtime.execute_node("EmptyLatentImage", width=512, height=512, batch_size=1)[0]
sampled = comfy_runtime.execute_node("KSampler", model=model, positive=positive, negative=negative, latent_image=latent, seed=42, steps=20, cfg=8.0, sampler_name="euler", scheduler="normal", denoise=1.0)[0]
images = comfy_runtime.execute_node("VAEDecode", samples=sampled, vae=vae)[0]
comfy_runtime.execute_node("SaveImage", images=images, filename_prefix="output")
2. Load any custom node
# Single file
comfy_runtime.load_nodes_from_path("/path/to/my_node.py")
# Directory (with or without __init__.py)
comfy_runtime.load_nodes_from_path("/path/to/ComfyUI-AnimateDiff-Evolved")
# Then use it
result = comfy_runtime.execute_node("ADE_AnimateDiffLoRALoader", ...)
Both V1 (NODE_CLASS_MAPPINGS) and V3 (comfy_entrypoint) node formats are supported.
3. Discover nodes
comfy_runtime.list_nodes() # All registered node names
comfy_runtime.get_node_info("KSampler") # Input/output types, category
API
| Function | Description |
|---|---|
configure(models_dir, output_dir, ...) |
Set model paths and device config. Call before loading models. |
execute_node(class_type, **kwargs) |
Run a node and return its output tuple. |
load_nodes_from_path(path) |
Load nodes from a .py file or directory. Returns list of registered names. |
list_nodes() |
All registered node names. |
get_node_info(class_type) |
Node metadata (inputs, outputs, category). |
register_node(class_type, cls) |
Register a node class manually. |
unregister_node(class_type) |
Remove a node. |
get_config() |
Current runtime config. |
Custom node compatibility
Tested with popular third-party nodes:
| Node Pack | Nodes | Status |
|---|---|---|
| WAS-Node-Suite (220 nodes) | Image/text utilities | Works |
| IPAdapter-Plus (37 nodes) | Style transfer | Works |
| KJNodes (232 nodes) | Utility pack | Works |
| Advanced-ControlNet (43 nodes) | ControlNet | Works |
| AnimateDiff-Evolved (145 nodes) | Video animation | Works |
Custom nodes that import from comfy.*, comfy_api.*, comfy_extras.*, folder_paths, or nodes all resolve correctly.
Examples
See workflows/ for complete runnable examples:
sd15_text_to_image— basic text-to-imageflux2_klein_text_to_image— Flux.2 with custom samplerimg2img— image-to-image style transferinpainting— masked region replacementhires_fix— 2-pass high-resolution generationarea_composition— spatial prompt compositionesrgan_upscale— 4x super-resolution
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file comfy_runtime-0.2.0.tar.gz.
File metadata
- Download URL: comfy_runtime-0.2.0.tar.gz
- Upload date:
- Size: 93.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87090bb060905b2462de39f9fb81522817c1f7ddaa6a89ff7985cfdc78ea67ee
|
|
| MD5 |
a1077d26d3335a51fb8a63a3b9e0b9be
|
|
| BLAKE2b-256 |
21273d47169d06fd3ff6e8b23aecc9c7294dbdf040eb48f09ffbca17196bb91c
|
Provenance
The following attestation bundles were made for comfy_runtime-0.2.0.tar.gz:
Publisher:
publish.yml on anyin233/comfy-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
comfy_runtime-0.2.0.tar.gz -
Subject digest:
87090bb060905b2462de39f9fb81522817c1f7ddaa6a89ff7985cfdc78ea67ee - Sigstore transparency entry: 1266755750
- Sigstore integration time:
-
Permalink:
anyin233/comfy-runtime@cd12072567b94763b8cfafa3cb14c2e449a4f926 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/anyin233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd12072567b94763b8cfafa3cb14c2e449a4f926 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file comfy_runtime-0.2.0-py3-none-any.whl.
File metadata
- Download URL: comfy_runtime-0.2.0-py3-none-any.whl
- Upload date:
- Size: 118.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac779992591110e5ceea43141cecd5cdab927b051197b592c5623e7421329e9c
|
|
| MD5 |
7d784beda723377d6bd7eab03f52562d
|
|
| BLAKE2b-256 |
2e7c72312bf32e2b6c92fd20c0f106fa053fc717f4b67d99d7a816c4980cbba7
|
Provenance
The following attestation bundles were made for comfy_runtime-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on anyin233/comfy-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
comfy_runtime-0.2.0-py3-none-any.whl -
Subject digest:
ac779992591110e5ceea43141cecd5cdab927b051197b592c5623e7421329e9c - Sigstore transparency entry: 1266755862
- Sigstore integration time:
-
Permalink:
anyin233/comfy-runtime@cd12072567b94763b8cfafa3cb14c2e449a4f926 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/anyin233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd12072567b94763b8cfafa3cb14c2e449a4f926 -
Trigger Event:
workflow_dispatch
-
Statement type: