ComfyuiGW is a powerful RESTful API Gateway designed specifically for running ComfyUI version of Stable Diffusion Sketch. It provides a robust interface for executing complex workflows through both API endpoints and a user-friendly web interface.
- REST API Gateway - Execute ComfyUI workflows via simple HTTP requests
- Web Interface - User-friendly form-based workflow execution (
/runflow
) - Real-time Progress Tracking - Monitor workflow execution with live updates
- File Management - Automatic handling of images, videos, and audio files
- Workflow Configuration - Simple JSON-based workflow definition
- Preset Management - Create reusable configurations with json files
- Cross-platform Support - Works on Windows and Linux systems
- Install ComfyUI
- Install required custom nodes for your workflows, e.g.:
cd ComfyUI/custom_nodes git clone https://github.com/ltdrdata/ComfyUI-Manager git clone https://github.com/kijai/ComfyUI-Florence2 git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts git clone https://github.com/kijai/ComfyUI-KJNodes git clone https://github.com/WASasquatch/was-node-suite-comfyui git clone https://github.com/BlenderNeko/ComfyUI_ADV_CLIP_emb git clone https://github.com/jamesWalker55/comfyui-various git clone https://github.com/Fannovel16/comfyui_controlnet_aux
- Clone this repository:
git clone https://github.com/your-repo/ComfyuiGW
- Update
COMFYUI_PATH
in run.bat (Windows) or run.sh (Linux) - Start the server:
run.bat # Windows ./run.sh # Linux
- Create or download a ComfyUI workflow JSON file
- Place it in a subdirectory under
workflows/
(e.g.,workflows/my_workflow/
) - Create
workflows.config.json
:{ "workflow_name_api": { "prompt_workflow": "your_workflow.json", "fields": { "param1": "15.inputs.param1", "param2": ["16.inputs.input1", "16.inputs.input2"] }, "inputs": { "param1": {"type": "text", "default": "value"}, "param2": {"type": "integer", "default": 10} } } }
- Create
mode.config.json
for preset configurations (in Stable Diffusion Sketch app):[ { "name": "ModeName", "title": "Display Name", "showT2I": true, "show": true, "configurable": true, "default": {"param1": "value"}, "fields": { "workflow": "workflow_name", "param1": "fixed_value" } } ]
Access http://localhost:5000/runflow
to execute workflows through a convenient form-based interface:
- Select Workflow - Choose from available workflows
- Fill Parameters - Provide inputs via text fields and file uploads
- Submit & Monitor - Track real-time progress with step-by-step updates
- Retrieve Results - Find output in
ComfyUI/output
directory
ComfyuiGW/
├── comfyui_server.py # Main server implementation
├── run.bat # Windows launch script
├── run.sh # Linux launch script
├── requirements.txt # Python dependencies
├── workflows/ # Workflow configurations
│ ├── workflows.config.json # Workflow form template
│ ├── mode.config.json # Workflow list template
│ └── my_ComfyUI_workflow.json # Your custom ComfyUI workfiles API json
├── inputs/ # Uploaded input files
├── templates/ # Web interface templates
│ ├── runflow_form.html # Workflow form template
│ ├── runflow_list.html # Workflow list template
│ └── workflow_progress.html # Progress tracking
└── mode_config.json # Global mode configurations
Defines workflow mappings and API parameters with the following structure:
{
"workflow_name": {
"prompt_workflow": "filename.json",
"fields": {
"param1": "16.inputs.param1",
"param2": ["15.inputs.input1", "15.inputs.input2"]
},
"inputs": {
"param1": {"type": "text", "default": "default value"},
"param2": {"type": "integer", "default": 10}
}
}
}
- workflow_name: Unique identifier for the workflow (used in API calls)
- prompt_workflow: Path to the ComfyUI workflow JSON file
- fields: Maps API parameters to workflow node inputs:
- Key: API parameter name
- Value: Target node input(s) in format
"node_id.inputs.param_name"
(string for single input, array for multiple inputs)
- descriptions: (Optional) Description to be show in
runflow
web interface: - inputs: (Optional) Defines
runflow
parameters:- type: Data type (text, string, integer, float, array, image, video, audio)
- default: Default value if not provided
Defines preset configurations for workflows:
{
"name": "ModeName",
"title": "Display Name",
"showT2I": true,
"show": true,
"configurable": true,
"default": {"param1": "value", "param2": 0.5},
"fields": {
"workflow": "workflow_name",
"param1": "fixed_value",
"param2": "$variable"
}
}
- name: Internal mode identifier (alphanumeric, no spaces)
- title: Display name shown in UI
- showT2I: Show in text-to-image section (true/false)
- show: Enable/disable mode visibility (true/false)
- configurable: Allow parameter customization in UI (true/false)
- default: Default values for configurable parameters
- fields: Fixed parameters passed to workflow:
- workflow: Required - references workflow_name from workflows.config.json
- Additional fields: Fixed values or variables (prefixed with $, filled by app) to pass to workflow
- Python 3.8+
- ComfyUI installation
- Custom nodes (listed in Installation)
For issues and feature requests, please open an issue on GitHub.
ComfyuiGW simplifies ComfyUI workflow execution through a well-designed API gateway and web interface, making complex image and video processing workflows accessible to both developers and end-users.