BerriAI/litellm · error · HTTPException
Not authorized to view spend for a {scope_name} other than y
Error message
Not authorized to view spend for a {scope_name} other than your own What it means
Error "Not authorized to view spend for a {scope_name} other than your own" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:1609
)
return parsed
def _resolve_spend_report_scope(
user_api_key_dict: UserAPIKeyAuth,
requested: str | None,
caller_value: str | None,
scope_name: str,
) -> str:
"""Return the scope value the caller may query spend for.
Non-admin callers are clamped to their own identity: a ``requested`` value
that differs from ``caller_value`` is a 403. Proxy admins (and admin
viewers) may request any scope.
"""
if requested:
if requested != caller_value and not _is_admin_view_safe(user_api_key_dict=user_api_key_dict):
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=f"Not authorized to view spend for a {scope_name} other than your own",
)
return requested
if caller_value is None:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"No {scope_name} associated with this API key; pass a {scope_name} query param",
)
return caller_value
async def _resolve_org_spend_report_scope(
user_api_key_dict: UserAPIKeyAuth,
organization_id: str | None,
prisma_client: PrismaClient,
) -> tuple[str, tuple[str, ...]]:
"""Return the organization to report on and the team_ids belonging to it.View on GitHub (pinned to 77b7c6c40c)
Solutions
- Query spend only for your own team/org scope, or use a proxy admin key.
When it happens
Trigger: Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:1609 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/cff1822baa95dd4f.
Report an issue: GitHub.