From be952ad3349519ed6e64cfe5465043b2add5e0e7 Mon Sep 17 00:00:00 2001 From: Adhik Joshi Date: Wed, 18 Feb 2026 20:52:17 +0530 Subject: [PATCH] feat: Add ModelsLab custom nodes --- custom_nodes/ComfyUI-ModelsLab/__init__.py | 225 +++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 custom_nodes/ComfyUI-ModelsLab/__init__.py diff --git a/custom_nodes/ComfyUI-ModelsLab/__init__.py b/custom_nodes/ComfyUI-ModelsLab/__init__.py new file mode 100644 index 000000000..ab503f0c4 --- /dev/null +++ b/custom_nodes/ComfyUI-ModelsLab/__init__.py @@ -0,0 +1,225 @@ +""" +ComfyUI-ModelsLab: ModelsLab API Integration for ComfyUI + +This package provides custom nodes for ComfyUI to integrate with ModelsLab's +comprehensive AI generation APIs, including text-to-image, image-to-image, +video generation, and text-to-speech capabilities. + +ModelsLab offers: +- High-quality image generation with Flux, SDXL, and community models +- Competitive pricing compared to premium API providers +- Multi-modal capabilities (text, image, video, audio) +- Uncensored models for creative freedom +- Professional-grade API with async processing + +Get your API key at: https://modelslab.com +Documentation: https://docs.modelslab.com +""" + +from .modules.text_to_image_node import ( + ModelsLabTextToImage, + ModelsLabFlux, + ModelsLabSDXL, + ModelsLabCommunityModel, +) + +# Import additional modules when implemented +try: + from .modules.image_to_image_node import ( + ModelsLabImageToImage, + ModelsLabUpscale, + ModelsLabInpaint, + ModelsLabBackgroundRemoval, + ) + IMAGE_TO_IMAGE_AVAILABLE = True +except ImportError: + IMAGE_TO_IMAGE_AVAILABLE = False + +try: + from .modules.video_node import ( + ModelsLabTextToVideo, + ModelsLabImageToVideo, + ModelsLabVideoToVideo, + ) + VIDEO_AVAILABLE = True +except ImportError: + VIDEO_AVAILABLE = False + +try: + from .modules.tts_node import ( + ModelsLabTextToSpeech, + ModelsLabVoiceClone, + ModelsLabMusicGeneration, + ) + TTS_AVAILABLE = True +except ImportError: + TTS_AVAILABLE = False + +try: + from .modules.config_nodes import ( + ModelsLabAPIConfig, + ModelsLabModelInfo, + ModelsLabUsageStats, + ) + CONFIG_AVAILABLE = True +except ImportError: + CONFIG_AVAILABLE = False + + +# Core node mappings (always available) +NODE_CLASS_MAPPINGS = { + # Text-to-Image Generation + "ModelsLabTextToImage": ModelsLabTextToImage, + "ModelsLabFlux": ModelsLabFlux, + "ModelsLabSDXL": ModelsLabSDXL, + "ModelsLabCommunityModel": ModelsLabCommunityModel, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + # Text-to-Image Generation + "ModelsLabTextToImage": "šŸŽØ ModelsLab Text to Image", + "ModelsLabFlux": "⚔ ModelsLab Flux", + "ModelsLabSDXL": "šŸ–¼ļø ModelsLab SDXL", + "ModelsLabCommunityModel": "šŸ‘„ ModelsLab Community Model", +} + +# Add optional modules if available +if IMAGE_TO_IMAGE_AVAILABLE: + NODE_CLASS_MAPPINGS.update({ + "ModelsLabImageToImage": ModelsLabImageToImage, + "ModelsLabUpscale": ModelsLabUpscale, + "ModelsLabInpaint": ModelsLabInpaint, + "ModelsLabBackgroundRemoval": ModelsLabBackgroundRemoval, + }) + NODE_DISPLAY_NAME_MAPPINGS.update({ + "ModelsLabImageToImage": "šŸ”„ ModelsLab Image to Image", + "ModelsLabUpscale": "šŸ“ˆ ModelsLab Upscale", + "ModelsLabInpaint": "šŸŽÆ ModelsLab Inpaint", + "ModelsLabBackgroundRemoval": "āœ‚ļø ModelsLab Background Removal", + }) + +if VIDEO_AVAILABLE: + NODE_CLASS_MAPPINGS.update({ + "ModelsLabTextToVideo": ModelsLabTextToVideo, + "ModelsLabImageToVideo": ModelsLabImageToVideo, + "ModelsLabVideoToVideo": ModelsLabVideoToVideo, + }) + NODE_DISPLAY_NAME_MAPPINGS.update({ + "ModelsLabTextToVideo": "šŸŽ¬ ModelsLab Text to Video", + "ModelsLabImageToVideo": "šŸŽ„ ModelsLab Image to Video", + "ModelsLabVideoToVideo": "šŸ” ModelsLab Video to Video", + }) + +if TTS_AVAILABLE: + NODE_CLASS_MAPPINGS.update({ + "ModelsLabTextToSpeech": ModelsLabTextToSpeech, + "ModelsLabVoiceClone": ModelsLabVoiceClone, + "ModelsLabMusicGeneration": ModelsLabMusicGeneration, + }) + NODE_DISPLAY_NAME_MAPPINGS.update({ + "ModelsLabTextToSpeech": "šŸ—£ļø ModelsLab Text to Speech", + "ModelsLabVoiceClone": "šŸŽ¤ ModelsLab Voice Clone", + "ModelsLabMusicGeneration": "šŸŽµ ModelsLab Music Generation", + }) + +if CONFIG_AVAILABLE: + NODE_CLASS_MAPPINGS.update({ + "ModelsLabAPIConfig": ModelsLabAPIConfig, + "ModelsLabModelInfo": ModelsLabModelInfo, + "ModelsLabUsageStats": ModelsLabUsageStats, + }) + NODE_DISPLAY_NAME_MAPPINGS.update({ + "ModelsLabAPIConfig": "āš™ļø ModelsLab API Config", + "ModelsLabModelInfo": "ā„¹ļø ModelsLab Model Info", + "ModelsLabUsageStats": "šŸ“Š ModelsLab Usage Stats", + }) + + +# Web directory for custom CSS/JS (if any) +WEB_DIRECTORY = "./web" + +# Package metadata +__version__ = "1.0.0" +__author__ = "ModelsLab Integration Team" +__description__ = "ModelsLab API integration for ComfyUI" + +# Export all mappings +__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"] + + +def get_extension_info(): + """Return extension information for ComfyUI-Manager.""" + return { + "name": "ComfyUI-ModelsLab", + "description": "ModelsLab API integration for advanced AI image generation in ComfyUI", + "version": __version__, + "author": __author__, + "repository": "https://github.com/modelslab/ComfyUI-ModelsLab", + "nodes": list(NODE_CLASS_MAPPINGS.keys()), + "categories": [ + "ModelsLab/Generation", + "ModelsLab/Processing", + "ModelsLab/Video", + "ModelsLab/Audio", + "ModelsLab/Community", + "ModelsLab/Config" + ], + "requirements": [ + "requests>=2.28.0", + "pillow>=9.0.0", + "torch>=1.11.0", + "numpy>=1.21.0", + ], + "features": [ + "High-quality text-to-image generation", + "Flux, SDXL, and community models support", + "Image-to-image processing", + "Video generation capabilities", + "Text-to-speech synthesis", + "Competitive API pricing", + "Uncensored model options", + "Professional async processing" + ], + "tags": [ + "generation", "ai", "image", "video", "audio", "api", "cloud", + "flux", "sdxl", "stable-diffusion", "text-to-image", "modelslab" + ] + } + + +# Print startup information +print("\n" + "="*60) +print("šŸŽØ ComfyUI-ModelsLab v{} Loaded".format(__version__)) +print("="*60) +print(f"šŸ“¦ Loaded {len(NODE_CLASS_MAPPINGS)} nodes:") + +# Group nodes by category for display +categories = {} +for node_key, display_name in NODE_DISPLAY_NAME_MAPPINGS.items(): + category = "Generation" if any(x in node_key for x in ["TextToImage", "Flux", "SDXL"]) else \ + "Processing" if any(x in node_key for x in ["ImageToImage", "Upscale", "Inpaint"]) else \ + "Video" if "Video" in node_key else \ + "Audio" if any(x in node_key for x in ["Speech", "Voice"]) else \ + "Config" + + if category not in categories: + categories[category] = [] + categories[category].append(f" • {display_name}") + +for category, nodes in categories.items(): + print(f"\n{category}:") + for node in sorted(nodes): + print(node) + +print(f"\nšŸ”‘ API Key Configuration:") +print(" • Set MODELSLAB_API_KEY environment variable, or") +print(" • Create config.ini with [modelslab] section") +print(" • Get your API key at: https://modelslab.com") + +print(f"\nšŸ“– Documentation:") +print(" • ModelsLab API Docs: https://docs.modelslab.com") +print(" • GitHub Repository: https://github.com/modelslab/ComfyUI-ModelsLab") + +print("\n" + "="*60) +print("✨ Ready to generate with ModelsLab!") +print("="*60 + "\n") \ No newline at end of file