unicraft

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

Package Information

Released: 9/19/2025
Downloads: 20 weekly / 45 monthly
Latest Version: 2.0.1
Author: CloudCraft Labs

Documentation

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 capabilities.

📦 Available Nodes

1. UniCraft Chat (Enhanced with Smart Routing)

  • Purpose: Chat completions with AI models
  • Features:
    • Manual model selection
    • Smart Routing - Automatic model selection based on strategy
    • Multiple response formats
    • Streaming support
    • Temperature and token controls

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 (New!)

  • Purpose: Complete AI Agent with Memory, Tools, and Smart Routing
  • 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
    • Advanced Configuration: Streaming, timeouts, intermediate steps
    • Smart Routing: Automatic model selection for agents

🎯 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

Discussion