AutomationFlowsWeb Scraping › Run ComfyUI Workflows via Replicate API

Run ComfyUI Workflows via Replicate API

Original n8n title: Run Comfyui Image Generation Workflows Through Replicate API

ByYaron Been @yaron-nofluff on n8n.io

This workflow provides automated access to the Fofr Any Comfyui Workflow AI model through the Replicate API. It saves you time by eliminating the need to manually interact with AI models and provides a seamless integration for other generation tasks within your n8n automation…

Event trigger★★★★☆ complexity15 nodesHTTP Request
Web Scraping Trigger: Event Nodes: 15 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #6858 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "model_name": "any-comfyui-workflow",
    "model_type": "other",
    "version_id": "67ed4ba04ce0842446e16c428b1be131452815d01810861f71d171f63e8ba8f0",
    "model_owner": "fofr",
    "generated_at": "2025-08-01T14:50:46.858078"
  },
  "name": "fofr/any-comfyui-workflow - Other Generator",
  "nodes": [
    {
      "id": "82139f18-0b59-4990-873d-24d973d6f8c0",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -896,
        -176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1d2f4cb9-1e4b-4b99-bc4f-71d12c9a0a75",
      "name": "Set API Token",
      "type": "n8n-nodes-base.set",
      "position": [
        -608,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "api_token",
              "name": "api_token",
              "type": "string",
              "value": "YOUR_REPLICATE_API_TOKEN"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "e88c79e3-801f-4de1-9ade-ce0cdcda046d",
      "name": "Set Other Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        -288,
        -128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "api_token",
              "name": "api_token",
              "type": "string",
              "value": "={{ $('Set API Token').item.json.api_token }}"
            },
            {
              "id": "input_file",
              "name": "input_file",
              "type": "string",
              "value": "https://picsum.photos/512/512"
            },
            {
              "id": "output_format",
              "name": "output_format",
              "type": "string",
              "value": "webp"
            },
            {
              "id": "workflow_json",
              "name": "workflow_json",
              "type": "string",
              "value": ""
            },
            {
              "id": "output_quality",
              "name": "output_quality",
              "type": "number",
              "value": 95
            },
            {
              "id": "randomise_seeds",
              "name": "randomise_seeds",
              "type": "boolean",
              "value": true
            },
            {
              "id": "force_reset_cache",
              "name": "force_reset_cache",
              "type": "boolean",
              "value": false
            },
            {
              "id": "return_temp_files",
              "name": "return_temp_files",
              "type": "boolean",
              "value": false
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "ad012b3d-9df6-4898-ac64-ff4b27003ce7",
      "name": "Create Other Prediction",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -64,
        -128
      ],
      "parameters": {
        "url": "https://api.replicate.com/v1/predictions",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "json"
            }
          }
        },
        "jsonBody": "={\n  \"version\": \"fofr/any-comfyui-workflow:67ed4ba04ce0842446e16c428b1be131452815d01810861f71d171f63e8ba8f0\",\n  \"input\": {\n    \"input_file\": \"{{ $json.input_file }}\",\n    \"output_format\": \"{{ $json.output_format }}\",\n    \"workflow_json\": \"{{ $json.workflow_json }}\",\n    \"output_quality\": {{ $json.output_quality }},\n    \"randomise_seeds\": {{ $json.randomise_seeds }},\n    \"force_reset_cache\": {{ $json.force_reset_cache }},\n    \"return_temp_files\": {{ $json.return_temp_files }}\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.api_token }}"
            },
            {
              "name": "Prefer",
              "value": "wait"
            }
          ]
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "6254845a-f930-4a50-9c5b-fb0bdec42fd6",
      "name": "Wait 5s",
      "type": "n8n-nodes-base.wait",
      "position": [
        160,
        -128
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 5
      },
      "typeVersion": 1
    },
    {
      "id": "c959cf6a-17fe-43cf-b94e-915f18939bed",
      "name": "Check Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        384,
        -128
      ],
      "parameters": {
        "url": "=https://api.replicate.com/v1/predictions/{{ $('Create Other Prediction').item.json.id }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "json"
            }
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set API Token').item.json.api_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "8dc673aa-0a95-4604-bf2b-d33739350798",
      "name": "Is Complete?",
      "type": "n8n-nodes-base.if",
      "position": [
        528,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c93d7ba1-0ef9-4087-aa10-389cb2a2c6bd",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "succeeded"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b85b0ed4-277c-43aa-b1d3-17987d3b7315",
      "name": "Has Failed?",
      "type": "n8n-nodes-base.if",
      "position": [
        848,
        -80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d1bfd044-3a07-4c18-b55f-72d192596139",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "failed"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f6f28884-3235-4d3f-81f5-7c93a5c5fb91",
      "name": "Wait 10s",
      "type": "n8n-nodes-base.wait",
      "position": [
        720,
        128
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 10
      },
      "typeVersion": 1
    },
    {
      "id": "0758b235-864b-44c0-bdac-03a414262b16",
      "name": "Success Response",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        -320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "success-response",
              "name": "response",
              "type": "object",
              "value": "={{ { success: true, result_url: $json.output, prediction_id: $json.id, status: $json.status, message: 'Other generated successfully' } }}"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "84adb2bb-7ee8-4e91-a548-5b055fc44590",
      "name": "Error Response",
      "type": "n8n-nodes-base.set",
      "position": [
        1344,
        144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "error-response",
              "name": "response",
              "type": "object",
              "value": "={{ { success: false, error: $json.error || 'Other generation failed', prediction_id: $json.id, status: $json.status, message: 'Failed to generate other' } }}"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "0e0740f8-0121-42af-824e-da8291c85933",
      "name": "Display Result",
      "type": "n8n-nodes-base.set",
      "position": [
        1552,
        -144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "final-result",
              "name": "final_result",
              "type": "object",
              "value": "={{ $json.response }}"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "3a71cf09-86d6-4d48-9dd4-bf6ff5be6c53",
      "name": "Log Request",
      "type": "n8n-nodes-base.code",
      "position": [
        160,
        -320
      ],
      "parameters": {
        "jsCode": "// Log generation details for monitoring\nconst data = $input.all()[0].json;\n\nconsole.log('fofr/any-comfyui-workflow Request:', {\n  timestamp: new Date().toISOString(),\n  prediction_id: data.id,\n  model_type: 'other'\n});\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "48d7fdf2-9d2f-4642-8ded-f1316baddda3",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        -304
      ],
      "parameters": {
        "color": 4,
        "width": 580,
        "height": 320,
        "content": "=======================================\n        ANY-COMFYUI-WORKFLOW GENERATOR\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n======================================="
      },
      "typeVersion": 1
    },
    {
      "id": "1e6a6363-8aef-40eb-a751-16013fcff206",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        48
      ],
      "parameters": {
        "color": 4,
        "width": 589,
        "height": 1958,
        "content": "## \ud83e\udd16 **FOFR/ANY-COMFYUI-WORKFLOW - OTHER GENERATION WORKFLOW**\n\n**\ud83d\udd25 Powered by Replicate API and n8n Automation**\n\n---\n\n### \ud83d\udcdd **Model Overview**\n\n- **Owner**: fofr\n- **Model**: any-comfyui-workflow\n- **Type**: Other Generation\n- **API Endpoint**: https://api.replicate.com/v1/predictions\n\n**\ud83c\udfaf What This Model Does:**\nRun any ComfyUI workflow. Guide: https://github.com/replicate/cog-comfyui\n\n---\n\n### \ud83d\udccb **Parameter Reference**\n\n**\ud83d\udd34 Required Parameters:** None\n**\ud83d\udd35 Optional Parameters:** input_file, output_format, workflow_json, output_quality, randomise_seeds, force_reset_cache, return_temp_files\n\n**\ud83d\udcd6 Detailed Parameter Guide:**\n- **input_file** (string): Input image, video, tar or zip file. Read guidance on workflows and input files here: https://git...\n- **output_format** (string): Format of the output images (Default: webp)\n- **workflow_json** (string): Your ComfyUI workflow as JSON string or URL. You must use the API version of your workflow. Get i... (Default: )\n- **output_quality** (integer): Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. (Default: 95)\n- **randomise_seeds** (boolean): Automatically randomise seeds (seed, noise_seed, rand_seed) (Default: True)\n- **force_reset_cache** (boolean): Force reset the ComfyUI cache before running the workflow. Useful for debugging. (Default: False)\n- **return_temp_files** (boolean): Return any temporary files, such as preprocessed controlnet images. Useful for debugging. (Default: False)\n\n---\n\n### \ud83d\udd27 **Workflow Components Explained**\n\n**\ud83c\udfaf Manual Trigger**\n- Starts the workflow execution\n- Click to begin other generation process\n\n**\ud83d\udd10 Set API Token** \n- Configures your Replicate API authentication\n- Replace 'YOUR_REPLICATE_API_TOKEN' with your actual token\n- Essential for accessing the fofr/any-comfyui-workflow model\n\n**\u2699\ufe0f Set Other Parameters**\n- Configures all input parameters for the model\n- Includes both required and optional parameters\n- Pre-filled with sensible defaults for testing\n\n**\ud83d\ude80 Create Other Prediction**\n- Sends the generation request to Replicate API\n- Uses the other parameters you configured\n- Returns a prediction ID for status tracking\n\n**\u23f3 Wait & Status Checking Loop**\n- Waits 5 seconds then checks prediction status\n- Continues checking until completion or failure\n- Implements intelligent retry logic with 10-second delays\n\n**\u2705 Success/Error Handling**\n- Routes successful completions to success response\n- Handles failures gracefully with error details\n- Returns structured JSON response with URLs/errors\n\n**\ud83d\udcca Logging & Monitoring**\n- Logs all requests for debugging and monitoring\n- Tracks timestamps and prediction IDs\n- Helps identify issues during development\n\n---\n\n### \ud83c\udf1f **Key Benefits**\n\n- **\ud83c\udfa8 Instant Other Generation**: Transform ideas into others using state-of-the-art AI\n- **\ud83d\udd04 Automated Workflow**: Handles the complete generation pipeline automatically\n- **\ud83d\udee1\ufe0f Error Resilience**: Built-in retry logic and comprehensive error handling\n- **\ud83d\udcc8 Production Ready**: Includes logging, monitoring, and structured responses\n- **\ud83d\udd27 Customizable**: Easy to modify parameters and extend functionality\n- **\u26a1 Efficient Processing**: Optimized API calls with intelligent status checking\n\n---\n\n### \ud83d\ude80 **Quick Start Instructions**\n\n1. **\ud83d\udd11 Get Your API Key**\n   - Sign up at https://replicate.com\n   - Navigate to your account settings\n   - Copy your API token\n\n2. **\ud83d\udd27 Configure the Workflow**\n   - Replace 'YOUR_REPLICATE_API_TOKEN' with your actual token\n   - Adjust parameters in the 'Set Other Parameters' node\n   - Customize the prompt or other inputs as needed\n\n3. **\u25b6\ufe0f Execute the Workflow**\n   - Click the 'Manual Trigger' to start\n   - Monitor the execution in the n8n interface\n   - Check logs for detailed execution information\n\n4. **\ud83d\udce5 Get Your Results**\n   - Successful generations return a URL to your other\n   - Download or use the generated content as needed\n   - Results are available immediately upon completion\n\n---\n\n### \ud83d\udd0d **Troubleshooting Guide**\n\n**Common Issues:**\n- **Invalid API Token**: Ensure your Replicate token is valid and has sufficient credits\n- **Parameter Validation**: Check that required parameters match expected types\n- **Generation Timeout**: Some others take longer - monitor the logs\n- **Output Format**: Verify the model returns the expected output format\n\n**Best Practices:**\n- Test with default parameters first\n- Monitor your Replicate usage and billing\n- Keep API tokens secure and never commit them to code\n- Use appropriate parameter values for your use case\n\n---\n\n**\ud83d\udd17 Additional Resources:**\n- Model Documentation: https://replicate.com/fofr/any-comfyui-workflow\n- Replicate API Docs: https://replicate.com/docs\n- n8n Documentation: https://docs.n8n.io\n\n---"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "versionId": "1",
  "connections": {
    "Wait 5s": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 10s": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Failed?": {
      "main": [
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Request": {
      "main": [
        [
          {
            "node": "Wait 5s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status": {
      "main": [
        [
          {
            "node": "Is Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Complete?": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Has Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set API Token": {
      "main": [
        [
          {
            "node": "Set Other Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Response": {
      "main": [
        [
          {
            "node": "Display Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set API Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success Response": {
      "main": [
        [
          {
            "node": "Display Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Other Parameters": {
      "main": [
        [
          {
            "node": "Create Other Prediction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Other Prediction": {
      "main": [
        [
          {
            "node": "Log Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow provides automated access to the Fofr Any Comfyui Workflow AI model through the Replicate API. It saves you time by eliminating the need to manually interact with AI models and provides a seamless integration for other generation tasks within your n8n automation…

Source: https://n8n.io/workflows/6858/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t

Execute Command, Read Write File, HTTP Request +3
Web Scraping

[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.

HTTP Request, GitHub, Stop And Error +1
Web Scraping

[](https://youtu.be/c7yCZhmMjtI)

HTTP Request, GitHub, Stop And Error +1
Web Scraping

This automation organizes your n8n workflows files into categorizes (Active, Template, Done, Archived) and uploads them directly to a categorized Google Drive folders. It is designed to help users man

Google Drive, HTTP Request, Time Saved
Web Scraping

Create Animated Stories using GPT-4o-mini, Midjourney, Kling and Creatomate API. Uses httpRequest. Event-driven trigger; 51 nodes.

HTTP Request