Run ComfyUI on Replicate

Run ComfyUI on Replicate

You can execute ComfyUI workflows directly on Replicate using the fofr/any-comfyui-workflow model. This works by utilizing a ComfyUI JSON file. Simply submit your workflow as a JSON blob, and we will generate the corresponding outputs. Additionally, you have the option to upload inputs or include URLs within your JSON file.

How to Use the Replicate Model

Get Your API JSON

To use the Replicate model for ComfyUI workflows, you’ll need the API-compatible JSON format. This is different from the regular JSON file that contains visual information about the nodes. Here’s how to obtain it:

  1. Enable Developer Mode
    Open ComfyUI settings by clicking the settings icon and turn on the “Enable Dev Mode Options.”
  2. Load Your Workflow
    Load the workflow you want to run into ComfyUI.
  3. Export the API JSON
    Once the workflow is loaded, click the “Save (API format)” button to export your workflow in the API-compatible JSON format.

This API JSON can now be used with the fofr/any-comfyui-workflow model on Replicate.

Gather Your Input Files for Replicate Model

When your ComfyUI workflow requires inputs like images (e.g., for img2img or ControlNet), you have three options for providing those files:

1. Using URLs as Inputs

You can directly reference a URL in your API JSON file for images or other inputs. Simply modify the JSON to replace the file path with the URL:

Example:

- "image": "/your-path-to/image.jpg",
+ "image": "https://example.com/image.jpg",

2. Uploading a Single Input

You can upload a single file (e.g., an image or video). When running the model, Replicate will place it in the input directory with a standardized filename like input.[extension] (e.g., input.jpg). Reference this in your workflow by adjusting the file path:

Example:

- "image": "/your-path-to/my-picture-001.jpg",
+ "image": "image.jpg",

3. Uploading a Zip or Tar File of Inputs

For more complex models needing multiple files, upload a zip or tar file containing all your inputs. The contents will be extracted into the input directory. You can reference the files in your workflow by their relative paths.

Example of file structure:

  • my_img.png
  • references/my_reference_01.jpg
  • references/my_reference_02.jpg

JSON reference:

"image": "my_img.png",
"directory": "references"

Replicate will validate your inputs to ensure they exist before executing the workflow.

Run Your ComfyUI Workflow on Replicate

Once your inputs are ready, you can run the workflow. Replicate also offers a few additional options:

  • return_temp_files: If your workflow generates temporary files (e.g., pre-processed ControlNet images), this option will return those files as part of the output.
  • randomise_seeds: Set this option to true if you want to randomize all seed values, allowing for different outputs each time the workflow runs.

With these steps completed, you’re ready to execute your workflow on Replicate!

An example output

An example output

Supported Weights

Replicate supports a wide range of popular model weights, including:

  • SDXL
  • RealVisXL 3.0
  • Realistic Vision 5.1 and 6.0
  • DreamShaper 6
  • TurboVisionXL
  • Stable Video Diffusion
  • AnimateDiff
  • LCM Dreamshaper
  • LCM LoRAs

In addition, all popular ControlNets and preprocessors are supported. For preprocessors, it’s recommended to use the comfyui_controlnet_aux custom node. Advanced users can also utilize ComfyUI Advanced ControlNet for more intricate workflows.

If your exact model weight isn’t listed, you can try switching to a close match by updating your API JSON file with a different model filename. You can also request support for a new model weight by raising an issue. You can view the complete list of supported weights on their platform.

Custom Nodes

Replicate also supports various custom nodes. Some of the included custom nodes are:

  • ComfyUI IPAdapter Plus
  • ComfyUI Controlnet Aux
  • ComfyUI Inspire Pack
  • ComfyUI Logic
  • ComfyUI AnimateDiff Evolved
  • ComfyUI VideoHelperSuite
  • ComfyUI Advanced ControlNet
  • Efficiency Nodes ComfyUI
  • Derfuu ComfyUI ModdedNodes
  • ComfyUI FizzNodes

These nodes provide enhanced capabilities and features, ensuring flexibility in your workflows.

Read related articles: