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
Override ControlNet and image scaling nodes:
comfyhelper run workflow.json \
--controlnet-model sdxl_controlnet_promax.safetensors \
--controlnet-strength 0.7 \
--controlnet-start-percent 0 \
--controlnet-end-percent 0.7 \
--image-scale-upscale-method nearest-exact \
--image-scale-megapixels 1.0 \
--image-scale-resolution-steps 1
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_controlnet_model(name)forControlNetLoader.control_net_nameset_apply_controlnet(strength=None, start_percent=None, end_percent=None)forControlNetApplyAdvancedset_image_scale_to_total_pixels(upscale_method=None, megapixels=None, resolution_steps=None)forImageScaleToTotalPixelsset_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().
Metadata
Release files for comfyhelper 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| comfyhelper-0.2.0.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| comfyhelper-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 kB
Release files / comfyhelper-0.2.0.tar.gz
| Download URL | comfyhelper-0.2.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1759aa0d64cfb5fbada2a428c9ebec392171dad55bd7bb02ad328e87eb944377
|
|
BLAKE2b-256 checksum How to use checksums |
3164b329f4ced226c42f767ee150123954adaf404ed6ee7e17755d02bbd14f25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / comfyhelper-0.2.0-py3-none-any.whl
| Download URL | comfyhelper-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ee7aecbed68d005ba62a0149548625aca8074ff29e54e97d819724d21aea135
|
|
BLAKE2b-256 checksum How to use checksums |
04c886768c83047b85343018876ca41d33c512ff9cc61fd7b7e3e68a05b82173
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|