Repository navigation
Auto-Router: what improvements do you want to see? #32168
Replies: 32 comments 154 replies
|
From working on the Adaptive Router implementation in the Rust project, I think all three strategies should eventually converge into a single Auto-Router. Adaptive routing shows that model selection is fundamentally a scoring problem. Semantic similarity, complexity, user feedback, cache probability and optional LLM classification can all be treated as signals contributing to a final routing score. Rather than exposing multiple routing modes, I'd expose one Auto Router with configurable signals and weights. This keeps the API simple while allowing the routing engine to evolve internally. I'd also like to see Adaptive Router learn from implicit production signals such as latency, retries, failures, cache hits and token usage, not just explicit user feedback. Finally, making routing decisions explainable would greatly improve debugging and production tuning. |
|
Does complexity routing fall under this? I am not sure if auto routing uses the same logic, but it seems that I cannot hit the anthropic messages endpoint with a complexity router. When using Bedrock on the backend, only Anthropic endpoints work with prompt caching. Chat Completions and Responses seem to always return 0 prompt caching. But if the routers worked with the anthropic endpoints, it would work I think. |
|
Hey @jeann2013 - would love for you to take a look at updated autorouter --> converged to a single auto-router merging complexity and semantic routing: #32859 + added option for LLM based classification + basic logging ( #32943) would love to know your thoughts on what level of observability you want on routing decisions, also what kind of plugins are you envisioning to be added? |
|
One funny side effect of this discussion: I actually started thinking about litellmhub.ai 😄. If third-party plugins become a thing, I could easily imagine a community hub where people publish, rate, and discover routing plugins. |
|
Proposal: allow budget-based limits on models within the auto-router. Two budget mechanisms already exist in the router and both work by filtering a deployment out of the candidate pool once exhausted, not by erroring:
Neither is visible to auto-router today. Proposal: route tier-list selection through the same budget-filtering pool instead of picking blind. No new config surface needed, this reuses model_list:
- model_name: smart-router
litellm_params:
model: auto_router/complexity_router
complexity_router_config:
tiers:
COMPLEX: [fable, claude-sonnet-4]
- model_name: fable
litellm_params:
model: anthropic/claude-fable-5
max_budget: 50
budget_duration: 1dor per-key, via the existing Separate question worth its own thread: what happens when every model in a tier is exhausted. Bump to the next tier, drop down, or error. Probably needs to be configurable rather than a fixed default. |
|
Tossing this out there at I love the auto router ideas (im excited to try out the bedrock fixes) I would add that we are always trying to maximize tokens vs prompt caching. In the usage tab, per key, if you drop down a key with an auto router, or check the usage of an auto router, I would love to be able to see token, request, prompt caching per model within three "smart router" model if that makes sense. For an organization, when testing and setting this up, it would be great if I could have the insight that: "Oh, we are hitting Opus 80% of the time instead of sonnet or haiku" and then adjust the complexity scores based on this information. |
|
Good news! I finished the first end-to-end validation of the new Routing Plugin architecture using a reference Language Detector plugin. Repository: The plugin is intentionally simple: it detects the user's language using I tested it against a real LiteLLM proxy using
While testing I also found two gaps in the current pre-release implementation:
Overall, the Routing Plugin API is working well, and it was great to validate the complete plugin pipeline on a real proxy request. I'll continue building additional reference plugins and sharing feedback as the ecosystem evolves. |
|
@krrish-berri-2 For example, imagine a plugin declaring something like: name: language-detector
version: 1.0.0
provides:
- signal: language
requires:
- messages
config_schema:
confidence_threshold:
type: float
default: 0.8That would enable a few nice things:
One other thing that would be valuable in production is per-plugin metrics. Since routing plugins can influence latency and routing quality, exposing something like:
via OpenTelemetry/Prometheus would make it much easier to understand whether a plugin is actually improving routing or just adding overhead. I also really like the idea of a Overall, I think the move from "routing modes" to a plugin-driven routing pipeline is the right architectural direction—it keeps the core router stable while letting the community experiment with new routing signals independently. |
|
@krrish-berri-2 We're testing the latest version and noticed an issue with session affinity. Session affinity works correctly when using the Chat Completions API. However, in our setup, Claude CLI is integrated with the LiteLLM proxy, and requests are sent using the Anthropic Messages API (v1.x) format. In the Anthropic request payload, the session ID is available at "request_data.user_id.session_id" instead of as a top-level field. As a result, the current session affinity implementation doesn't seem to pick it up, so requests are not consistently routed to the same backend. Is there a recommended way to configure session affinity to use "request_data.user_id.session_id" as the affinity key? Or is support for extracting nested session IDs planned? |
|
I like starting simple. I'd probably just add a few fields that help users decide whether they can use the plugin without opening the repository. Something like: {
"name": "language-detector",
"description": "Detects the user's language and publishes a routing signal.",
"author": "Jean Nuñez",
"repo": "https://github.com/...",
"pypi": "litellm-plugin-language-detector",
"litellm_version": ">=1.94.0",
"tags": ["language", "classification", "routing"]
}I think |
|
I like the proposed fix, and it solves the immediate Claude CLI use case. Longer term, though, it might be worth exposing a generic routing context that plugins can enrich instead of teaching the core about provider-specific request formats. For example, a plugin could simply set: context.routing.session_affinity_key = session_id regardless of whether it came from metadata.session_id, requester_metadata.user_id.session_id, or any future provider-specific location. The core would only consume context.routing.session_affinity_key, making session affinity provider-agnostic while keeping the routing pipeline extensible. |
|
The plugin API looks solid. Is the long-term vision to provide first-class plugin management from the Admin UI, or is the intended operational model to keep plugins configured exclusively through Python and YAML? |
|
We run Classification input is the latest user message only, which breaks two ways on agent traffic:
# control: hard prompt alone -> tier=COMPLEX
cat > /tmp/control.json <<'EOF'
{"model": "smart-router", "max_tokens": 64, "messages": [
{"role": "user", "content": "Design a distributed consensus protocol for a multi-region deployment; compare raft and paxos tradeoffs in detail."}
]}
EOF
curl -s http://localhost:4000/v1/messages -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H "Content-Type: application/json" -d @/tmp/control.json
# same prompt + trailing metadata message -> tier=SIMPLE
cat > /tmp/repro.json <<'EOF'
{"model": "smart-router", "max_tokens": 64, "messages": [
{"role": "user", "content": "Design a distributed consensus protocol for a multi-region deployment; compare raft and paxos tradeoffs in detail."},
{"role": "user", "content": "Runtime context for the immediately preceding user message.\nThis context is runtime-generated, not user-authored.\n{\"chat_id\": \"thrd_d29fcb0a2640\", \"message_id\": \"msg_57aa80565560\", \"sender\": {\"id\": \"user\"}, \"inbound_event_kind\": \"user_request\"}"}
]}
EOF
curl -s http://localhost:4000/v1/messages -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H "Content-Type: application/json" -d @/tmp/repro.json
Plugins can't fix either one, since they run after tiering and only narrow candidates What we'd want is @jeann2013's routing-context idea applied here: a pre-classification plugin Happy to share the full setup. |
|
RoutingContext can't distinguish deployments of the same model, how should that be expressed?
What works today is the How would you prefer same-model, cross-deployment selection to be expressed? I'd rather hear your intent than pre-commit to a design, but the options I see:
Happy to contribute the upstream change if the |
|
Feature request: Session Affinity Per Tier: So from the documentation: In my test cases I have something like: However for Solar-Open2 (Locally hosted) I dont care as much about prompt caching. Also Grok 4.3 is pretty cheap, so I would prefer not to lock in these two models, and prevent someone from getting Sonnet-5 or Opus 4.8 if they need to. So I would prefer to only START pinning/session afinity once someone gets Claude-Sonnet-5 or Claude Opus 4.8 Also if someone uses the I have not tested the behavior where someone is locked to a model due to session affinity, and then calls adds "LITELLM ESCALATE" to their call. |
|
One improvement I'd push to the top of the list: per-request cost attribution that survives routing decisions. When a router moves traffic between providers mid-day, the monthly bill stops matching any single provider's dashboard. What actually helped us was recording input/cached/output tokens and recomputed cost on every response, then checking that total latency = gateway overhead + upstream time, so drift shows up immediately. We open-sourced the schema and a validator here: https://github.com/NovaRouteAI/per-request-cost-telemetry Also worth version-pinning or tracking cost per model revision — silent model swaps are a real source of bill surprises. |
Feature request: complexity router — ratchet-up session affinity, and per-tier reasoning effortContext: Two proposals below. They're independent. 1. Let
|
|
On the third direction — cache-aware routing (decide if we should switch, if prompt caching is enabled) — I ran the arithmetic against a live catalog and the result argues against any single heuristic, so posting the numbers in case they're useful while that one is still being scoped. The setup: a conversation is warm on model A, and the router is considering a cheaper model B. Switching throws the cache away, so turn one on B is billed at B's list input price (plus a write premium if B re-caches), and only later turns get B's cached rate. Staying costs A's cached rate every turn. So the comparison isn't I keep a table that re-reads OpenRouter's catalog daily; today it has 40 non-batch models across 12 task categories, every one publishing a cache-read price. Taking only in-category downgrades (B ranks below A on the same task, i.e. the switch a router would actually consider) gives 96 candidate pairs:
Break-even turns, solving That spread is the point. Three pairs, all same-category, all "downgrade to something cheaper":
The second and third look like obvious wins on list price — GPT-5.2 is 12.5% cheaper than Sonnet 5 in, Qwen3.7 Max 26% cheaper than Grok 4.5 — and both are losses for any realistic session, because the cached rates are nearly identical while the switch costs a full uncached prompt. A router that compares list prices would take both. A router that compares against So the concrete ask: when the cache-aware branch lands, could the decision read the cached input price rather than the list one, and fall back to "don't switch" when a deployment doesn't publish one? Everything above is a two-column lookup — no new state, no calibration. The 45% that never pay back can be filtered with a single comparison before any scoring runs, which also shrinks the candidate pool the classifier has to reason about. Two caveats on my own numbers. The write multiplier isn't in my data — I took Raw table if anyone wants to redo it against their own routing set: curl -s https://cdn.jsdelivr.net/gh/xyzs996/llm-api-pricing@main/data/prices.csvColumns are |
|
As a personal/side project I have created a custom modernBERT architext encoder model for LiteLLM! After having very good results with around 1400 examples, I bumped this to 2500 using various models (Gemini 3.7 Flash, GLM 5.3, Deepseek v4 Flash and a few others.) The dataset generation involves a bunch of domains, here is a small subset to give an idea:
I have also created the primary ModernBERT BF16 model (For CUDA support) (I am still working on converting documentation. Here is the CPU Support model container for testing: (CPU Model does matter, there are CPU features that the OpenVINO models really benefit from). I am currently on windows and deployed the container using podman desktop (Using a hyper-v backend): The model takes in a JSON conversations format, and returns a complexity score from 0-10. This is valuable, because then one could make/edit custom ranges. I.E If you are an engineering company with lots of complex tasks/request, you might want to lean more towards the more performant models. Which returns a HIGH complexity of: Or a simple PIVOT request: Which returns: Keep in mind, this is in a laptop VM using non-performance cores. The CUDA model performs complex requests in about 15-30 ms. The docker container also supports batching! (But i havent tested it yet.) |
|
Hi everyone, LiteLLM v1.98.0 I wanted to ask a quick clarification regarding the Cost Optimization segment, specifically around Prompt Caching. We have caching implemented and it's definitely working on the backend—we can see the cache hits occurring, and the cost for those specific responses correctly registers as $0.00000000. However, we aren't seeing any specific optimization stats or total savings quantified for Prompt Caching in the UI/metrics. Is there a specific configuration we need to enable to get caching savings to reflect in the broader Cost Optimization stats alongside the Auto Router? Or is this tracking currently unsupported for caching? |
|
Hi everyone, I really like this feature. One suggestion, for the LLM Classifier, would be interesting to be able to set the Reasoning Effort for the Classifier Model when the model supports it (from the UI). |
|
We're launching fusion models! In internal testing, we see fusion models outperform Fable 5 by up to 56% on Terminal-Bench! How it works: Every fusion model request will be handled by a panel of models with no tool call capabilities, and then aggregated and handled by a conductor model with full capabilities PR for feedback: #39224 Let us know what you think! |
|
09/04/2026 We're thrilled to add mid-task escalations. If a weaker model stalls mid-task, LiteLLM will now automatically detect this and escalate to a higher model tier to keep the task moving. Learn more: https://docs.litellm.ai/blog/auto-router-stall-escalation |
|
On mid-task escalation — the interesting question there is what counts as "stalled", Three states get collapsed into one if you're not careful:
Escalating on unknown is right. Escalating on needs input burns a higher tier on a Two failure modes worth designing against, both of which cost me real runs:
Concretely for the feature: it'd help to expose why an escalation fired (silence |
|
Hello, this looks like a very promising feature. I'm looking at the docs and this discussion and have a few suggestions/questions.
|
|
Thrilled to launch Litespeed - a local coding agent, designed for @litellm's AUTOROUTER This is designed for an ensemble of models to tackle queries (plan with fable, execute with glm-5.2), reducing cost and maintaining frontier quality. |
|
Given this is a licensed feature for multi autorouters, can you look at improving the licensing process. |
|
We ran a related check on public data that may help with where Auto-Router goes next. We build a harness that registers each agent attempt before it runs and judges it with hidden tests. On all 500 SWE-bench Verified tasks, using the February 2026 mini-swe-agent runs of 12 models, MiniMax M2.5 solved 75.8% at $0.073 per task and Claude Opus 4.5 solved 76.8% at $0.754. A simple cost-aware router we tested did not beat just using MiniMax M2.5, and per-task routing did not beat the best fixed model by the margin we set in advance (+0.6 pp, 95% CI -1.6 to +2.8). One suggestion for the 25-task benchmark in your blog post: compare Auto-Router with the cheapest fixed model that comes within 2 points of the best, and run it on the full 500 tasks. With 25 tasks the interval is wide enough that a good fixed choice and a router are hard to tell apart. We can share our analysis plan and the per-task data if that's useful. Alexandr Kartak, Verifiable Agent Router |


















Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Auto-Router today supports 3 flows
Looking for input on how we can simplify this + where this should go next. Some directions we're considering:
If you're using Auto-Router (or thought about using it and decided against it), we'd like to hear what's missing or what would make it more useful for your setup.
09/01/26:
We're launching fusion models! In internal testing, we see fusion models outperform Fable 5 by up to 56% on Terminal-Bench!
How it works: Every fusion model request will be handled by a panel of models with no tool call capabilities, and then aggregated and handled by a conductor model with full capabilities
PR for feedback: #39224
Let us know what you think!
09/04/2026
We're thrilled to add mid-task escalations. If a weaker model stalls mid-task, LiteLLM will automatically detect this and escalate to a higher model tier to keep the task moving.
Learn more: https://docs.litellm.ai/blog/auto-router-stall-escalation
All reactions