Quick Start
Quick Start Guide
Section titled “Quick Start Guide”Get Started in Minutes
Welcome to UniCraft! This guide will help you get started with the AI Model Router in just a few minutes.
Prerequisites
Section titled “Prerequisites”Before you begin, make sure you have:
- ✅ Node.js 18+ installed
- ✅ npm or yarn package manager
- ✅ API keys for your preferred AI providers
- ✅ Docker (optional, for containerized deployment)
Installation
Section titled “Installation”Option 1: Docker (Recommended)
Section titled “Option 1: Docker (Recommended)”The easiest way to get started is using Docker:
Option 2: npm Package
Section titled “Option 2: npm Package”Install UniCraft as a Node.js package:
Option 3: Source Code
Section titled “Option 3: Source Code”Clone and build from source:
Environment Setup
Section titled “Environment Setup”Create a .env file in your project root:
OpenAI Configuration
Section titled “OpenAI Configuration”OPENAI_API_KEY=your_openai_api_key_here OPENAI_ORGANIZATION=your_org_id
Anthropic Configuration
Section titled “Anthropic Configuration”ANTHROPIC_API_KEY=your_anthropic_api_key_here
Google Configuration
Section titled “Google Configuration”GOOGLE_API_KEY=your_google_api_key_here
Azure OpenAI Configuration
Section titled “Azure OpenAI Configuration”AZURE_OPENAI_API_KEY=your_azure_openai_key AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/ AZURE_OPENAI_API_VERSION=2024-02-15-preview
Cohere Configuration
Section titled “Cohere Configuration”COHERE_API_KEY=your_cohere_api_key_here
Hugging Face Configuration
Section titled “Hugging Face Configuration”HUGGINGFACE_API_KEY=your_huggingface_token_here
Optional: Custom Models
Section titled “Optional: Custom Models”CUSTOM_MODEL_ENDPOINT=https://your-custom-model.com/v1 CUSTOM_MODEL_API_KEY=your_custom_api_key
Basic Usage
Section titled “Basic Usage”1. Test Your Installation
Section titled “1. Test Your Installation”First, let’s test that UniCraft is running correctly:
2. Make Your First API Call
Section titled “2. Make Your First API Call”Now let’s make a simple chat completion request:
<ApiExplorer endpoint=“/v1/chat/completions” method=“POST” title=“Chat Completions” description=“Send a chat completion request to UniCraft” requestBody={{ “model”: “gpt-4o-mini”, “messages”: [ { “role”: “user”, “content”: “Hello! Can you help me understand how UniCraft works?” } ], “max_tokens”: 150, “temperature”: 0.7 }} />
3. Test Smart Routing
Section titled “3. Test Smart Routing”Let’s test the smart routing feature by making a request without specifying a model:
<ApiExplorer endpoint=“/v1/chat/completions” method=“POST” title=“Smart Routing” description=“Let UniCraft choose the best model for your request” requestBody={{ “model”: “smart-routing”, “messages”: [ { “role”: “user”, “content”: “Write a short poem about artificial intelligence” } ], “max_tokens”: 100, “temperature”: 0.8 }} />
Configuration
Section titled “Configuration”Smart Routing Configuration
Section titled “Smart Routing Configuration”Configure smart routing rules in your .env file:
Provider Priority (comma-separated)
Section titled “Provider Priority (comma-separated)”PROVIDER_PRIORITY=openai,anthropic,google,azure
Cost Optimization
Section titled “Cost Optimization”COST_OPTIMIZATION_ENABLED=true COST_THRESHOLD=0.01 PERFORMANCE_THRESHOLD=0.95
Custom Routing Rules
Section titled “Custom Routing Rules”You can also configure custom routing rules:
Web Application
Section titled “Web Application”UniCraft includes a beautiful web application for managing your AI routing:
- Start the server:
npm startordocker run -p 8080:8080 unicraft - Open your browser: Navigate to
http://localhost:8080 - Explore the interface: Chat, analytics, and configuration tools
Web App Features
Section titled “Web App Features”- 💬 Chat Interface - Test your AI models with a modern chat UI
- 📊 Analytics Dashboard - Monitor usage, costs, and performance
- ⚙️ Configuration Panel - Manage providers and routing rules
- 🔍 Model Explorer - Browse available models and their capabilities
Next Steps
Section titled “Next Steps”Now that you have UniCraft up and running, here’s what you can do next:
1. Explore Features
Section titled “1. Explore Features”- Smart Routing - Learn about intelligent model selection
- Circuit Breaker - Understand fault tolerance
- Load Balancer - Distribute load across providers
- Cost Optimization - Reduce AI costs
2. Integration Options
Section titled “2. Integration Options”- OpenAI Compatible API - Drop-in replacement
- LangChain Integration - Use with LangChain
- N8N Custom Nodes - Workflow automation
- Webhooks - Real-time notifications
3. Advanced Configuration
Section titled “3. Advanced Configuration”- Setting Up Providers - Configure all providers
- Monitoring & Analytics - Set up monitoring
- Cost Optimization - Optimize your costs
Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Issue: Connection refused when starting UniCraft
Solution: Make sure the port is available and no other service is using it
Issue: Invalid API key errors
Solution: Verify your API keys are correct and have sufficient credits
Issue: Models not appearing in the web interface Solution: Check your provider configuration and API key permissions
Getting Help
Section titled “Getting Help”- 📚 Documentation - Comprehensive guides and API reference
- 💬 Discord Community - Get help from the community
- 🐛 GitHub Issues - Report bugs
- 📧 Email Support - Enterprise support