Repository navigation
feat(ui): show prompt caching requests and net savings - #42055
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
93eb7c7 to
643fde0
Compare
|
@greptileai Please review the updated cursor pagination; live traffic and regression tests now cover inserts, deletions, and timestamp ties |
|
bugbot run Please review the current commit, including request attribution, pricing, cursor pagination, and date-scoped dashboard navigation |
643fde0 to
94b2fd8
Compare
|
@greptileai Please review the current commit, including explicit timestamp text binding and regression coverage through the real Prisma query engine |
|
bugbot run Please review the current commit for cursor parameter binding and pagination regressions after replacing the alternate test driver |
|
@greptileai Please refresh the current commit review after withdrawing the analytics finding; live cursor traversal and real Prisma regression tests pass |
|
bugbot run |
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 94b2fd8. Configure here.
… global spend rollup code from rc/1.104.0 (#43385) * Revert "feat(proxy): server-side Team Usage export beyond the top-N key cap (#42996)" This reverts commit 77eccac. * Revert "feat(usage): search team keys beyond the top-N in the Team usage view (#42857)" This reverts commit c2eb549. * Revert "feat(usage): search keys beyond the top-N usage subset (#42827)" This reverts commit 5a8ec13. * Revert "Merge pull request #41324 from BerriAI/litellm_daily_global_spend_table" Removes the daily global spend rollup job and its reads. Keeps the LiteLLM_DailyGlobalSpend model and migration so databases that already applied it are untouched and no new proxy-extras version is needed. This reverts commit 87694c2, reversing changes made to its first parent. * Revert "Merge pull request #41293 from BerriAI/litellm_usage_key_free_aggregate_split" Restores the aggregated usage query without the top-N key cap, so the Usage pages, per-key widgets and exports cover every key again. CacheLeakageCard keeps the date picker removal from #42055. This reverts commit 2e46b10, reversing changes made to its first parent. * chore: update Next.js build artifacts (2026-09-27 00:33 UTC, node v24.19.0)
TLDR
Problem this solves:
How it solves it:
User Flow
Before: an admin cannot inspect individual caching requests from Cost Optimization
/ui/cost-optimization/and select Prompt CachingAfter: an admin can inspect caching requests and open their logs
/ui/cost-optimization/and select Prompt CachingRelevant issues
Affected release
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Local Postgres and proxy on port 16540, dashboard development server on 16541, automatic Anthropic caching enabled. Real Anthropic requests used the gateway account through a recording relay; no provider responses were mocked. Reproduction payloads are linked with the screenshots. The 55 clearly labeled
pagination-qa-*rows are local fixtures used to exercise the 50-row dashboard limitBefore (f49fd22)
Open
http://localhost:16540/ui/cost-optimization/, select Prompt Caching, and scroll below configuration. Only cache leakage is availableRequest the caching table API:
HTTP 404,
{"detail":"Not Found"}After (94b2fd8)
Open
http://localhost:16541/cost-optimization/, select Prompt Caching, and scroll below configuration. Select Cache hits to see recorded injection alongside provider hits and estimated savingsSend the three payloads through the local proxy, then repeat the API request above:
HTTP 200; recorded live results:
Select LiteLLM injected: the client-caching row disappears and the write-only row stays. Select Cache hits: both hit rows remain. Click the injected hit request: its log shows 4,902 cache reads and 15 writes
Select All caching, then click Next and Previous: page 2 loads 16 rows and page 1 restores 50. All 66 requests appear exactly once when following API cursors; injected and cache-hit filters also traverse completely. The SQL binds timestamps as text before conversion, fixing the page-2 Prisma binary-bind error
Cursor regression and traversal evidence
make checkand 145 focused tests pass. Pagination tests use real Prisma with one connection and cover null-to-cursor-to-null reuse, microsecond precision, timezone offsets, and concurrent inserts/deletions. Restoring the old SQL fails with the reported bind error. All 94 checks pass; Greptile is 5/5 and Bugbot/Veria report no issues on this commitType
New Feature
Caveats (if any)
Low
Final Attestation
Note
Medium Risk
New admin spend-log query endpoint and shared savings pricing path affect cost metrics visibility; scope is read-only with role checks but touches spend tracking SQL and pagination.
Overview
Adds request-level prompt caching visibility on Cost Optimization via a new admin API and dashboard table.
The proxy exposes
GET /cost_optimization/prompt_caching/requests, which readsLiteLLM_SpendLogsfor a date range with filters (all caching, LiteLLM injected, cache hits), cursor-based pagination, and per-row fields for injection attribution, cache read/write tokens, spend, and estimated net savings (shared with daily rollups through refactoredprompt_caching_savings_for_request). Access is proxy-admin only;/cost_optimization/is allowlisted for the UI backend.On Prompt Caching, a shared date picker drives a new Prompt caching requests table (tabs, prev/next cursors, links to logs) alongside cache leakage; the leakage card no longer has its own date control.
Reviewed by Cursor Bugbot for commit 94b2fd8. Bugbot is set up for automated code reviews on this repo. Configure here.