Files
iGavroche eefd7f6889 Initial release v0.9.0
- OpenAI Compatible Chat Node with complete input compatibility
- Support for multiple OpenAI-compatible API endpoints
- Multi-turn conversation support with context persistence
- Image and file support for vision models and document analysis
- Advanced options configuration
- Comprehensive test suite
- Robust error handling and edge case management
- Complete documentation and examples
2025-10-06 08:11:20 -04:00

4.6 KiB

Nino-utils Implementation Summary

Overview

Successfully created a new ComfyUI custom node collection called "Nino-utils" with an OpenAI Compatible Chat node that works with any OpenAI-compatible API endpoint.

What Was Created

1. Core Files

  • __init__.py - Package initialization with proper exports
  • nodes.py - Main implementation of the OpenAI Compatible Chat node
  • pyproject.toml - Project configuration and dependencies
  • requirements.txt - Python dependencies list

2. Documentation

  • README.md - Comprehensive documentation with usage examples
  • example_configurations.md - Detailed configuration examples for different services
  • IMPLEMENTATION_SUMMARY.md - This summary document

3. Testing & Examples

  • test_node.py - Comprehensive test suite (all tests pass ✅)
  • example_workflow.json - Example ComfyUI workflow
  • install.py - Automated installation script

Key Features

OpenAI Compatible Chat Node

  • Complete Input Compatibility: All inputs from the original ChatGPT node are supported
  • Flexible API Support: Works with Lemonade, Ollama, OpenAI API, LM Studio, and any OpenAI-compatible endpoint
  • Same Interface: Maintains the same input/output interface as the original ChatGPT node
  • Multi-turn Conversations: Context persistence for ongoing conversations
  • Image Support: Vision model support with image inputs
  • File Support: Document analysis with file inputs
  • Advanced Options: Fine-tuned control with advanced configuration
  • Configurable Parameters: Temperature, top_p, max_tokens, system messages
  • Error Handling: Robust error handling for API failures

Input Parameters

Required:

  • prompt - Text input for the model
  • api_url - OpenAI-compatible endpoint URL
  • model - Model name (e.g., gpt-4o-mini, llama3.2)
  • api_key - Authentication key (empty for local servers)
  • persist_context - Enable multi-turn conversations

Optional:

  • images - Image inputs for vision models
  • files - File inputs for document analysis (OPENAI_INPUT_FILES type)
  • advanced_options - Advanced configuration (OPENAI_CHAT_CONFIG type)
  • max_tokens - Response length limit
  • temperature - Creativity control (0.0-2.0)
  • top_p - Diversity control (0.0-1.0)
  • system_message - Assistant behavior setting

Tested Configurations

✅ Lemonade Server: http://127.0.0.1:35841/v1/chat/completions ✅ Ollama: http://localhost:11434/v1/chat/completions ✅ OpenAI API: https://api.openai.com/v1/chat/completions ✅ LM Studio: http://localhost:1234/v1/chat/completions

Installation

The node collection is ready to use. Simply:

  1. The collection is already in /home/nino/ComfyUI/custom_nodes/nino-utils/
  2. Restart ComfyUI
  3. Look for "OpenAI Compatible Chat" in the "Nino-utils" category
  4. Run uv run python install.py if you need to install dependencies

Usage in Workflows

The node can be used as a drop-in replacement for the original ChatGPT node:

  1. API URL: Set your endpoint (e.g., http://127.0.0.1:35841/v1/chat/completions)
  2. Model: Specify model name (e.g., gpt-4o-mini)
  3. API Key: Leave empty for local servers, add key for cloud services
  4. Prompt: Enter your text
  5. Connect: Link to other nodes as needed

Technical Implementation

  • Async Support: Uses aiohttp for non-blocking HTTP requests
  • Image Processing: Converts ComfyUI tensors to base64 for API transmission
  • History Management: Maintains conversation context across calls
  • Error Handling: Comprehensive error handling with meaningful messages
  • ComfyUI Integration: Follows ComfyUI node patterns and conventions
  • FUNCTION Attribute: Properly set to "api_call" for ComfyUI execution system

Next Steps

The collection is ready for use and can be extended with additional utility nodes as needed. The foundation is solid and follows ComfyUI best practices.

Files Created

/home/nino/ComfyUI/custom_nodes/nino-utils/
├── __init__.py                    # Package initialization
├── nodes.py                       # Main node implementation
├── pyproject.toml                 # Project configuration
├── requirements.txt               # Dependencies
├── README.md                      # Documentation
├── example_configurations.md      # Configuration examples
├── example_workflow.json          # Example workflow
├── install.py                     # Installation script
├── test_node.py                   # Test suite
└── IMPLEMENTATION_SUMMARY.md      # This summary

All tests pass and the node is ready for production use! 🎉