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
ExecuteResultobjects, 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