Package Information
Available Nodes
Documentation
n8n-nodes-comfyui-all
Execute ComfyUI workflows in n8n - Generate images, videos, and more with AI!
Video Tutorials
| Platform | Link | Description |
|---|---|---|
| πΊ YouTube | Watch Tutorial | English tutorial |
| πΊ Bilibili | θ§ηζη¨ | δΈζζη¨ |
What This Does
This package adds one intelligent node to n8n that automatically detects how it's being used:
ComfyUI Node - Universal ComfyUI workflow executor
- β Auto-detects execution mode (Tool for AI Agents or Action for workflows)
- β Manual mode override available
- β Works with AI Agents as a tool
- β Works in regular workflows with full binary support
- β Supports URL and binary image input
- β Dynamic parameter overrides
You can use this node to:
- Generate images from text prompts
- Process and edit images
- Generate videos
- Use AI Agents to create images automatically
- And much more with any ComfyUI workflow!
Quick Setup
1. Install
# n8n Cloud: Settings β Community Nodes β Install β n8n-nodes-comfyui-all
# Self-hosted:
cd ~/.n8n
npm install n8n-nodes-comfyui-all
2. Run ComfyUI
Option A: Local ComfyUI
# Default: http://127.0.0.1:8188
Option B: RunningHub Cloud Service
# RunningHub provides cloud ComfyUI service
# Get your API key from: https://www.runninghub.cn/?inviteCode=rh-v1052
# Use one of these URLs:
# 24G GPU: https://www.runninghub.cn/proxy/YOUR_API_KEY
# 48G GPU: https://www.runninghub.cn/proxy-plus/YOUR_API_KEY
3. Use in n8n
Add the ComfyUI node to your workflow! It will automatically detect of best execution mode.
How It Works
Execution Modes
The ComfyUI node supports three execution modes:
Auto Detect (default):
- Automatically detects the best mode based on context
- Uses Tool mode when called by AI Agents
- Uses Action mode for regular workflows
Tool Mode (for AI Agents):
[Chat Input] β [AI Agent] β [ComfyUI]
- Detects AI Agent context
- Returns image URLs (compact, LLM-friendly)
- Supports URL image input
- Dynamic parameter overrides
- Optimized for AI Agent interactions
Action Mode (for regular workflows):
[HTTP Request] β [ComfyUI] β [Save File]
- Used in standard workflows
- Returns full binary data
- Supports URL and binary image input
- Full workflow integration
Detection Priority
When using Auto Detect mode, the node checks in this order:
- n8n API - Checks if called by AI Agent via
isToolExecution() - Execution Context - Checks for chat mode context
- Input Data - Checks for AI Agent markers in input data
- Heuristics - Analyzes input characteristics
- Default - Falls back to Action mode
Smart Warnings
The node provides intelligent warnings when:
- Manual mode selection conflicts with high-confidence detection
- Helps prevent configuration mistakes
- Always shows detection results for transparency
Parameters Explained
Main Parameters
| Parameter | What It Does | Example |
|---|---|---|
| ComfyUI URL | Where ComfyUI is running | http://127.0.0.1:8188 (local) or https://www.runninghub.cn/proxy/YOUR_API_KEY (RunningHub) |
| Workflow JSON | Your ComfyUI workflow (API format) | {...} |
| Timeout | Max wait time for execution (seconds) | 300 (5 minutes) |
| Output Binary Key | Property name for output binary data | data |
| Execution Mode | Auto/Tool/Action mode selection | Auto Detect |
| Node Parameters | Dynamic workflow parameter overrides | See below |
Node Parameters
These allow you to dynamically override any value in your ComfyUI workflow.
| Field | What It Does |
|---|---|
| Node ID | The ComfyUI node to change (e.g., "6", "13") |
| Parameter Mode | "Single" for one parameter, "Multiple" for JSON object |
| Type | Text, Number, Boolean, Image, or File |
| Value | The value to set (for single mode) |
| Image Input Type | URL or Binary (for image or file type) |
| Image URL | URL of image (when using URL input) |
| Parameters JSON | JSON object with multiple parameters |
Usage Examples
Example 1: Generate Image with AI Agent
Workflow:
[Chat Interface] β [AI Agent] β [ComfyUI]
Setup:
- Add ComfyUI to AI Agent tools
- Configure ComfyUI node:
- ComfyUI URL:
http://127.0.0.1:8188 - Workflow JSON: Your text-to-image workflow
- Execution Mode:
Auto Detect - Timeout:
300
- ComfyUI URL:
Chat:
You: Generate an image of a sunset over mountains
AI: I'll generate that image for you!
[Automatically uses Tool mode]
Done! Here's your image π¨
[Returns image URL]
Output:
{
"success": true,
"imageUrls": ["http://127.0.0.1:8188/view?filename=image.png"],
"imageCount": 1
}
Example 2: Process Image in Workflow
Workflow:
[HTTP Request] β [ComfyUI] β [Save to File]
Setup:
ComfyUI URL: http://127.0.0.1:8188
Workflow JSON: [Your image processing workflow]
Execution Mode: Action Mode
Node Parameters:
Node ID: 107
Type: Image
Image Input Type: URL
Image URL: https://example.com/image.png
Output (Action mode with binary):
{
"success": true,
"data": {...},
"binary": {
"data": {
"data": "base64_encoded_image",
"mimeType": "image/png",
"fileName": "ComfyUI_00001.png"
}
},
"imageCount": 1
}
Example 3: Dynamic Text Prompt
Setup:
ComfyUI Node:
ComfyUI URL: http://127.0.0.1:8188
Workflow JSON: [Text-to-Image workflow]
Execution Mode: Auto Detect
Node Parameters:
Node ID: 6 (CLIP Text node)
Type: Text
Value: {{ $json.prompt }}
Input:
{ "prompt": "a cyberpunk city at night, neon lights" }
Example 4: Multiple Parameters
Setup:
Node Parameters:
Node ID: 3
Parameter Mode: Multiple Parameters
Parameters JSON:
{
"width": 1024,
"height": 1024,
"steps": 30,
"cfg_scale": 8
}
Example 5: Generate Video
Same as image generation, just use a video workflow!
Output:
{
"success": true,
"videoUrls": ["http://127.0.0.1:8188/view?filename=video.mp4"],
"videoCount": 1
}
How to Get Your Workflow JSON
- Open ComfyUI
- Create or load your workflow
- Click "Save (API Format)" (not "Save")
- Copy the JSON
- Paste it in the node's Workflow JSON field
RunningHub Cloud Service
RunningHub provides cloud ComfyUI service that is fully compatible with this node.
Getting Started
Get Your API Key
- International users (outside China): https://www.runninghub.ai/?inviteCode=rh-v1052
- China mainland users: https://www.runninghub.cn/?inviteCode=rh-v1052
- Register using either link above
Choose Your GPU Plan
- 24G GPU: Standard performance
- 48G GPU: High performance (for complex workflows)
Configure ComfyUI Node
- International users: Use one of:
- 24G:
https://www.runninghub.ai/proxy/YOUR_API_KEY - 48G:
https://www.runninghub.ai/proxy-plus/YOUR_API_KEY
- 24G:
- China mainland users: Use one of:
- 24G:
https://www.runninghub.cn/proxy/YOUR_API_KEY - 48G:
https://www.runninghub.cn/proxy-plus/YOUR_API_KEY
- 24G:
- Replace
YOUR_API_KEYwith your actual API key
- International users: Use one of:
Model Management
- Browse models in RunningHub's model library
- Click "β " to favorite models you want to use
- Favorited models will be available in your workflows
π Bonus Rewards
- Use invite code
rh-v1052when registering - Get 1000 RH coins as bonus reward
- Coins can be used for premium features on RunningHub
- Works for both international and China mainland users
- Use invite code
Advantages of RunningHub
- β No local setup required - No need to install ComfyUI locally
- β High performance - Cloud GPUs with fast processing
- β Easy integration - Just change the URL in n8n
- β Full compatibility - Works exactly like local ComfyUI
- β Model library - Access to pre-installed models
- β Auto-scaling - Handles complex workflows automatically
Usage Tips
- For simple workflows, 24G GPU is sufficient
- For complex workflows (video, high-res images), use 48G GPU
- The node automatically handles RunningHub's response format
- Works in both Tool mode (URLs only) and Action mode (full binary)
Tips & Tricks
β Find Your Node ID
Open your workflow JSON and look for:
{
"6": {
"inputs": {...},
"class_type": "KSampler"
}
}
The "6" is your Node ID!
β URL vs Binary Input
Use URL when:
- Working with AI Agents (smaller context)
- Images are publicly accessible
- Processing multiple images
- Tool Mode execution
Use Binary when:
- Images are from previous n8n nodes
- Working with local files
- Need full image data in workflow
- Action Mode execution
β Test First
Always test your workflow in ComfyUI before using it in n8n!
β Use Appropriate Timeouts
Simple workflows: 60-120 seconds
Complex workflows: 300-600 seconds
Video generation: 600-1800 seconds
β Execution Mode Tips
- Use Auto Detect for most cases
- Use Tool Mode when specifically working with AI Agents
- Use Action Mode for standard workflow processing
- Check n8n logs for detection results and warnings
Troubleshooting
"Invalid ComfyUI URL"
- Make sure ComfyUI is running
- Check the URL format:
http://127.0.0.1:8188orhttp://localhost:8188
"Workflow execution timeout"
- Increase the timeout value in node settings
- Check if ComfyUI is processing the workflow
"Node ID not found"
- Check your workflow JSON
- Node IDs are strings like "6", "3", "13"
- Make sure the node exists in your workflow
"Failed to download image"
- Make sure to URL is publicly accessible
- Cannot use localhost URLs in Tool mode
- Check network connectivity
"Workflow execution cancelled"
- Task was cancelled by user or system
- Check n8n logs for cancellation details
- This is normal behavior and not an error
"Binary property not found"
- Check the previous node's "Output Binary Key" setting
- Make sure binary data exists in input
- Verify the property name matches
"AI Agent doesn't call ComfyUI"
- Make sure ComfyUI is added to Agent's tools
- Check the workflow JSON is set
- Try being more specific in your chat: "Generate an image of..." instead of "Help me with images"
"Tool mode doesn't support binary input"
- Use URL input instead of binary in Tool mode
- Or switch to Action mode if you need binary support
Architecture & Improvements
Recent Enhancements (v2.4.15)
π― Execution Mode Control
- Auto Detect mode for smart detection
- Manual Tool/Action mode override
- Intelligent warnings on mode conflicts
π€ Smart Mode Detection
- Primary: n8n API
isToolExecution() - Secondary: Execution context (chat mode)
- Tertiary: AI Agent metadata markers
- Fallback: Heuristic analysis
- Default: Action mode
π¦ Modular Architecture
ImageProcessor- Dedicated image handlingParameterTypeHandler- Type conversion logicParameterProcessor- Main coordinatorexecutionModeDetector- Multi-layer mode detectionComfyUiClient- HTTP client with retry logic
β Code Quality
- ESLint v9 flat config
- Zero non-null assertions
- Comprehensive type validation
- All ES6 imports
- Config object pattern
What's New
Latest Updates (v2.4.15+)
Bug Fixes (Commit: 3891f1b1):
- β Fixed video processing loop index error
- β Added null check for videoBuffer to prevent undefined errors
- β Tool mode and Action mode now have identical UI (both support parameters)
Recent Enhancements:
- β Execution Mode parameter (Auto/Tool/Action)
- β Multi-layer detection strategy (5 levels)
- β Smart warning system for mode conflicts
- β UI text optimization
Need Help?
- π n8n Documentation
- π¬ n8n Community
- π Report Issues
- π§ Email: ksxh0524@outlook.com
License
MIT
Happy automating with ComfyUI! π