litellm - ✅(Solved) Fix [Bug]: org_admin unable to view organization-wide usage data in UI Dashboard [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#25493Fetched 2026-04-11 06:13:52
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Error Message

  • No error messages are shown (the call may technically return data but the UI cannot display it meaningfully)

Root Cause

The root cause is in the UI layer: the Usage page hardcodes an empty organizations array instead of fetching the user's organizations, so the EntityUsage component receives no organization context and cannot populate its filter dropdown or correlate data to named organizations.

PR fix notes

PR #25617: fix(ui): org_admin unable to view organization-wide usage data in UI Dashboard

Description (problem / solution / changelog)

Relevant issues

Fixes #25493

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

Screenshots / Proof of Fix

Before: org_admin navigates to Usage → "Your Organization Usage" → sees $0.00 / 0 requests / empty charts / no organization filter dropdown.

After: useOrganizations() hook fetches the user's organizations via /organization/list, populating the filter dropdown and enabling the usage data display.

Type

🐛 Bug Fix

Changes

Problem

org_admin users see completely empty organization usage data in the UI Dashboard. The Usage page (usage/page.tsx) hardcodes organizations={[]} instead of fetching real organization data, so EntityUsage receives an empty list, hides the filter dropdown, and cannot display any data.

Root Cause

usage/page.tsx:11 passes organizations={[]} to UsagePageView. The useOrganizations() hook (already used in users/page.tsx) was never imported or called.

Fix

  • Added useOrganizations() hook import and call in usage/page.tsx
  • Pass organizations ?? [] to UsagePageView

This is a 2-line change that mirrors the existing pattern in users/page.tsx. No backend changes needed — both /organization/list and /organization/daily/activity already handle org_admin authorization correctly.

Files Changed

  • ui/litellm-dashboard/src/app/(dashboard)/usage/page.tsx — Import and use useOrganizations() hook instead of hardcoding []

Changed files

  • ui/litellm-dashboard/src/app/(dashboard)/usage/page.tsx (modified, +3/-1)

Code Example

return <UsagePageView teams={teams ?? []} organizations={[]} />;

---

import { useOrganizations } from "@/app/(dashboard)/hooks/organizations/useOrganizations";
// ...
const { data: organizations, isLoading: isOrgsLoading } = useOrganizations();

---

{usageView === "organization" && (
  <EntityUsage
    entityType="organization"
    entityList={
      organizations?.map((organization) => ({
        label: organization.organization_alias,
        value: organization.organization_id,
      })) || null
    }

---

if not _user_has_admin_view(user_api_key_dict):
    memberships = await prisma_client.db.litellm_organizationmembership.find_many(
        where={"user_id": user_api_key_dict.user_id}
    )
    admin_org_ids = [
        m.organization_id for m in memberships
        if m.user_role == LitellmUserRoles.ORG_ADMIN.value
    ]
    if org_ids_list is None:
        org_ids_list = admin_org_ids  # Defaults correctly

---

"use client";

import UsagePageView from "@/components/UsagePage/components/UsagePageView";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import useTeams from "@/app/(dashboard)/hooks/useTeams";
import { useOrganizations } from "@/app/(dashboard)/hooks/organizations/useOrganizations";

const UsagePage = () => {
  const { accessToken, userRole, userId, premiumUser } = useAuthorized();
  const { teams } = useTeams();
  const { data: organizations } = useOrganizations();

  return <UsagePageView teams={teams ?? []} organizations={organizations ?? []} />;
};

export default UsagePage;

---
RAW_BUFFERClick to expand / collapse

Check for existing issues

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

What happened?

An org_admin user navigating to the Usage tab and selecting "Your Organization Usage" sees completely empty data: Total Spend $0.00, Total Requests 0, and all charts show "No data" -- despite active traffic on keys associated with that organization.

The root cause is in the UI layer: the Usage page hardcodes an empty organizations array instead of fetching the user's organizations, so the EntityUsage component receives no organization context and cannot populate its filter dropdown or correlate data to named organizations.

The backend endpoints (/organization/daily/activity and /organization/list) correctly handle org_admin authorization and would return proper data if called with the right context.

Root Cause Analysis

The bug: Usage page does not fetch organizations

In ui/litellm-dashboard/src/app/(dashboard)/usage/page.tsx:11:

return <UsagePageView teams={teams ?? []} organizations={[]} />;

The organizations prop is hardcoded as []. The page imports useTeams to fetch teams but does NOT import or use the useOrganizations() hook.

The correct pattern already exists

In ui/litellm-dashboard/src/app/(dashboard)/users/page.tsx:6,16:

import { useOrganizations } from "@/app/(dashboard)/hooks/organizations/useOrganizations";
// ...
const { data: organizations, isLoading: isOrgsLoading } = useOrganizations();

The users page correctly fetches organizations and passes them downstream. The Usage page skips this entirely.

Downstream chain reaction

Step 1 -- UsagePageView.tsx:836-844 receives organizations=[] and maps it to entityList:

{usageView === "organization" && (
  <EntityUsage
    entityType="organization"
    entityList={
      organizations?.map((organization) => ({
        label: organization.organization_alias,
        value: organization.organization_id,
      })) || null
    }

Since organizations=[], this produces entityList=[] (empty array, not null).

Step 2 -- EntityUsage.tsx receives entityList=[]:

  • The filter dropdown check entityList !== null && entityList.length > 0 evaluates to false -- filters are hidden
  • selectedTags remains empty, so entityFilterArg = null
  • The API call fires with organizationIds=null

Step 3 -- networking.tsx:1952-1969 sends request to /organization/daily/activity with no organization_ids parameter.

Step 4 -- Backend organization_endpoints.py:319-343 correctly defaults to org_admin's organizations when org_ids_list is None:

if not _user_has_admin_view(user_api_key_dict):
    memberships = await prisma_client.db.litellm_organizationmembership.find_many(
        where={"user_id": user_api_key_dict.user_id}
    )
    admin_org_ids = [
        m.organization_id for m in memberships
        if m.user_role == LitellmUserRoles.ORG_ADMIN.value
    ]
    if org_ids_list is None:
        org_ids_list = admin_org_ids  # Defaults correctly

The backend returns data for the org_admin's organizations, but the UI has no organization names to display in filters, no way for the user to select/deselect orgs, and the overall experience appears broken.

Backend verification: both endpoints work for org_admin

  1. /organization/list (organization_endpoints.py:661-710) -- for non-proxy-admin users, it queries LiteLLM_OrganizationMembership and returns only orgs where the user has membership. No proxy_admin gate.

  2. /organization/daily/activity (organization_endpoints.py:282-371) -- for non-proxy-admin users, it defaults to orgs where user is org_admin. Authorization is correct.

Expected behavior

  • org_admin users should see a populated organization filter dropdown on the Usage tab
  • Aggregated spend data (Total Spend, Total Requests, Successful/Failed Requests) should display for their organization(s)
  • Daily Spend chart and "Spend Per Organization" table should show data corresponding to traffic on keys in their organization

Actual behavior

  • The "Your Organization Usage" view shows $0.00 / 0 / 0 / 0 for all metrics
  • Charts display "No data"
  • Organization filter dropdown is empty/hidden -- user cannot select which organizations to view
  • No error messages are shown (the call may technically return data but the UI cannot display it meaningfully)

Steps to Reproduce

  1. As proxy_admin, create an organization (e.g., acme-corp) via /organization/new
  2. Create a user with global role internal_user (the default)
  3. Add the user as org_admin for acme-corp via /organization/member_add
  4. Create API keys with organization_id set to acme-corp's ID
  5. Generate traffic using those keys (make some LLM calls)
  6. Wait for spend to be recorded in LiteLLM_DailyOrganizationSpend table
  7. Log into the Admin UI as the org_admin user
  8. Navigate to Usage tab, observe "Your Organization Usage" is selected
  9. Observe: All metrics show $0.00 / 0, charts show "No data", no organization filter dropdown visible

Suggested fix

Fix: Use useOrganizations() hook in the Usage page

Update ui/litellm-dashboard/src/app/(dashboard)/usage/page.tsx to fetch organizations, mirroring the pattern already used in users/page.tsx:

"use client";

import UsagePageView from "@/components/UsagePage/components/UsagePageView";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import useTeams from "@/app/(dashboard)/hooks/useTeams";
import { useOrganizations } from "@/app/(dashboard)/hooks/organizations/useOrganizations";

const UsagePage = () => {
  const { accessToken, userRole, userId, premiumUser } = useAuthorized();
  const { teams } = useTeams();
  const { data: organizations } = useOrganizations();

  return <UsagePageView teams={teams ?? []} organizations={organizations ?? []} />;
};

export default UsagePage;

Why this works:

  • useOrganizations() calls organizationListCall(accessToken) which hits /organization/list
  • /organization/list already correctly returns only the user's organizations for non-proxy-admin users
  • UsagePageView will then pass a populated entityList to EntityUsage
  • The organization filter dropdown will appear, allowing org selection
  • The API call to /organization/daily/activity will work as already implemented

No backend changes needed -- both /organization/list and /organization/daily/activity already handle org_admin authorization correctly.

Related code locations

ComponentFileLinesIssue
Usage pageui/litellm-dashboard/src/app/(dashboard)/usage/page.tsx11Hardcodes organizations={[]}
Correct patternui/litellm-dashboard/src/app/(dashboard)/users/page.tsx6, 16Shows correct useOrganizations() usage
Organizations hookui/litellm-dashboard/src/app/(dashboard)/hooks/organizations/useOrganizations.ts7-14Hook exists, tested, unused in usage page
UsagePageViewui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx836-844Maps empty orgs to empty entityList
EntityUsageui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/EntityUsage.tsx481-493Filter hidden when entityList is empty
Networkingui/litellm-dashboard/src/components/networking.tsx1952-1969organizationDailyActivityCall -- works correctly
Backend daily activitylitellm/proxy/management_endpoints/organization_endpoints.py282-371/organization/daily/activity -- works correctly for org_admin
Backend org listlitellm/proxy/management_endpoints/organization_endpoints.py601-711/organization/list -- works correctly for org_admin

Relevant log output

What part of LiteLLM is this about?

UI Dashboard

What LiteLLM version are you on ?

v1.82.3

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The most likely fix is to update the Usage page to fetch organizations using the useOrganizations() hook, mirroring the pattern used in the users page.

Guidance

  • Update ui/litellm-dashboard/src/app/(dashboard)/usage/page.tsx to import and use the useOrganizations() hook to fetch organizations.
  • Verify that the useOrganizations() hook is correctly implemented and tested in ui/litellm-dashboard/src/app/(dashboard)/hooks/organizations/useOrganizations.ts.
  • Check that the UsagePageView component correctly handles the populated entityList and displays the organization filter dropdown.
  • Test the fix by following the steps to reproduce the issue and verifying that the organization filter dropdown is populated and the usage data is displayed correctly.

Example

import { useOrganizations } from "@/app/(dashboard)/hooks/organizations/useOrganizations";

const UsagePage = () => {
  const { data: organizations } = useOrganizations();

  return <UsagePageView teams={teams ?? []} organizations={organizations ?? []} />;
};

Notes

  • No backend changes are needed, as the /organization/list and /organization/daily/activity endpoints already handle org_admin authorization correctly.
  • The fix only applies to the UI Dashboard component of LiteLLM.

Recommendation

Apply the workaround by updating the Usage page to use the useOrganizations() hook, as this fix addresses the root cause of the issue and does not require any backend changes.

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…

FAQ

Expected behavior

  • org_admin users should see a populated organization filter dropdown on the Usage tab
  • Aggregated spend data (Total Spend, Total Requests, Successful/Failed Requests) should display for their organization(s)
  • Daily Spend chart and "Spend Per Organization" table should show data corresponding to traffic on keys in their organization

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 [Bug]: org_admin unable to view organization-wide usage data in UI Dashboard [1 pull requests, 1 participants]