- Core Refactoring: Migrated OpenAICompatibleLoader to a structured class design (ProviderRegistry, MessageBuilder, TokenEstimator) for enhanced maintainability.
- AsyncIO Fix: Resolved 'Event loop is closed' RuntimeError by transitioning to asyncio.run() for robust event loop lifecycle management within ComfyUI's threaded environment.
- Node Enhancements:
- Added 'seed' parameter for deterministic cache invalidation control.
- Fixed silent drop of system_prompt in stateless mode (enable_memory=False).
- Refined category hierarchy: [Generate, Loader, Image] under a unified toolkit brand.
- Observability: Implemented project-wide geek-style logging with [LLMs_Toolkit] branding, execution latency tracking, and high-density token reporting.
- Cleanup: Removed legacy DeepSeek local model vertical, dependencies, and redundant utility nodes.
- Documentation: Simplified README and updated .gitignore for developer hygiene.
🚀 ComfyUI-LLMs-Toolkit
🌐 Language / 语言切换
🔥 Inject powerful Large Language Models into your ComfyUI workflows!
A professional-grade ComfyUI custom node suite supporting world-leading Large Language Models
📖 Project Overview
ComfyUI-LLMs-Toolkit is a high-performance ComfyUI extension designed for AI creators. Through a lightweight API-driven approach, you can easily integrate world-class Large Language Models like DeepSeek, Qwen, GPT, etc., even with limited computational resources, democratizing AI creation.
🎯 Why Choose Us?
- 🚀 Zero Hardware Barrier: No high-end GPU required, enjoy cutting-edge AI capabilities with just APIs
- 🌍 Global Model Support: Integrated mainstream LLMs worldwide, one-stop solution
- ⚡ High-Performance Architecture: Optimized concurrent processing, dramatically improving workflow efficiency
- 🛠️ Developer Friendly: Environment variable configuration, Docker support, developer-first approach
✨ Core Features
🧠 Powerful LLM Ecosystem
| Category | Supported Models | Key Capabilities |
|---|---|---|
| 🇨🇳 Chinese Leaders | DeepSeek-V3, Qwen-Max, GLM-4 | Chinese understanding, code generation, mathematical reasoning |
| 🇺🇸 International Giants | GPT-4, Claude-3, Gemini | Multimodal processing, creative writing, complex reasoning |
| ⚡ Professional Vertical | Doubao, Spark, Moonshot | Dialogue generation, long text, role-playing |
🔧 Technical Highlights
- ✨ Lightning Deployment: One-click installation, get started in 5 minutes
- ⚡ Concurrency Optimization: Multi-threading processing, supports batch requests
- 🛡️ Security First: Environment variable configuration, secure API key management
- 🔄 Hot Reload: Dynamic configuration updates, no need to restart ComfyUI
- 📊 Smart Caching: Response caching mechanism, reducing API call costs
- 🐳 Containerized: Docker support, consistent deployment environment
🚀 Quick Start
📋 System Requirements
- Python: `>= 3.8`
- ComfyUI: Latest version
- Memory: `>= 4GB RAM`
- Network: Stable internet connection
⚡ Lightning Installation
```bash
🎯 Method 1: Git Clone (Recommended)
cd ComfyUI/custom_nodes/ git clone https://github.com/HuangYuChuh/ComfyUI-LLMs-Toolkit.git cd ComfyUI-LLMs-Toolkit
📦 Install Dependencies
pip install -r requirements.txt ```
```bash
🐳 Method 2: Docker Deployment
docker pull your-dockerhub/comfyui-llms-toolkit:latest docker run -d --name comfyui-llms -p 8188:8188 your-dockerhub/comfyui-llms-toolkit ```
⚙️ Environment Configuration
1️⃣ Create Configuration File
```bash
Copy environment variable template
cp config/env.example .env ```
2️⃣ Configure API Keys
Edit the `.env` file and select the models you want to use:
```bash
🔥 DeepSeek (Recommended for beginners)
DEEPSEEK_API_KEY=sk-your_deepseek_key_here DEEPSEEK_BASE_URL=https://api.deepseek.com DEEPSEEK_MODEL_NAME=deepseek-chat
🌟 Qwen (Chinese optimized)
QWEN_API_KEY=your_qwen_key_here QWEN_BASE_URL=https://dashscope.aliyuncs.com/api/v1 QWEN_MODEL_NAME=qwen-max
🤖 OpenAI GPT (International standard)
OPENAI_API_KEY=sk-your_openai_key_here OPENAI_BASE_URL=https://api.openai.com/v1 OPENAI_MODEL_NAME=gpt-4o-mini
🚀 More configurations see config/env.example
```
3️⃣ API Key Acquisition Guide
| 🏢 Provider | 🔗 Get Address | 💰 Free Credits | ⭐ Rating |
|---|---|---|---|
| DeepSeek | platform.deepseek.com | ¥500 free credits | ⭐⭐⭐⭐⭐ |
| Qwen | dashscope.aliyun.com | 1M tokens/month | ⭐⭐⭐⭐ |
| OpenAI | platform.openai.com | $5 trial credits | ⭐⭐⭐⭐⭐ |
| GLM | open.bigmodel.cn | 5M tokens/month | ⭐⭐⭐⭐ |
🎯 First Run
-
🔄 Restart ComfyUI: ```bash
Restart ComfyUI to load new nodes
cd /path/to/ComfyUI python main.py ```
-
🔍 Find Nodes:
- Right-click in ComfyUI interface
- Navigate to `Add Node` → `LLMs Toolkit`
- Select the node type you need
-
⚡ Start Creating:
- Drag in LLM nodes
- Configure model parameters
- Connect inputs and outputs
- Enjoy your AI creation journey!
🌟 Supported Model Matrix
🇨🇳 Chinese AI Champions
| Model | Provider | Core Advantages | Price Level | Config Prefix |
|---|---|---|---|---|
| DeepSeek-V3 | DeepSeek | 🧮 Mathematical reasoning, 💻 Code generation | 💚 Ultra-low | `DEEPSEEK_` |
| Qwen-Max | Alibaba | 🌏 Multimodal, 🇨🇳 Chinese optimization | 💛 Medium | `QWEN_` |
| GLM-4 | Zhipu AI | 🤔 Logical reasoning, 📚 Knowledge Q&A | 💚 Low | `GLM_` |
| Doubao-Pro | ByteDance | 💬 Dialogue generation, ✍️ Creative writing | 💛 Medium | `DOUBAO_` |
| Spark-Max | iFLYTEK | 🗣️ Language understanding, 📊 Text analysis | 💚 Low | `SPARK_` |
| Moonshot-V1 | Moonshot AI | 📖 Long text, 🧠 Deep understanding | 💛 Medium | `MOONSHOT_` |
🌍 International AI Giants
| Model | Provider | Core Advantages | Price Level | Config Prefix |
|---|---|---|---|---|
| GPT-4o | OpenAI | 🧠 General intelligence, 🎨 Multimodal | 🧡 High | `OPENAI_` |
| Claude-3.5 | Anthropic | 🛡️ Safe dialogue, 📚 Long text | 🧡 High | `CLAUDE_` |
| Gemini-Pro | 🔍 Search enhanced, 🌐 Multilingual | 💛 Medium | `GEMINI_` |
❓ FAQ
🔑 Q: How to get API keys?
A: All major vendors provide free trial credits:
- DeepSeek: Register and get ¥500 credits, suitable for beginners
- Qwen: Large quota available after Alibaba Cloud account verification
- OpenAI: New users get $5 free credits, requires international payment method
🖥️ Q: Does it support local models?
A: Currently mainly supports API calls, local model support is on the development roadmap:
- v2.0: Planned support for Ollama local models
- v2.1: Support for GGUF format models
- v3.0: Support for custom model fine-tuning
❌ Q: What to do when encountering connection errors?
A: Common solutions:
- Check network: Ensure access to corresponding API services
- Verify keys: Confirm API keys are correct and have balance
- Check configuration: Confirm BASE_URL format is correct
- View logs: Check ComfyUI console output
📄 Open Source License
This project is licensed under GNU General Public License v2.0.
This means:
- ✅ Free to use: Both personal and commercial use
- ✅ Free to modify: You can modify the source code
- ✅ Free to distribute: You can distribute original or modified versions
- ⚠️ Open source obligation: Modified versions must be open source