fix(ui): drive auto-router usage from the shared cost-optimization time picker - #37871
Merged
tin-berri merged 2 commits intoAug 21, 2026
Merged
Conversation
Contributor
Greptile SummaryThe PR makes Auto-Router usage consume the shared cost-optimization date range and removes its independent window selector.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/useAutoRouterBenchmarks.ts | Converts the shared picker range into benchmark query dates while matching the Overall tab’s UTC-day extension. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.tsx | Replaces the tab-local duration selector with the shared date picker and documents the intentional session-overlap difference. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/CostOptimizationView.tsx | Supplies the existing shared activity range to the Auto-Router tab. |
| ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/useAutoRouterBenchmarks.test.ts | Covers historical ranges, incomplete ranges, and current-day behavior east and west of UTC. |
Reviews (2): Last reviewed commit: "fix(ui): extend a live-ending benchmarks..." | Re-trigger Greptile
Contributor
Author
|
@greptileai can you review here and reply with score |
Contributor
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit aaa9757. Configure here.
ryan-crabbe-berri
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: an admin comparing savings across tabs sees numbers that look contradictory
After: both tabs answer for the same window, picked in one place
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Setup for the parity case: proxy on this branch at localhost:4200, a complexity auto-router with tiers claude-haiku-4-5 (SIMPLE), claude-sonnet-4-5 (MEDIUM), claude-opus-4-5 (COMPLEX and REASONING) at public per-token prices, llm classifier on haiku. Upstream is an internal gateway fronting the real Anthropic-served models rather than api.anthropic.com directly (the local Anthropic key is out of credit; the calls are real completions with real spend). The QA database had zero auto-router traffic for the day before the run
Before (8122cfc)
Shared range across tabs
Savings parity on real traffic
After (aaa9757)
Shared range across tabs
Savings parity on real traffic
for p in "what is 2+2?" ... "architect a multi-region active-active postgres deployment..."; do curl -s http://localhost:4200/v1/chat/completions -H "Authorization: Bearer $KEY" -d '{"model":"auto_router_real","max_tokens":150,"messages":[{"role":"user","content":"'"$p"'"}]}'; done(all 9 return real completions; the classifier spreads them SIMPLE 3, MEDIUM 2, COMPLEX 2, REASONING 2)curl -s "http://localhost:4200/auto_router/benchmarks?start_date=2026-08-21&end_date=2026-08-21" -H "Authorization: Bearer $KEY"returnssessions 9, spend 0.020592, saved_spend 0.004138, baseline_spend 0.024730(this feeds the Auto-Router tab's Total estimated savings)curl -s "http://localhost:4200/user/daily/activity?start_date=2026-08-21&end_date=2026-08-21&timezone=420&include_current_utc_day=true" -H "Authorization: Bearer $KEY"returnsautorouter_savings_spend 0.004138for the day (this feeds the Overall tab's Auto-router savings card)0.004138 - 0.004138 = 0.000000000, an exact match on the same window; the per-model breakdown agrees too (opus turns save 0 because opus is the baseline, sonnet saves 0.003090, haiku saves 0.001048)Type
🐛 Bug Fix
Caveats (if any)
_adjust_dates_for_timezoneclient side; historical dates stay pass-through, matching the daily-activity policy