Edit and submit ComfyUI workflows
Project description
ComfyHelper
Edit ComfyUI API-format workflow JSON from Python or the command line, then submit it to a running ComfyUI instance.
ComfyHelper is intentionally focused on value overrides: prompts, seeds, sampler settings, dimensions, loaders, LoRAs, and output naming. It does not try to build arbitrary ComfyUI graphs from scratch.
Install
pip install -e ".[dev]"
The package requires Python 3.12 or newer.
Workflow Format
Use ComfyUI's API-format workflow JSON, not the full visual editor workflow format. In ComfyUI, enable developer/API workflow export and save the API JSON.
CLI Usage
Run a workflow and save returned images:
comfyhelper run basic_api.json \
--positive "a red apple on a white table, photorealistic" \
--negative "blurry, low quality" \
--seed 42 \
--steps 30 \
--cfg 7.5 \
--sampler euler \
--scheduler simple \
--width 1024 \
--height 1024 \
--image input.png \
--filename-prefix apple_test \
--output-dir ./output
Submit without waiting:
comfyhelper run basic_api.json --positive "a cat" --no-wait
Use multiple LoRAs. The final workflow will contain exactly these LoRAs, chained in order:
comfyhelper run basic_api.json \
--lora detail.safetensors \
--lora style.safetensors \
--lora-strength 0.8 \
--lora-strength 0.6
For split-loader workflows:
comfyhelper run workflow.json \
--diffusion-model flux1-dev.safetensors \
--clip clip_l.safetensors \
--clip t5xxl_fp16.safetensors \
--vae ae.safetensors
Python Usage
from comfyhelper import ComfyClient, Workflow
workflow = Workflow.from_file("basic_api.json")
workflow.set_positive_prompt("a red apple on a white table")
workflow.set_negative_prompt("blurry, low quality")
workflow.set_seed(42)
workflow.set_steps(30)
workflow.set_dimensions(1024, 1024)
workflow.set_loras([
("detail.safetensors", 0.8),
("style.safetensors", 0.6),
])
client = ComfyClient(host="localhost", port=8188)
result = client.run(workflow)
images = result.download(client)
Supported Setters
General workflow edits:
set_positive_prompt(text, sampler_id=None)set_negative_prompt(text, sampler_id=None)set_prompt_node(node_id, text)set_node_input(class_type, field, value)set_node_input_by_id(node_id, field, value)set_seed(seed)set_steps(steps)set_cfg(cfg)set_sampler(sampler_name)set_scheduler(scheduler)set_denoise(denoise)set_dimensions(width, height)set_batch_size(batch_size)set_filename_prefix(prefix)get_load_image_count()set_load_image(image)set_load_images(images)
Loader edits:
set_checkpoint(name)forCheckpointLoaderSimple.ckpt_nameset_diffusion_model(name)forUNETLoader.unet_nameset_clip(name)forCLIPLoader.clip_nameset_clips(names)forCLIPLoader,DualCLIPLoader,TripleCLIPLoader, andQuadrupleCLIPLoaderset_vae(name)forVAELoader.vae_nameset_lora(name, strength=1.0)set_loras([(name, strength), ...])
Validation
Use workflow.validate() to get a list of obvious structural issues, or workflow.validate_or_raise() to raise a ValueError. ComfyClient.submit() validates before sending the workflow to ComfyUI.
Validation checks are intentionally lightweight. ComfyUI remains the source of truth for node-specific compatibility.
Notes and Limits
- The first
KSampleris the default target for prompt and sampler setters. - Workflows with multiple samplers can use
sampler_idfor prompt setters orset_node_input_by_id()for explicit edits. set_loras()replaces existingLoraLoadernodes and creates a fresh chain.- The CLI saves images into ComfyUI subfolders when provided and avoids overwriting existing files by adding numeric suffixes.
- Custom extension nodes can still be edited with
set_node_input_by_id().
Project details
Release history Release notifications | RSS feed
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 comfyhelper-0.1.0.tar.gz.
File metadata
- Download URL: comfyhelper-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0efcc2dbdbac766451089c992364cad2cbe5f173bcfba2b2815ddf8ff297e3e8
|
|
| MD5 |
42d6ba44da594bbc0ce1659c159076ec
|
|
| BLAKE2b-256 |
c992fc0e05d642881f001e8748bcbf113b63d50894f9229f181100481a515384
|
File details
Details for the file comfyhelper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: comfyhelper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a15c48f285780a3cc1b578b2e500431046b0ba2bab71574ffc84d58a6afac15d
|
|
| MD5 |
ec53c113572bf9f07b032b7fd5b47f0a
|
|
| BLAKE2b-256 |
cd7b41391d8865e5a80e60bf91ecf5532913184b7ddbc2e1a5976ff136ca5eb2
|