Alvin Intelligent Routing
Learn how Alvin automatically selects the optimal AI model for each request.
Alvin is Elyxir's intelligent routing system that automatically selects the best AI model for each request. Instead of manually choosing a model, let Alvin analyze your prompt and route to the optimal model for quality, speed, and cost.
How Alvin Works
When you send a message with Alvin routing enabled:
- Prompt Analysis: Alvin analyzes your message to understand the task
- Model Matching: Selects the best model based on capabilities
- Cost Optimization: Balances quality with cost efficiency
- Request Routing: Sends your request to the selected model
- Attribution: Shows which model was used in the response
Routing Factors
Alvin considers multiple factors when selecting a model:
Task Type
| Task | Preferred Models |
|---|---|
| Code generation | Claude 3.5, GPT-4o |
| Creative writing | GPT-4o, Claude 3 |
| Analysis/reasoning | GPT-4, Claude 3.5 |
| Quick questions | GPT-4o-mini, Claude Haiku |
| Web search | Perplexity Sonar |
Complexity
- Simple queries: Fast, cost-effective models (GPT-4o-mini)
- Complex reasoning: Advanced models (GPT-4, Claude 3.5)
- Long context: Models with extended context windows
Cost Efficiency
Alvin optimizes costs by:
- Using smaller models for simple tasks
- Reserving premium models for complex requests
- Monitoring token usage and context length
Model Attribution
Every response shows which model Alvin selected:
Model: gpt-4o-mini • Tokens: 245 • 0.3s
This transparency helps you understand routing decisions and costs.
Overriding Alvin
While Alvin provides excellent default routing, you can override it:
Manual Model Selection
- Click the Model dropdown in chat settings
- Select a specific model
- All subsequent messages use that model
- Click Use Alvin to return to automatic routing
When to Override
Consider manual selection when:
- You need a specific model's capabilities
- Testing model performance comparisons
- Working with specialized tasks
- Debugging or troubleshooting
Cost Savings
Alvin typically saves 30-50% on API costs compared to always using premium models:
| Scenario | Without Alvin | With Alvin | Savings |
|---|---|---|---|
| Simple Q&A | GPT-4 ($0.03) | GPT-4o-mini ($0.002) | 93% |
| Code review | GPT-4 ($0.03) | Claude Haiku ($0.005) | 83% |
| Complex analysis | GPT-4 ($0.03) | GPT-4 ($0.03) | 0% |
Alvin uses premium models when needed, ensuring quality isn't sacrificed for cost savings.
Routing Transparency
You can see Alvin's routing decisions:
- Response header: Shows selected model
- Analytics: View routing patterns over time
- Cost dashboard: Track savings from intelligent routing
Best Practices
- Trust the routing: Alvin is optimized for quality and cost
- Use descriptive prompts: Clear prompts help Alvin route accurately
- Review analytics: Understand your routing patterns
- Override sparingly: Only when you have specific requirements
API Usage
When using the API, Alvin routing is available by specifying the alvin model:
curl -X POST https://api.elyxir.ai/v1/chat/completions \
-H "Authorization: Bearer elyxir_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "alvin",
"messages": [{"role": "user", "content": "Write a Python function to sort a list"}]
}'Related
- AI Chat Overview - Using the chat interface
- Model Hub - Explore available models
- Cost Dashboard - Track routing savings