comfyui-all

n8n community nodes for ComfyUI workflow execution with dynamic parameter support

Package Information

Downloads: 2,122 weeklyΒ /Β 7,366 monthly
Latest Version: 2.5.3
Author: wwrs

Documentation

n8n-nodes-comfyui-all

Execute ComfyUI workflows in n8n - Generate images, videos, and more with AI!

npm version

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:

  1. n8n API - Checks if called by AI Agent via isToolExecution()
  2. Execution Context - Checks for chat mode context
  3. Input Data - Checks for AI Agent markers in input data
  4. Heuristics - Analyzes input characteristics
  5. 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:

  1. Add ComfyUI to AI Agent tools
  2. Configure ComfyUI node:
    • ComfyUI URL: http://127.0.0.1:8188
    • Workflow JSON: Your text-to-image workflow
    • Execution Mode: Auto Detect
    • Timeout: 300

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

  1. Open ComfyUI
  2. Create or load your workflow
  3. Click "Save (API Format)" (not "Save")
  4. Copy the JSON
  5. 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

  1. Get Your API Key

  2. Choose Your GPU Plan

    • 24G GPU: Standard performance
    • 48G GPU: High performance (for complex workflows)
  3. 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
    • 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
    • Replace YOUR_API_KEY with your actual API key
  4. 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
  5. 🎁 Bonus Rewards

    • Use invite code rh-v1052 when 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

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:8188 or http://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 handling
  • ParameterTypeHandler - Type conversion logic
  • ParameterProcessor - Main coordinator
  • executionModeDetector - Multi-layer mode detection
  • ComfyUiClient - 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?


License

MIT


Happy automating with ComfyUI! πŸš€

Discussion