Complete guide to UNICORN's expanded 10-provider AI router system.
-
AI-ROUTER-FINAL-SUMMARY.md ← Best overview
- Complete feature summary (10 providers, 10 tasks, 4 budgets)
- Usage examples for real applications
- Cost comparisons
- Getting started guide
-
AI-ROUTER-QUICK-START-EXPANDED.md ← 2-minute setup
- Quick reference for common tasks
- One-liner API examples
- Cost reference table
- Troubleshooting
-
AI-ROUTER-EXPANDED-SUMMARY.md ← Technical deep dive
- Architecture & provider specs
- New model categories (multimodal, embeddings, moderation)
- Cost strategy configuration
- API endpoint reference
- File changes summary
-
AI-PROVIDER-ROUTER-SUMMARY.md ← Original 6 providers
- First iteration with OpenAI, Anthropic, Google, Groq, DeepSeek, OpenRouter
- Placeholder-safe validation
- Admin-protected routes
- Initial integration details
- AI-ROUTER-QUICK-REF.md ← Cheat sheet
- 2-minute setup
- All endpoints
- Budget modes table
- Provider models matrix
- Extension pattern for new providers
- Start: AI-ROUTER-FINAL-SUMMARY.md (5 min read)
- Quick start: AI-ROUTER-QUICK-START-EXPANDED.md (2 min)
- Set up: Add API keys to
.envand test endpoints
- Overview: AI-ROUTER-FINAL-SUMMARY.md
- Details: AI-ROUTER-EXPANDED-SUMMARY.md
- Implementation: Check
backend/modules/aiProviderRouter.js
- Files: AI-ROUTER-EXPANDED-SUMMARY.md
- Hetzner: Use
scripts/setup-hetzner-auto.js(auto-configures all 10 keys) - Verify: Run
npm test
- Reference: AI-ROUTER-QUICK-START-EXPANDED.md
- Estimation: Use
/api/ai/estimate-costendpoint - Examples: AI-ROUTER-FINAL-SUMMARY.md
Tier 1: OpenAI, Anthropic, Google
Tier 2: DeepSeek, Mistral, Cohere
Tier 3: Groq, Fireworks, Replicate
Tier 4: OpenRouter (proxy)
coding, reasoning, chat, longContext, multimodal,
embedding, moderation, imageGeneration, videoGeneration, default
free (ultra cheap), cheap, balanced, best (premium)
/api/ai/providers - List active providers
/api/ai/select-model - Best for task
/api/ai/select-by-budget - Budget-aware selection
/api/ai/models - All models for task
/api/ai/estimate-cost - Cost calculation
/api/ai/health - Status check
/api/ai/config - Full configuration
- Add API keys:
UNICORN_FINAL/.env - Start backend:
cd backend && node index.js - Test:
curl http://localhost:3000/api/ai/health
- Get providers:
curl http://localhost:3000/api/ai/providers - Select model:
curl http://localhost:3000/api/ai/select-model?task=coding - Budget mode:
curl http://localhost:3000/api/ai/select-by-budget?task=coding&budget=cheap - Cost:
curl http://localhost:3000/api/ai/estimate-cost?task=coding&tokens=1000
UNICORN_FINAL/.env- Add API keysUNICORN_FINAL/backend/modules/aiProviderRouter.js- Custom preferencesUNICORN_FINAL/backend/modules/unicornConfigurationManager.js- Cost strategy
scripts/setup-hetzner-auto.js- Automatic Hetzner setup- All 10 API keys auto-whitelisted
- Systemd services auto-configured
| Component | Status | Details |
|---|---|---|
| Syntax | ✅ PASS | All files validated |
| Tests | ✅ PASS | npm test (health + deploy) |
| Providers | ✅ 10 | OpenAI, Anthropic, Google, Groq, DeepSeek, OpenRouter, Cohere, Mistral, Fireworks, Replicate |
| Tasks | ✅ 10 | coding, reasoning, chat, longContext, multimodal, embedding, moderation, imageGeneration, videoGeneration, default |
| Budgets | ✅ 4 | free, cheap, balanced, best |
| Cost Tracking | ✅ YES | Monthly limits, auto-downgrade, alerts |
| Hetzner Ready | ✅ YES | All 10 keys whitelisted, auto-deploy ready |
curl "http://localhost:3000/api/ai/select-by-budget?task=chat&budget=cheap"
# Returns Groq Llama at $0.27/M tokenscurl "http://localhost:3000/api/ai/select-by-budget?task=coding&budget=best"
# Returns GPT-4o at $5/M tokenscurl "http://localhost:3000/api/ai/estimate-cost?task=embedding&tokens=100000"
# Returns: $0.003-0.01 depending on providercurl "http://localhost:3000/api/ai/select-model?task=embedding"
# Returns: cohere-embed-english-v3- Check: AI-ROUTER-QUICK-START-EXPANDED.md (Troubleshooting section)
- Verify:
npm testandnode --check backend/index.js - Test: Try
/api/ai/healthendpoint
- Read: AI-ROUTER-QUICK-REF.md (Extension Pattern section)
- Add: API key to
.env - Edit:
aiProviderRouter.js(3 steps) - Done: Auto-validates and activates!
- Use:
/api/ai/estimate-costbefore calling APIs - Set:
monthlyBudgetLimitin costStrategy config - Budget: Start with
cheaporfreemode
The router intelligently selects models based on:
- Task type - coding, chat, embedding, etc.
- Budget mode - free, cheap, balanced, best
- Provider availability - only uses configured keys
- Cost estimates - calculates per request
This ensures you always get the best model for your needs and budget!
Updated: 5 aprilie 2026
Version: 2.0 (10 providers, expanded tasks, budget modes)
Status: Production Ready ✅