comfyui-api  by SaladTechnologies

ComfyUI inference as a stateless API

Created 1 year ago
254 stars

Top 99.1% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a stateless, horizontally scalable API server for ComfyUI, simplifying programmatic access to its powerful generative AI capabilities. It targets developers and power users needing to integrate ComfyUI workflows into applications, offering flexible output delivery via direct responses, webhooks, or S3 storage.

How It Works

This project wraps the ComfyUI /prompt API, enabling stateless execution of any ComfyUI workflow. It handles input fetching (base64, URL, S3), server-side image processing (format conversion via sharp), and output delivery. Users can receive results directly in the API response, have them sent to a webhook URL, or uploaded to an S3 bucket. The architecture supports dynamic API endpoints by loading custom workflow definitions from a /workflows directory at runtime.

Quick Start & Requirements

  • Installation: Deploy via pre-built Docker images (e.g., ghcr.io/saladtechnologies/comfyui-api) or integrate the comfyui-api binary into an existing ComfyUI Dockerfile.
  • Prerequisites: ComfyUI installation, custom models/extensions placed in appropriate ComfyUI directories. S3 integration requires AWS credentials. Testing demands ~24GB RAM and 16GB VRAM.
  • Resources: Base Docker image is ~3.25GB compressed; custom models must fit within a 35GB total limit on platforms like SaladCloud. Testing takes ~30 minutes.
  • Docs/Demos: Swagger docs available at /docs on the running server. Examples in the Salad Recipes repository.

Highlighted Details

  • Full ComfyUI Integration: Supports all ComfyUI workflows, including custom nodes and models.
  • Stateless & Scalable: Designed for horizontal scaling behind a load balancer.
  • Flexible Output Handling: Synchronous image return (PNG, JPEG, WebP), webhook notifications, or S3 uploads with async option.
  • Dynamic Workflows: Extensible API via .js/.ts files in /workflows directory, enabling runtime endpoint creation.
  • System Event Forwarding: Can relay ComfyUI websocket events (progress, status, errors) to a webhook.
  • Single Binary Distribution: Simplifies deployment with minimal external dependencies.

Maintenance & Community

The README does not detail specific community channels (e.g., Discord, Slack), maintainer information, or active sponsorships. Contributions are encouraged via GitHub issues.

Licensing & Compatibility

  • comfyui-api: MIT License, permissive for commercial use.
  • ComfyUI: GPL-3.0 License, which may impose copyleft restrictions on derivative works or linked components, potentially impacting closed-source commercial applications.
  • Dependencies: Primarily MIT or Apache 2.0 licensed.

Limitations & Caveats

The GPL-3.0 license of ComfyUI itself may restrict commercial integration. Long-running workflows may require webhook or queue-based handling to avoid platform timeouts (e.g., SaladCloud's 100s gateway timeout). Not all ComfyUI features or options are guaranteed to be supported, with contributions actively sought. Testing requires substantial hardware resources.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
2
Star History
33 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.