JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q88306F
  • License MIT

UniCraft N8N custom nodes - Unified AI Model Router with Multi-Modal Support by CloudCraft Labs for OpenAI, Anthropic, Google Gemini, and more

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (n8n-nodes-unicraft) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    UniCraft N8N Custom Nodes

    Unified AI Model Router by CloudCraft Labs - N8N Integration

    🚀 Overview

    UniCraft N8N custom nodes provide seamless integration with the UniCraft AI Model Router, enabling you to use multiple AI providers (OpenAI, Anthropic, Google Gemini, Cohere, Mistral, Groq, Together AI, Perplexity AI) through a single, intelligent interface with Smart Routing and Multi-Modal capabilities.

    📦 Available Nodes

    1. UniCraft Chat Model (Enhanced with Multi-Modal Support)

    • Purpose: Chat completions with AI models
    • Features:
      • Manual model selection
      • Smart Routing - Automatic model selection based on strategy
      • Multi-Modal Input/Output - Support for text, image, audio, video, document processing
      • Media File Upload - Base64 encoded file handling
      • Multiple response formats (text, image, audio, video, document, code, markdown)
      • Streaming support
      • Temperature and token controls
      • Cost tracking

    2. UniCraft Models

    • Purpose: List and manage available AI models
    • Features:
      • Get all available models
      • Model information lookup
      • Provider-based filtering

    3. UniCraft Smart Routing (New!)

    • Purpose: Advanced smart routing management
    • Features:
      • Get optimal model recommendations
      • Configure routing strategies
      • View routing analytics
      • Manage provider preferences

    4. UniCraft Chat Model (AI Agent Sub Node)

    • Purpose: Language model for AI Agent integration
    • Features:
      • Manual model selection
      • Smart Routing support for AI Agents
      • Temperature and token controls
      • Provider configuration

    5. UniCraft AI Agent (Enhanced with Multi-Modal Support)

    • Purpose: Complete AI Agent with Memory, Tools, Smart Routing, and Multi-Modal capabilities
    • Features:
      • Memory Management: Conversation buffer, summary, token buffer, window
      • Tools Integration: Custom tools/functions with JSON schema validation
      • Agent Types: Conversational, Tool-enabled, Smart Routing, Custom
      • Multi-Modal Processing: Support for all input/output types in agent workflows
      • Media File Handling: Upload and process images, audio, video, documents
      • Advanced Configuration: Streaming, timeouts, intermediate steps
      • Smart Routing: Automatic model selection for agents
      • Cost Tracking: Monitor usage across all agent operations

    🎯 Multi-Modal Features

    Supported Input Types

    • Text: Standard text processing and generation
    • Image: Image analysis, description, and generation (DALL-E, etc.)
    • Audio: Audio transcription (Whisper) and generation (TTS)
    • Video: Video analysis and generation
    • Document: Document processing and generation

    Supported Output Types

    • Text: Standard text responses
    • Image: Generated images with metadata (DALL-E, Midjourney, etc.)
    • Audio: Generated audio files (TTS, speech synthesis)
    • Video: Generated video content
    • Document: Generated documents (PDF, Word, etc.)
    • Code: Generated code in various programming languages
    • Markdown: Formatted markdown content

    Media Processing

    • File Upload: Base64 encoded file handling
    • MIME Type Support: Automatic content type detection
    • Metadata Preservation: Filename, size, and format information
    • Batch Processing: Handle multiple files in a single request

    🎯 Smart Routing Features

    Routing Strategies

    • Balanced: Optimal balance between cost, performance, and availability
    • Cost Optimized: Prioritize cost efficiency
    • Performance Optimized: Prioritize speed and quality
    • Availability Optimized: Prioritize reliability and uptime

    Smart Routing Benefits

    • Automatic Model Selection: No need to manually choose models
    • Cost Optimization: Automatically select the most cost-effective model
    • Performance Optimization: Choose the fastest model for your needs
    • Availability Optimization: Ensure high reliability and uptime
    • Real-time Analytics: Track performance and cost savings

    🔧 Installation

    1. Install the package:

      npm install n8n-nodes-unicraft
    2. Restart N8N to load the new nodes

    3. Configure credentials:

      • Go to N8N Settings → Credentials
      • Add "UniCraft API" credential
      • Enter your UniCraft API key and base URL

    📋 Usage Examples

    Basic Chat Completion

    {
      "operation": "Chat Completion",
      "model": "gpt-3.5-turbo",
      "messages": [
        {
          "role": "user",
          "content": "Hello, how are you?"
        }
      ],
      "temperature": 0.7,
      "maxTokens": 1000
    }

    Smart Routing Chat Completion

    {
      "operation": "Chat Completion",
      "useSmartRouting": true,
      "smartRoutingStrategy": "cost_optimized",
      "priority": "normal",
      "messages": [
        {
          "role": "user",
          "content": "Explain quantum computing"
        }
      ]
    }

    Dedicated Smart Chat Completion

    {
      "operation": "Smart Chat Completion",
      "smartRoutingStrategy": "performance_optimized",
      "priority": "high",
      "messages": [
        {
          "role": "user",
          "content": "Write a Python function to sort a list"
        }
      ]
    }

    Get Optimal Model

    {
      "operation": "Get Optimal Model",
      "strategy": "balanced",
      "inputLength": 500,
      "priority": "normal"
    }

    Configure Smart Routing

    {
      "operation": "Set Routing Config",
      "routingStrategy": "cost_optimized",
      "maxCostPer1KTokens": 0.005,
      "maxResponseTime": 5000,
      "preferredProviders": ["openai", "anthropic"],
      "blockedProviders": []
    }

    🔑 Credentials Setup

    UniCraft API Credential

    • API Key: Your UniCraft API key
    • Base URL: Your UniCraft instance URL (e.g., https://api.cloudcraftlabs.io)

    📊 Response Formats

    Message Only

    {
      "message": "Hello! I'm doing well, thank you for asking."
    }

    Structured

    {
      "message": "Hello! I'm doing well, thank you for asking.",
      "model": "gpt-3.5-turbo",
      "usage": {
        "prompt_tokens": 10,
        "completion_tokens": 15,
        "total_tokens": 25
      },
      "smartRouting": {
        "strategy": "cost_optimized",
        "selectedModel": "gpt-3.5-turbo"
      }
    }

    Full Response

    {
      "id": "chatcmpl-123",
      "object": "chat.completion",
      "created": 1677652288,
      "model": "gpt-3.5-turbo",
      "choices": [...],
      "usage": {...}
    }

    🎨 Smart Routing Workflows

    Cost-Optimized Workflow

    1. Use UniCraft Smart Routing node to configure cost optimization
    2. Use UniCraft Chat with smart routing enabled
    3. Monitor cost savings with analytics

    Performance-Optimized Workflow

    1. Configure performance optimization strategy
    2. Set high priority for time-sensitive requests
    3. Use dedicated smart chat completion for best results

    Multi-Provider Workflow

    1. List available models with UniCraft Models node
    2. Configure provider preferences
    3. Use smart routing to automatically select the best provider

    🔍 Advanced Features

    Provider Management

    • Preferred Providers: Set preferred providers for routing
    • Blocked Providers: Exclude specific providers
    • Provider Analytics: Track performance by provider

    Cost Management

    • Cost Limits: Set maximum cost per 1K tokens
    • Cost Tracking: Monitor spending across providers
    • Cost Optimization: Automatic selection of cost-effective models

    Performance Monitoring

    • Response Time Tracking: Monitor response times
    • Success Rate Monitoring: Track request success rates
    • Performance Analytics: Detailed performance metrics

    🚨 Error Handling

    The nodes include comprehensive error handling:

    • API Errors: Proper error messages for API failures
    • Validation Errors: Input validation with helpful messages
    • Network Errors: Retry logic for network issues
    • Rate Limiting: Automatic handling of rate limits

    📈 Analytics and Monitoring

    Routing Analytics

    • Total requests processed
    • Cost savings achieved
    • Average response times
    • Success rates by provider
    • Strategy performance metrics

    Usage Tracking

    • Token usage by model
    • Cost breakdown by provider
    • Request patterns and trends
    • Performance optimization opportunities

    🤖 AI Agent Integration

    UniCraft AI Agent Node

    The new UniCraft AI Agent node provides a complete AI agent solution with advanced features:

    Memory Management:

    • Conversation Buffer: Maintain complete conversation history
    • Conversation Summary: Summarize history to save tokens
    • Token Buffer: Keep history within token limits
    • Conversation Window: Keep only recent N messages
    • No Memory: Stateless operation

    Tools Integration:

    • Define custom tools/functions for the agent
    • JSON schema parameter validation
    • Automatic tool calling based on context
    • Support for external API endpoints

    Agent Types:

    • Conversational: Basic conversational agent with memory
    • Tool-Enabled: Agent with access to tools/functions
    • Smart Routing: Agent with intelligent model selection
    • Custom: Fully customizable agent configuration

    Using UniCraft as AI Agent Sub Node

    The UniCraft Chat Model node is designed to work seamlessly with N8N's AI Agent system:

    Configuration Options:

    • Manual Selection: Choose specific models for consistent behavior
    • Smart Routing: Let the system automatically select the best model

    Smart Routing for AI Agents:

    {
      "modelSelection": "smart",
      "smartRoutingStrategy": "cost_optimized",
      "priority": "normal",
      "temperature": 0.7
    }

    Benefits for AI Agents:

    • Automatic Optimization: AI Agents automatically get the best model
    • Cost Efficiency: Smart routing reduces costs for AI Agent operations
    • Performance: Optimal model selection for different agent tasks
    • Reliability: Automatic failover and provider management

    🔄 Migration from v1

    If you're upgrading from v1 of the nodes:

    1. Backup your workflows before upgrading
    2. Update node configurations to use new smart routing features
    3. Test workflows with the new functionality
    4. Configure smart routing for optimal performance
    5. Update AI Agent configurations to use smart routing

    🆘 Support

    📄 License

    MIT License - see LICENSE file for details.

    🤝 Contributing

    Contributions are welcome! Please see our Contributing Guidelines for details.


    Made with ❤️ by CloudCraft Labs