Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
302 changes: 152 additions & 150 deletions community-solutions/comfyui-to-api/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,150 +1,152 @@
---
title: "ComfyUI-to-API"
description: "Convert your ComfyUI workflows into deployment-ready GitHub repositories with automated Dockerfile generation"
icon: "wand-magic-sparkles"
---

Access the tool at [comfy.getrunpod.io](https://comfy.getrunpod.io)

ComfyUI-to-API is a web-based tool that analyzes your ComfyUI workflows and automatically generates a Dockerfile and GitHub repository for deployment on Runpod Serverless. The tool uses a custom Comfy Agent to understand your workflow dependencies, searches for the right custom nodes and models, and creates a complete repository that you can deploy using [Runpod's GitHub integration](/serverless/workers/github-integration).

## What you'll learn

In this guide, you'll learn how to use ComfyUI-to-API to transform your ComfyUI workflows into Serverless workers. You'll upload a workflow file exported from ComfyUI, review the AI-powered analysis, generate a Dockerfile with all necessary dependencies, create a GitHub repository, and deploy it to Runpod Serverless using GitHub integration.

## Requirements

Before getting started, make sure you have:

- A ComfyUI workflow file exported via Comfy → File → Export (the full workflow export, not the API export).
- A GitHub account for repository creation.
- A Runpod account for Serverless deployment.
- Basic familiarity with ComfyUI workflows and custom nodes.

<Note>
Make sure to export your workflow using **Comfy → File → Export** (not the API
export). The tool needs the complete workflow information to properly analyze
your setup.
</Note>

## Step 1: Sign in with GitHub

Visit [comfy.getrunpod.io](https://comfy.getrunpod.io) to access ComfyUI-to-API. The tool requires you to sign in with your GitHub account so it can create a repository on your behalf in a later step.

Click **Sign in with GitHub** and authorize the application. Once authenticated, you'll be able to proceed with uploading your workflow.

## Step 2: Upload your workflow

Once you've accessed the tool, the first step is to upload your ComfyUI workflow file.

In ComfyUI, export your workflow using **Comfy → File → Export** (not the API export). This exports the complete workflow information needed for analysis. Then click the upload area or drag and drop your `workflow.json` file into the tool.

After uploading, you'll see a confirmation showing the filename and basic workflow information. The tool performs a quick validation to ensure your file is a valid ComfyUI workflow before proceeding to analysis.

## Step 3: Analyze your workflow

Click the **Analyze** button to run the custom Comfy Agent. You'll see progress information as the tool works through your workflow.

The analysis process detects custom nodes in your workflow, locates required models and their download URLs, resolves dependencies between nodes, and determines installation methods for each component. This typically takes 30-60 seconds depending on the complexity of your workflow.

The analysis results are displayed in expandable sections showing custom nodes found, models identified, and any potential issues or recommendations.

## Step 4: Review the generated Dockerfile

After analysis completes, the tool generates a Dockerfile based on your workflow. Review the Dockerfile to see what will be installed. The generated Dockerfile uses the [runpod-workers/worker-comfyui](https://github.com/runpod-workers/worker-comfyui) base image, which provides a clean ComfyUI installation without any models. The Dockerfile then adds installation commands for all your custom nodes, model download instructions with URLs, proper Python dependencies, and optimized caching layers for faster builds.

You can review and tweak the Dockerfile if needed, or skip ahead to the next step to create your GitHub repository.

<Tip>
Review the Dockerfile carefully to ensure all your custom nodes and models are
included. The AI is quite thorough, but you may want to add additional
customizations for your specific use case.
</Tip>

## Step 5: Create your repository

Now you can create a GitHub repository with all the necessary files for Serverless deployment. Since you authenticated with GitHub in step 1, the tool can create the repository on your behalf. Enter your desired repository name and optionally provide a description.

The tool creates a repository containing your Dockerfile and a README with setup and deployment instructions.

Click **Create GitHub repo** and watch the real-time progress as the tool creates your repository. Once complete, you'll see a success message with a direct link to your new GitHub repository.

## Step 6: Deploy to Runpod Serverless

With your GitHub repository created, you're ready to deploy to Runpod Serverless using the [GitHub integration](/serverless/workers/github-integration). This is where Runpod builds your Docker image from the Dockerfile and deploys it to an endpoint.

Navigate to [create a new endpoint](https://console.runpod.io/serverless/new-endpoint) in the Runpod console. Under "Import Git Repository", select your newly created repository from the dropdown menu. You'll need to connect your GitHub account to Runpod once if you haven't already.

Configure your deployment settings including which branch to deploy from (typically `main`), the path to your Dockerfile (typically in the root), and your GPU requirements based on your workflow's needs.

<Note>
For detailed instructions on deploying from GitHub, including how to authorize
Runpod with your GitHub account and configure deployment options, see [Deploy
workers from GitHub](/serverless/workers/github-integration).
</Note>

After clicking "Deploy Endpoint", Runpod builds the Docker image from your repository and deploys it to your endpoint automatically. You can monitor the build status in the "Builds" tab of your endpoint detail page. Once the build is complete, you can use the **example API request** provided in step 5 of the tool to test your endpoint.

## Understanding the repository files

The generated repository includes the essential files needed to build your Serverless worker.

The `Dockerfile` contains all the instructions to build your worker image. It starts from the [runpod-workers/worker-comfyui](https://github.com/runpod-workers/worker-comfyui) base image, which provides a clean ComfyUI installation along with all the handler code needed to run as a Serverless endpoint. Your Dockerfile then adds your custom nodes and downloads your required models. When you deploy via [GitHub integration](/serverless/workers/github-integration), Runpod uses this Dockerfile to build your Docker image.

The `README.md` provides documentation about your workflow and deployment instructions.

<Tip>
You can customize the Dockerfile after creation. For example, you might want
to add additional dependencies, adjust model download locations, or optimize
the build process.
</Tip>

## Updating your deployed worker

When you make changes to your repository, such as updating the Dockerfile to add new models or custom nodes, Runpod automatically detects these changes.

The [GitHub integration](/serverless/workers/github-integration) monitors your `main` branch for changes. When you push commits to `main`, Runpod automatically rebuilds the Docker image and updates your endpoint with the new version. You can monitor the rebuild progress in the "Builds" tab of your endpoint detail page.

For more details on managing deployments and monitoring builds, see [Deploy workers from GitHub](/serverless/workers/github-integration).

## Troubleshooting

<AccordionGroup>
<Accordion title="Wrong workflow export format">
**Problem:** The tool shows an error or doesn't detect my workflow properly.
**Solution:**
{""}
1. Make sure you exported using **Comfy → File → Export** (not the API
export).
{""}
2. The file should be named `workflow.json` and contain the complete
workflow structure.
{""}
3. If you used the API export, go back to ComfyUI and use File → Export
instead.
</Accordion>
<Accordion title="Dockerfile missing dependencies">
**Problem:** The generated Dockerfile doesn't include all your custom nodes
or models.
{""}
**Solution:**
{""}
1. Review the analysis results to see what was detected.
{""}
2. Some very new or obscure custom nodes may not be found automatically.
{""}
3. You can manually edit the Dockerfile in your GitHub repository to add
missing components.
{""}
4. Check the ComfyUI Registry to find installation instructions for missing
nodes.
</Accordion>
</AccordionGroup>

## Related documentation

- [Deploy workers from GitHub](/serverless/workers/github-integration)
- [Handler functions](/serverless/workers/handler-functions)
- [Creating a Dockerfile](/serverless/workers/deploy#creating-a-dockerfile)
- [Serverless overview](/serverless/overview)
- [Managing endpoints](/serverless/endpoints/overview)
---
title: "ComfyUI-to-API"
description: "Convert your ComfyUI workflows into deployment-ready GitHub repositories with automated Dockerfile generation"
icon: "wand-magic-sparkles"
---

Access the tool at [comfy.getrunpod.io](https://comfy.getrunpod.io)

ComfyUI-to-API is a web-based tool that analyzes your ComfyUI workflows and automatically generates a Dockerfile and GitHub repository for deployment on Runpod Serverless. The tool uses a custom Comfy Agent to understand your workflow dependencies, searches for the right custom nodes and models, and creates a complete repository that you can deploy using [Runpod's GitHub integration](/serverless/workers/github-integration).

## What you'll learn

In this guide, you'll learn how to use ComfyUI-to-API to transform your ComfyUI workflows into Serverless workers. You'll upload a workflow file exported from ComfyUI, review the AI-powered analysis, generate a Dockerfile with all necessary dependencies, create a GitHub repository, and deploy it to Runpod Serverless using GitHub integration.

## Requirements

Before getting started, make sure you have:

- A ComfyUI workflow file exported via Comfy → File → Export (the full workflow export, not the API export).
- A GitHub account for repository creation.
- A Runpod account for Serverless deployment.
- Basic familiarity with ComfyUI workflows and custom nodes.

<Note>
Make sure to export your workflow using **Comfy → File → Export** (not the API
export). The tool needs the complete workflow information to properly analyze
your setup.
</Note>

## Step 1: Sign in with GitHub

Visit [comfy.getrunpod.io](https://comfy.getrunpod.io) to access ComfyUI-to-API. The tool requires you to sign in with your GitHub account so it can create a repository on your behalf in a later step.

Click **Sign in with GitHub** and authorize the application. Once authenticated, you'll be able to proceed with uploading your workflow.

## Step 2: Upload your workflow

Once you've accessed the tool, the first step is to upload your ComfyUI workflow file.

In ComfyUI, export your workflow using **Comfy → File → Export** (not the API export). This exports the complete workflow information needed for analysis. Then click the upload area or drag and drop your `workflow.json` file into the tool.

After uploading, you'll see a confirmation showing the filename and basic workflow information. The tool performs a quick validation to ensure your file is a valid ComfyUI workflow before proceeding to analysis.

## Step 3: Analyze your workflow

Click the **Analyze** button to run the custom Comfy Agent. You'll see progress information as the tool works through your workflow.

The analysis process detects custom nodes in your workflow, locates required models and their download URLs, resolves dependencies between nodes, and determines installation methods for each component. This typically takes 30-60 seconds depending on the complexity of your workflow.

The analysis results are displayed in expandable sections showing custom nodes found, models identified, and any potential issues or recommendations.

## Step 4: Review the generated Dockerfile

After analysis completes, the tool generates a Dockerfile based on your workflow. Review the Dockerfile to see what will be installed. The generated Dockerfile uses the [runpod-workers/worker-comfyui](https://github.com/runpod-workers/worker-comfyui) base image, which provides a clean ComfyUI installation without any models. The Dockerfile then adds installation commands for all your custom nodes, model download instructions with URLs, proper Python dependencies, and optimized caching layers for faster builds.

You can review and tweak the Dockerfile if needed, or skip ahead to the next step to create your GitHub repository.

<Tip>
Review the Dockerfile carefully to ensure all your custom nodes and models are
included. The AI is quite thorough, but you may want to add additional
customizations for your specific use case.
</Tip>

## Step 5: Create your repository

Now you can create a GitHub repository with all the necessary files for Serverless deployment. Since you authenticated with GitHub in step 1, the tool can create the repository on your behalf. Enter your desired repository name and optionally provide a description.

The tool creates a repository containing your Dockerfile and a README with setup and deployment instructions.

Click **Create GitHub repo** and watch the real-time progress as the tool creates your repository. Once complete, you'll see a success message with a direct link to your new GitHub repository.

## Step 6: Deploy to Runpod Serverless

With your GitHub repository created, you're ready to deploy to Runpod Serverless using the [GitHub integration](/serverless/workers/github-integration). This is where Runpod builds your Docker image from the Dockerfile and deploys it to an endpoint.

Navigate to [create a new endpoint](https://console.runpod.io/serverless/new-endpoint) in the Runpod console. Under "Import Git Repository", select your newly created repository from the dropdown menu. You'll need to connect your GitHub account to Runpod once if you haven't already.

Configure your deployment settings including which branch to deploy from (typically `main`), the path to your Dockerfile (typically in the root), and your GPU requirements based on your workflow's needs.

<Note>
For detailed instructions on deploying from GitHub, including how to authorize
Runpod with your GitHub account and configure deployment options, see [Deploy
workers from GitHub](/serverless/workers/github-integration).
</Note>

After clicking "Deploy Endpoint", Runpod builds the Docker image from your repository and deploys it to your endpoint automatically. You can monitor the build status in the "Builds" tab of your endpoint detail page. Once the build is complete, you can use the **example API request** provided in step 5 of the tool to test your endpoint.

## Understanding the repository files

The generated repository includes the essential files needed to build your Serverless worker.

The `Dockerfile` contains all the instructions to build your worker image. It starts from the [runpod-workers/worker-comfyui](https://github.com/runpod-workers/worker-comfyui) base image, which provides a clean ComfyUI installation along with all the handler code needed to run as a Serverless endpoint. Your Dockerfile then adds your custom nodes and downloads your required models. When you deploy via [GitHub integration](/serverless/workers/github-integration), Runpod uses this Dockerfile to build your Docker image.

The `README.md` provides documentation about your workflow and deployment instructions.

<Tip>
You can customize the Dockerfile after creation. For example, you might want
to add additional dependencies, adjust model download locations, or optimize
the build process.
</Tip>

## Updating your deployed worker

When you make changes to your repository, such as updating the Dockerfile to add new models or custom nodes, Runpod automatically detects these changes.

The [GitHub integration](/serverless/workers/github-integration) monitors your `main` branch for changes. When you push commits to `main`, Runpod automatically rebuilds the Docker image and updates your endpoint with the new version. You can monitor the rebuild progress in the "Builds" tab of your endpoint detail page.

For more details on managing deployments and monitoring builds, see [Deploy workers from GitHub](/serverless/workers/github-integration).

## Troubleshooting

<AccordionGroup>
<Accordion title="Wrong workflow export format">
**Problem:** The tool shows an error or doesn't detect my workflow properly.
**Solution:**
{""}
1. Make sure you exported using **Comfy → File → Export** (not the API
export).
{""}
2. The file should be named `workflow.json` and contain the complete
workflow structure.
{""}
3. If you used the API export, go back to ComfyUI and use File → Export
instead.
</Accordion>
<Accordion title="Dockerfile missing dependencies">
**Problem:** The generated Dockerfile doesn't include all your custom nodes
or models.
{""}
**Solution:**
{""}
1. Review the analysis results to see what was detected.
{""}
2. Some very new or obscure custom nodes may not be found automatically.
{""}
3. You can manually edit the Dockerfile in your GitHub repository to add
missing components.
{""}
4. Check the ComfyUI Registry to find installation instructions for missing
nodes.
</Accordion>
</AccordionGroup>

## Related documentation

- [Deploy workers from GitHub](/serverless/workers/github-integration)
- [Handler functions](/serverless/workers/handler-functions)
- [Creating a Dockerfile](/serverless/workers/deploy#creating-a-dockerfile)
- [Serverless overview](/serverless/overview)
- [Managing endpoints](/serverless/endpoints/overview)
- [Generate images with ComfyUI on Pods](/tutorials/pods/comfyui): Deploy ComfyUI on a Pod to develop and test workflows interactively.
- [Deploy ComfyUI on Serverless](/tutorials/serverless/comfyui): Deploy a Serverless endpoint running ComfyUI and generate images using workflow JSON.
11 changes: 9 additions & 2 deletions tutorials/pods/comfyui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebarTitle: "Generate images with ComfyUI"
description: "Deploy ComfyUI on Runpod to create AI-generated images."
---

import { TemplateTooltip, PodTooltip, NetworkVolumeTooltip, RunpodCLITooltip } from "/snippets/tooltips.jsx";
import { TemplateTooltip, PodTooltip, NetworkVolumeTooltip, RunpodCLITooltip, ServerlessTooltip } from "/snippets/tooltips.jsx";

This tutorial walks you through how to configure ComfyUI on a [GPU Pod](/pods/overview) and use it to generate images with text-to-image models.

Expand Down Expand Up @@ -210,4 +210,11 @@ While working with ComfyUI, you can monitor your usage by checking GPU/disk util

Stop your Pod when you're finished to avoid unnecessary charges.

It's also a good practice to download any custom workflows to your local machine before stopping the Pod. For persistent storage of models and outputs across sessions, consider using a <NetworkVolumeTooltip />.
It's also a good practice to download any custom workflows to your local machine before stopping the Pod. For persistent storage of models and outputs across sessions, consider using a <NetworkVolumeTooltip />.

### Deploy to production

Once you've developed a workflow you're happy with, you can deploy it to a <ServerlessTooltip /> for production use:

- [Deploy ComfyUI on Serverless](/tutorials/serverless/comfyui): Learn how to deploy a Serverless endpoint running ComfyUI and generate images using workflow JSON.
- [ComfyUI-to-API](/community-solutions/comfyui-to-api/overview): Use this community tool to automatically generate a deployment-ready GitHub repository from your ComfyUI workflow, complete with Dockerfile and dependencies.
Loading