Open
Description
What happened?
We've identified two separate bugs in the LiteLLM usage dashboard that cause incorrect data display:
- Frontend Pagination Bug: Total spend significantly underreported when data spans multiple pages
- Backend Provider Attribution Bug: Failed requests show as 0 for all providers despite actual failures occurring
🔍 Bug Details
Bug 1: Frontend Pagination Aggregation Issue
Problem: The usage dashboard only displays totals from the first page of API results instead of aggregating across all pages.
API Calls Made:
/user/daily/activity?page=1 → Returns metadata with totals
/user/daily/activity?page=2 → Returns metadata with totals
/user/daily/activity?page=3 → Returns metadata with totals
/user/daily/activity?page=4 → Returns metadata with totals
Expected: Dashboard should sum all metadata totals across pages
Actual: Dashboard only shows totals from page 1
Affected Metrics:
- Total spend
- Total API requests
- Successful/failed requests
- Token usage
- Cache statistics
Bug 2: Backend Provider Attribution Issue
Problem: "Spend by Provider" section shows failed_requests: 0
for all providers despite failed requests being tracked in overall metadata.
API Response Structure:
{
"metadata": {
"total_failed_requests": 162 // ✅ Correct count
},
"results": [
{
"breakdown": {
"providers": {
"anthropic": {
"metrics": {
"failed_requests": 0 // ❌ Always 0
}
},
"vertex_ai": {
"metrics": {
"failed_requests": 0 // ❌ Always 0
}
}
}
}
}
]
}
Frontend Issue Location
- File:
ui/litellm-dashboard/src/components/new_usage.tsx
- Root Cause: Pagination logic correctly fetches all pages but only retains metadata from first API response
- Impact: Affects all paginated usage reports (>1000 records)
Relevant log output
Are you a ML Ops Team?
Yes
What LiteLLM version are you on ?
1.72.2-stable
Twitter / LinkedIn details
No response