litellm - ✅(Solved) Fix [Feature]: Open /spend/logs/ui (and remaining read-only routes) to proxy_admin_viewer [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26582Fetched 2026-04-28 06:26:43
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #26583: feat: Allow Admin Viewers to Access Spend Logs

Description (problem / solution / changelog)

Relevant issues

Fixes #26582 Related: #17086 (closed by stale-bot without fix)

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Screenshots / Proof of Fix

AS-IS

<img width="1278" height="870" alt="스크린샷 2026-04-28 오전 8 41 34" src="https://github.com/user-attachments/assets/cae6b7e2-5aa0-47e3-91b0-b1f7f88a7f1b" />

403 Forbidden with Admin Viewer role

TO-BE

<img width="1275" height="928" alt="스크린샷 2026-04-28 오전 8 37 11" src="https://github.com/user-attachments/assets/89cec309-f23d-47d2-b47e-a72b13f34859" />

User with Admin Viewer role can retrieve logs correctly.

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature ✅ Test

Changes

  • litellm/proxy/_types.py: 5 entries added to admin_viewer_routes
  • tests/test_litellm/proxy/auth/test_route_checks.py: parametrized test test_proxy_admin_viewer_can_access_spend_logs (5 cases)

Changed files

  • litellm/proxy/_types.py (modified, +7/-0)
  • tests/test_litellm/proxy/auth/test_route_checks.py (modified, +99/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

The Feature

Add the following read-only endpoints to admin_viewer_routes in litellm/proxy/_types.py so the proxy_admin_viewer role can call them:

  • /spend/logs
  • /spend/logs/ui
  • /spend/logs/v2
  • /spend/logs/session/ui
  • /spend/logs/ui/{request_id}

All are pure GET / read endpoints.

Motivation, pitch

The official LiteLLM RBAC table describes proxy_admin_viewer as:

Can login, view all keys, view all spend across the platform. Cannot create keys/delete keys/add new users.

But in practice proxy_admin_viewer gets 403 Forbidden on /spend/logs/ui

What part of LiteLLM is this about?

Proxy

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

https://www.linkedin.com/in/세환-김-a31543202/

extent analysis

TL;DR

Add the specified read-only endpoints to the admin_viewer_routes in litellm/proxy/_types.py to allow the proxy_admin_viewer role to access them.

Guidance

  • Verify that the proxy_admin_viewer role is correctly configured and assigned to the user attempting to access the endpoints.
  • Check the existing admin_viewer_routes in litellm/proxy/_types.py to ensure the new endpoints are not already included.
  • Add the following endpoints to admin_viewer_routes: /spend/logs, /spend/logs/ui, /spend/logs/v2, /spend/logs/session/ui, and /spend/logs/ui/{request_id}.
  • Test the endpoints after adding them to admin_viewer_routes to confirm the proxy_admin_viewer role can access them without receiving a 403 Forbidden error.

Example

# In litellm/proxy/_types.py
admin_viewer_routes = [
    # existing routes...
    '/spend/logs',
    '/spend/logs/ui',
    '/spend/logs/v2',
    '/spend/logs/session/ui',
    '/spend/logs/ui/{request_id}',
]

Notes

This solution assumes that the proxy_admin_viewer role is correctly defined in the LiteLLM RBAC table and that the issue is solely due to the missing endpoints in admin_viewer_routes.

Recommendation

Apply workaround: Add the specified endpoints to admin_viewer_routes as the issue seems to be a simple configuration oversight.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Feature]: Open /spend/logs/ui (and remaining read-only routes) to proxy_admin_viewer [1 pull requests, 1 participants]