Auto-router - Content-Aware Preference-Aligned Routing #25703
Replies: 4 comments 12 replies
|
Personally I don't think this kind of auto-routing belongs to LiteLLM at all. Not looking to use it at any of our implementations. The client application (agent) generally has more information for routing, that a single LLM request to LiteLLM may carry; Including, particularly, stickiness of the conversation thread or an agentic session. At least not without some very advanced machinery (e.g. what OpenRouter with their huge R&D resources may have behind the scenes for their auto). Even for "pick the cheapest" how do you even do that ignoring sticky caching? Caching has 10x impact on costs. Also frontier LLMs are becoming more and more pickier on continuing existing conversation threads, requiring encrypted thoughts etc - switching the horse mid-conversation is going to be non-trivial. As the context grows longer with multiple conversation turns and tool calls, what good would BM25 do by simply matching all of that against brief model description? T Besides, with frontier LLMs breathing neck-to-neck into each other how do you even differentiate them by "CRUD, tests, deep reasoning, architectural decisions, 1M-context codebase analysis, large refactors, codebase migrations, sustained multi-file work, security audits" - they are all doing that quite well. There is no one who can meaningfully maintain this kind of differentiation especially as the situation in benchmarks changes week after week. At the very least, I would refocus the demonstrative example (above) to "cheap local gemma vs frontier Sonnet/Opus/gpt LLM". Long story short, the entire concept of auto-routing at the gateway level feels to me stuck in "2024" then what would be relevant in mid-2026 with all the complexity we are having today, given how much there remains to do for stabilizing and maintaining the core things LiteLLM is supposed to be doing well. Leave model choices to the client applications/agents. |
|
Sharing feedback from another user:
|
|
The way I see it, there's a huge difference between "auto-routing" (the system magically picks the best model) and what's actually being proposed here - which is closer to "the admin tells the gateway what each model is good at, and the gateway respects that at request time." One of these is an OpenRouter-style black box. The other is a cost governance primitive and I, from the enterprise point of view, am interested in the second one. The person deploying the agent is almost never the person paying the bill. Developers hardcode Opus for everything because it's the best and they don't care about cost - including me (when acting as a developer and not a platform owner). Meanwhile the platform team is staring at a monthly bill that's 4-5x (this is real data) what it needs to be because - every small request (even a one line change), unit test generation and boilerplate CRUD are going to be the most expensive model available. The answer today is "go talk to every agent developer and ask them to use cheaper models for simple tasks." That doesn't scale since there is no enforcement. Same reason we don't ask every micro-service to implement its own rate limiting - we put it in the gateway. re: the point about session stickiness and caching is spot on and I don't think anyone should ship this without solving for that. But that's an implementation constraint, not a reason to kill the feature. Route at session initiation, stick for the lifetime of the conversation, done. The re: users not mingling between providers - I'd argue that's mostly true cross-provider (nobody's bouncing between Claude and GPT mid-task), but intra-family routing is already a pattern people are doing by hand. Haiku for classification, Sonnet for code gen, Opus for architectural reasoning. Or mini for extraction, 5.3 for generation, 5.4-pro for complex planning. The idea of availability × capability × paradigm as a unified routing surface is spot on. LiteLLM already has health checks, tag routing, label routing, semantic routing - they're just scattered across different configs and not aware of each other. Composing them into one declarative routing decision is the actual feature request here. A few things that would make this actually work for enterprise adoption:
I don't think this is a 2024 concept at all. If anything it's the opposite - it's a 2026 cost governance requirement that's emerging precisely because usage-based AI spend is now big enough to show up on the P&L. Opus 4.7 is already using xHigh effort by default and this will keep getting worse over time. |
|
Sharing operating experience rather than a feature ask, since I run a tier-based router in production and this proposal is close to what we built:
Disclosure: I'm the founder of TierUp (https://tierup.ai/?ref=github), an OpenAI-compatible API that exposes this idea as |
Uh oh!
There was an error while loading. Please reload this page.
We're discussing a possible improvement to auto-routers on LiteLLM. The goal here is to help reduce costs, while maintaining quality for users.
The idea is to onboard models with descriptions on what they do well. Then expose 2 auto-router models - 'auto' and 'premium'.
'auto' - would route to the cheapest, competent model for the task
'premium' - would filter for more expensive models and pick from among them (e.g. just opus and gpt-5.4-pro, not sonnet).
The routing would occur, based on the models the user has access to.
1. Example config.yaml
2. User Request
Response headers expose the decision:
3. Preview Endpoint
How it might work
All reactions