Using ComfyUI workflows from CodeBot
ComfyUI is a third-party application, available at comfy.org, that allows you to run image generation models locally on your machine or on your local network, without the need for network access and, most importantly, without paying for image generation credits with a provider.
Note: Setting up ComfyUI is an advanced topic. Even though we provide some guidelines, we strongly recommend reading the documentation provided by ComfyUI and other online resources to get started. CodeBot itself can also help you set up and configure ComfyUI, and Campfire comes with some skills to guide it.
In short: Campfire can help call ComfyUI workflows, but it does not replace the normal ComfyUI setup and troubleshooting process.
ComfyUI can run many different image-generation graphs using models available on the open web, most notably from Hugging Face. Campfire can use a normal ComfyUI model or graph directly, but it also supports a special type of workflow designed for use by Campfire. These workflows, if present, show up in the "Workflows" popup in the Image Workbench, along with their "Variations".
A workflow is a ComfyUI graph that already contains the model loaders, reference-image nodes, samplers, output nodes, and other settings needed for a specific image task.
Campfire does not edit ComfyUI workflows. If you want a custom ComfyUI graph, you must create it in ComfyUI, test it there, then save it in the correct API format so Campfire can discover and run it.
When This Matters
Most users can choose a ComfyUI image model in Settings and ask CodeBot to generate an image.
Use workflows when:
- The image task needs a specific ComfyUI graph.
- The graph uses custom nodes, LoRAs, model patches, upscalers, inpainting, reference-image adapters, or other ComfyUI-specific setups.
- You downloaded a ComfyUI template and want Campfire to call that same graph.
- You want to keep the workflow setup inside ComfyUI instead of exposing every option in Campfire.
Workflow Master Model
The ComfyUI workflow master model is comfyui-workflows. This is the model shown in the image model picker, and selecting it allows you to pick one of the available workflows, if any. The master model by itself is not enough to generate an image.
CodeBot can call the listImageWorkflows tool to see which saved workflows are available, then pass one concrete workflow ID to generateImage. The Image Workbench also knows how to obtain the list of workflows and populates its picker when comfyui-workflows is the active image generation model.
Workflow IDs
Saved ComfyUI workflows use this shape:
comfyui-workflows:user-workflow-file-name
The workflow name is derived from the saved workflow JSON file name. For example, if the saved API workflow file is flux-dev-uso-reference.json, Campfire exposes it as comfyui-workflows:user-flux-dev-uso-reference.
Keep workflow file names short and descriptive. They become the names CodeBot and Image Workbench sees.
Workflow Variants
A workflow can expose variants. A variant is the same overall workflow family with a different model choice, for example different patched nodes, LoRAs, denoise settings, or other saved options.
Variant IDs use this shape: comfyui-workflows:workflow-id:variant-id, for example comfyui-workflows:user-flux-dev-uso-reference:character-1.
When you do not specify a variant, Campfire chooses the best available variant, or a default/active variant declared in the workflow itself.
CodeBot can call listImageWorkflows() to see the available variants for each workflow. listImageWorkflows() also exposes any configuration errors in the workflow, such as missing nodes, missing model files, and reference-image support.
You will need to sort out workflow configuration issues in ComfyUI, but CodeBot can help interpret the errors and suggest next steps.
Using a Workflow from Image Workbench
In Image Workbench, simply select comfyui-workflows as the model, and then pick the workflow or variant you want to use. You can add reference images, mask images, etc., as you normally would, provided the workflow supports them.
Using a Workflow from /image
When using the /image slash command in Campfire chat, you can pass the workflow using the workflow= parameter anywhere in the prompt, e.g.:
/image model=comfyui-workflows:user-flux-dev-uso-reference create a scene in an open-space office.
For a variant, add the variant ID after the workflow ID:
/image model=comfyui-workflows:user-flux-dev-uso-reference:character-1 create a scene with Character 1 seated at a desk in an open-space office.
For workflows with reference images, you can simply include the workspace-relative local or full image path in the request, the same as you would in /image requests with any other model.
/image model=comfyui-workflows:user-flux-dev-uso-reference:character-1 create a scene with Character 1 seated at a desk in an open-space office ./references/character-1-in-blue-sweater.png
Workflow Export Format
ComfyUI has more than one JSON format. Campfire needs workflows to be saved in the API prompt format, because that is the format ComfyUI accepts at its /prompt endpoint.
The right JSON usually looks like this:
{
"3": {
"class_type": "KSampler",
"inputs": {
"model": ["1", 0],
"positive": ["2", 0]
}
}
}
The wrong JSON usually contains editor-only graph data, such as:
{
"nodes": [],
"links": [],
"groups": []
}
That editor workflow JSON can be opened by ComfyUI, but it cannot be sent directly to /prompt. If Campfire sees that format, the workflow will be listed as unavailable.
To convert a workflow, in ComfyUI you can:
- Open or create the workflow.
- Install any missing custom nodes.
- Download all required model files.
- Test the workflow in ComfyUI until it runs successfully.
- Export or save the workflow in API format.
- Put the exported JSON file in ComfyUI's saved workflows folder.
For ComfyUI Desktop with a root folder like /Users/yourname/AI/ComfyUI, the saved workflow folder is usually:
/Users/yourname/AI/ComfyUI/user/default/workflows
After saving the file, refresh the workflow list in Campfire or ask CodeBot to call listImageWorkflows() again.
Sidecar Files
Campfire can read an optional sidecar file next to a saved workflow. The sidecar file lets you give the workflow a stable ID, friendly name, description, variants, requirements, and small patches without editing the exported API workflow JSON.
If the workflow file is character_scene.json, the sidecar file is character_scene.campfire.json.
A sidecar may look like this:
{
"id": "character-scene",
"name": "Character Scene",
"description": "Reference-guided character scene workflow.",
"activeVariant": "kontext",
"requiresReferenceImages": true,
"supportsReferenceImages": true,
"supportsTextOnly": false,
"supportsSize": true,
"requiredNodes": ["Power Lora Loader"],
"requiredModels": [
{
"node": "LoraLoader",
"input": "lora_name",
"value": "character_lora.safetensors"
}
],
"patches": [
{
"node": "12",
"input": "lora_name",
"value": "character_lora.safetensors"
}
],
"variants": [
{
"variantID": "kontext",
"name": "Flux Kontext",
"description": "Reference-guided Flux Kontext version.",
"priority": 10,
"patches": [
{
"node": "4",
"input": "unet_name",
"value": "flux-kontext.gguf"
}
]
}
]
}
Use sidecars when one exported workflow can support several installed model choices, or when you want CodeBot to see a stable workflow ID that is not tied to the file name.
The patches list changes node inputs before Campfire sends the workflow to ComfyUI. A patch uses the node ID from the API workflow JSON and the input name to update. If a patch references a missing node, Campfire marks the workflow unavailable.
Testing a Workflow
Before using a workflow from Campfire, test it in ComfyUI itself:
- Open the workflow in ComfyUI.
- Resolve all missing model and missing custom-node errors.
- For every active
Load Imagenode, select an image from ComfyUI's imported/input image list. - Press Run in ComfyUI.
- Confirm that the workflow produces an image.
- Export the working graph in API format.
- Save that API JSON into the
user/default/workflowsfolder. - Run
listImageWorkflows()from Campfire. - Generate a small test image from Campfire.
Uploading an image in ComfyUI does not always select it for the node. If a Load Image node still points to a template file that does not exist, ComfyUI will fail validation with an invalid image file error.
Model Files
Campfire does not download workflow model files automatically.
The workflow must refer to model file names that exist in the ComfyUI model folders on the ComfyUI machine. Common folders include:
ComfyUI/models/checkpoints
ComfyUI/models/diffusion_models
ComfyUI/models/text_encoders
ComfyUI/models/vae
ComfyUI/models/clip_vision
ComfyUI/models/loras
ComfyUI/models/model_patches
ComfyUI/models/ipadapter
If ComfyUI says a model is missing, download the file from the model link shown in the ComfyUI workflow/template panel and put it in the folder listed by the template.
Restart ComfyUI after adding custom nodes. For model files, refreshing the model list or reloading the workflow is often enough, but restarting ComfyUI is the simplest safe step.
Troubleshooting
No Workflows Are Listed
Check these things:
- The image model is set to
comfyui-workflows. - The ComfyUI account URL points at the correct ComfyUI server.
- The API workflow JSON is saved in
ComfyUI/user/default/workflows. - The file extension is
.json. - ComfyUI can read the file.
The Workflow Is Not in API Prompt Format
Campfire found the saved workflow file, but it is the editor workflow JSON, not the API prompt JSON.
Open the workflow in ComfyUI, export or save it in API format, then replace the saved file in user/default/workflows.
The Workflow Fails Validation
ComfyUI was reachable, but rejected the graph before running it.
This usually means:
- A model file name in the workflow does not match the file installed in ComfyUI.
- A custom node is missing.
- A
Load Imagenode points at an image file that is not uploaded to the ComfyUI server. - A required input is empty.
- The workflow was saved from a newer ComfyUI build than the one currently running.
Fix the workflow in ComfyUI first, confirm it runs there, then export the API-format JSON again.
Reference Images Do Not Work
Reference images must be uploaded to the ComfyUI server before the workflow runs. Campfire handles that upload when it runs a compatible workflow.
The workflow still needs usable LoadImage-style nodes. If a saved workflow has multiple active Load Image nodes, make sure each one is meant to be patched or has a valid default image selected.
Generation Is Slow
Local workflows can take minutes, especially on large image sizes or heavy models. Use smaller test sizes first, then run a higher-quality version once the direction is right.