Welcome to ComfyKit examples! These examples serve both as tutorials and functional tests.
Follow these examples in order to learn ComfyKit:
-
01_quick_start.py - Your first ComfyKit program
- Simple 3-line example
- Basic workflow execution
- Result handling
-
02_configuration.py - Configuration options
- Default configuration
- Custom parameters
- Environment variables
- Configuration priority
- Multiple executors
-
03_local_workflows.py - Local ComfyUI execution
- Basic workflow execution
- Custom parameters
- Execute from dict
- Different output types
- Result handling
-
04_runninghub_cloud.py - RunningHub cloud execution
- Cloud execution basics
- Custom configuration
- Unified parameters
- Auto-detection
- Mixed local + cloud
-
05_advanced_features.py - Advanced features
- Batch execution
- Error handling
- Timeout handling
- Authentication
- Executor types
- Result processing
Run a single example:
python examples/01_quick_start.pyRun all examples (integration test):
python examples/run_all.py- ComfyUI running at
http://127.0.0.1:8188 - Or set
COMFYUI_BASE_URLto your ComfyUI server
- RunningHub API key
- Set environment variable:
export RUNNINGHUB_API_KEY='your-api-key-here'
All examples include assertions and can serve as integration tests:
# Run all and see summary
python examples/run_all.py
# Run specific example
python examples/02_configuration.py
# Expected failures are OK if:
# - ComfyUI is not running (local examples)
# - RUNNINGHUB_API_KEY not set (cloud examples)
# - Required workflows missingEach example follows this pattern:
"""
Example Title - Brief Description
Detailed explanation of what this example teaches.
"""
import asyncio
from comfykit import ComfyKit
async def example_feature():
"""Specific feature demonstration"""
kit = ComfyKit()
result = await kit.execute(...)
# Verify (acts as test)
assert result.status == "completed"
print("✅ Feature works!")
async def main():
"""Run all demonstrations"""
await example_feature()
print("✨ Example completed!")
if __name__ == "__main__":
asyncio.run(main())- Start Simple: Begin with
01_quick_start.py - Read Code: Each example is heavily commented
- Run & Experiment: Modify parameters and see what happens
- Check Errors: Error messages guide you to solutions
Found a bug or have a suggestion? Please open an issue!
Want to add an example? Follow the existing pattern and submit a PR.
After completing these examples, check out:
- README.md - Project documentation
- workflows/ - Example workflows
- comfykit/ - Source code
Happy coding with ComfyKit! 🚀