Skip to content

Quick Start

Get Started in Minutes

Welcome to UniCraft! This guide will help you get started with the AI Model Router in just a few minutes.

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)

The easiest way to get started is using Docker:

docker run -d \ --name unicraft \ -p 8080:8080 \ -e OPENAI_API_KEY=your_openai_key \ -e ANTHROPIC_API_KEY=your_anthropic_key \ -e GOOGLE_API_KEY=your_google_key \ ghcr.io/cloudcrafttech/unicraft:latest

Install UniCraft as a Node.js package:

npm install @cloudcraftlabs/unicraft

Clone and build from source:

git clone https://github.com/cloudcrafttech/unicraft.git cd unicraft npm install npm run build npm start

Create a .env file in your project root:

# Core Configuration UNICRAFT_PORT=8080 UNICRAFT_HOST=0.0.0.0 UNICRAFT_LOG_LEVEL=info

OPENAI_API_KEY=your_openai_api_key_here OPENAI_ORGANIZATION=your_org_id

ANTHROPIC_API_KEY=your_anthropic_api_key_here

GOOGLE_API_KEY=your_google_api_key_here

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_API_KEY=your_cohere_api_key_here

HUGGINGFACE_API_KEY=your_huggingface_token_here

CUSTOM_MODEL_ENDPOINT=https://your-custom-model.com/v1 CUSTOM_MODEL_API_KEY=your_custom_api_key

First, let’s test that UniCraft is running correctly:

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 }} />

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 }} />

Configure smart routing rules in your .env file:

# Smart Routing Settings SMART_ROUTING_ENABLED=true SMART_ROUTING_STRATEGY=cost-performance SMART_ROUTING_FALLBACK_ENABLED=true SMART_ROUTING_CACHE_TTL=300

PROVIDER_PRIORITY=openai,anthropic,google,azure

COST_OPTIMIZATION_ENABLED=true COST_THRESHOLD=0.01 PERFORMANCE_THRESHOLD=0.95

You can also configure custom routing rules:

{ "routing_rules": [ { "condition": { "model": "gpt-4", "max_tokens": { "gt": 1000 } }, "action": { "route_to": "gpt-4o-mini", "reason": "cost_optimization" } }, { "condition": { "user_content_contains": ["image", "picture", "photo"] }, "action": { "route_to": "gpt-4-vision", "reason": "vision_capability" } } ] }

UniCraft includes a beautiful web application for managing your AI routing:

  1. Start the server: npm start or docker run -p 8080:8080 unicraft
  2. Open your browser: Navigate to http://localhost:8080
  3. Explore the interface: Chat, analytics, and configuration tools
  • 💬 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

Now that you have UniCraft up and running, here’s what you can do next:

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


🎉 Congratulations! You've successfully set up UniCraft AI Model Router. You're now ready to start routing your AI requests intelligently across multiple providers!
💡 Pro Tip: Start with the default configuration and gradually customize the routing rules based on your specific needs and usage patterns.