Skip to content

ComfyKit

ComfyUI - UI + Kit = ComfyKit

Python SDK for ComfyUI - Support Local or Cloud - Generate images, videos, audio in 3 lines


✨ What is ComfyKit?

ComfyKit is a pure Python SDK that provides a clean API for executing ComfyUI workflows and returns structured Python objects.

Execute a workflow in 3 lines of code

from comfykit import ComfyKit

# Connect to local ComfyUI server
kit = ComfyKit(comfyui_url="http://127.0.0.1:8188")
result = await kit.execute("workflow.json", {"prompt": "a cute cat"})

print(result.images)  # ['http://127.0.0.1:8188/view?filename=cat_001.png']

# 🌐 Or use RunningHub cloud (no local GPU needed)
# kit = ComfyKit(runninghub_api_key="rh-xxx")

Get structured data back

# ExecuteResult object, not strings!
result.status          # "completed"
result.images          # All generated image URLs
result.images_by_var   # Images grouped by variable name
result.videos          # Video URLs (if any)
result.audios          # Audio URLs (if any)
result.duration        # Execution time

🎯 Key Features

  • ⚑ Zero Configuration: Works out of the box, connects to local ComfyUI by default (http://127.0.0.1:8188)
  • ☁️ Cloud Execution: Seamless RunningHub cloud support - No GPU or local ComfyUI needed
  • 🎨 Simple API: 3 lines of code to execute workflows, no need to understand internals
  • πŸ“Š Structured Output: Returns ExecuteResult objects, not strings
  • πŸ”„ Smart Detection: Auto-detects local files, URLs, and RunningHub workflow IDs
  • πŸ”Œ Lightweight: Less than 10 core dependencies
  • 🎭 Multimodal Support: Images, videos, audio - all in one place

πŸ” ComfyKit vs ComfyUI Native API

Aspect ComfyUI Native API ComfyKit
Complexity Manual WebSocket/HTTP handling 3 lines of code
Return Value Raw JSON, need to parse yourself Structured ExecuteResult object
Media Handling Need to construct URLs manually Automatically generates complete media URLs
Error Handling Need to implement yourself Built-in comprehensive error handling
Best For Familiar with ComfyUI internals Just want quick integration

πŸ™ Acknowledgments

  • ComfyUI - Powerful AI image generation framework
  • RunningHub - ComfyUI cloud platform

πŸ“ž Contact

  • Author: Fan Wu
  • Email: 1129090915@qq.com
  • GitHub: @puke3615

If ComfyKit helps you, please give it a ⭐ Star!

GitHub Β· PyPI Β· Issues