litellm/tests
ryan-crabbe-berri f369fbb310
feat(ui): keep cost optimization tabs and filters in the URL (#41463)
* feat(ui): persist caching and cost page state in the URL

Caching keeps its tab, date range, key and model filters and the open error drilldown in the query string. Cost Tracking keeps which sections are open, the discount sub-tab and the calculator period. Cost Optimization keeps its tab, the shared date range, the savings view, the cache leakage grouping and sort, and the auto-router sub-tab and router. Tabs go through useUrlTab so unknown or role-hidden values fall back and are cleared, and the caching query now sends local calendar days so it matches the days in the URL

* fix(ui): address review on caching-cost url state

The caching activity query goes back to sending UTC days, because /global/activity/cache_hits filters on UTC days and has no timezone parameter. The URL keeps local days and the query now covers them in full again, with a timezone-pinned regression test. This supersedes the previous commit message, which said the query sends local days

The Overall savings toggle stores the shared SavingsAccumulation values (?savings=per-interval), which is the value the key savings view uses. useDailyActivityRange takes the date range as a required argument so no unused in-memory range is created, and the URL range hook no longer creates a second one either. The local visited-tabs hook is renamed useVisitedUrlTabs so it does not shadow the shared useVisitedTabs. Tests now cover unpadded URL days, an unknown ?leak_by= and the checked radio for an unknown ?period=

* feat(ui): keep cost optimization tabs and filters in the URL

The page tab now resolves against the full static tab list and the role
decides only what renders. A proxy-admin-only link opened by another role
falls back to Overall and keeps ?tab= in the URL, so it still works once
an admin role arrives, and the hidden panel never mounts.

The prompt caching requests table keeps its filter in ?requests_filter=.
The selected auto-router stays in local state because AutoRouterUsageView
is also rendered by the user and key detail views.

Tab changes from Base UI are matched against the tab list before they reach
the URL setter.

* test(ui): cover cost optimization tab links across roles, slow role and login

---------

Co-authored-by: Yuneng Jiang <yuneng@berri.ai>
2026-11-27 10:34:43 -08:00
..
_support fix(gemini): return an error instead of an empty 200 when a Gemini image request gets no image (#29125) 2026-11-25 20:55:23 +00:00
audio_tests
base_sdk_tests fix(packaging): ship the license public key in the litellm-proxy sdist (#52970) 2026-11-19 23:18:32 +00:00
basic_proxy_startup_tests
benchmarks fix(guardrails): classify only the frames each read completes in Presidio's first-frame wait (#54379) 2026-11-25 11:15:49 +00:00
code_coverage_tests ci: start fewer jobs per pull request (#54757) 2026-11-26 18:21:09 -08:00
documentation_tests fix(responses): bill a client-cancelled native Responses stream with the usage the provider reports (#54752) 2026-11-27 01:41:06 +00:00
e2e feat(ui): keep cost optimization tabs and filters in the URL (#41463) 2026-11-27 10:34:43 -08:00
e2e_harness test(e2e): move the Claude Code matrix to Opus, Sonnet and Haiku 5.5, Fable 5.2 and GPT-6 (#54305) 2026-11-25 01:47:03 +00:00
fixtures
harness_e2e
integration perf(mcp): skip unchanged scheduled catalog rebuilds (#54514) 2026-11-27 09:45:36 -05:00
rust-python-harness fix(gateway): serve messages drop, summary and timeout settings like Python (#51236) 2026-11-25 09:26:12 +00:00
test_litellm_rust fix(anthropic): keep caller tool_use ids unless the upstream rejects them (#54468) 2026-11-26 05:55:01 +00:00
typing
unit perf(mcp): skip unchanged scheduled catalog rebuilds (#54514) 2026-11-27 09:45:36 -05:00
windows_tests ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
__init__.py
_fake_openai_endpoint_server.py
_flush_vcr_cache.py
_live_test_helpers.py
_master_key.py
_module_state.py ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
_openai_record_replay_proxy.py
_process_helpers.py
_vcr_conftest_common.py
_vcr_redis_persister.py
_wait_helpers.py
_ws_vcr.py
AGENTS.md
capturing_transport.py
eval_swe_bench.py
fake_openai_endpoint.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
pyrightconfig.json
README.MD
test_logging.conf
test_rust_python_harness.py
VCR_TESTING.md
white_100x100.png

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/unit

This folder can only run mock tests.