litellm - 💡(How to fix) Fix [Feature]: include deleted keys and deleted teams to the report using api [1 comments, 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#24225Fetched 2026-04-08 01:09:16
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2commented ×1renamed ×1
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

provide a better consumption view when using API

Motivation, pitch

when using /spend/logs/V2 the deleted keys and the deleted teams consumptions is not reported what provide a truncated view of the consumption.

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

No response

extent analysis

Fix Plan

To address the issue of missing deleted keys and teams consumptions in the API response, we will modify the /spend/logs/V2 endpoint to include these details.

Steps to Fix

  • Update the database query to include deleted keys and teams
  • Modify the API response to include the additional data
  • Handle potential errors and edge cases

Example Code

# Updated database query
def get_consumption_logs():
    query = """
        SELECT * FROM consumption_logs
        WHERE team_id IN (SELECT id FROM teams) OR team_id IS NULL
    """
    results = db.execute(query)
    return results

# Modified API response
def spend_logs_v2():
    logs = get_consumption_logs()
    response = []
    for log in logs:
        if log['team_id'] is None:
            log['team_name'] = 'Deleted Team'
        response.append(log)
    return response

Verification

To verify the fix, test the /spend/logs/V2 endpoint with a sample request and check that the response includes the deleted keys and teams consumptions.

Extra Tips

  • Ensure that the database query is optimized for performance to avoid impacting the API response time.
  • Consider adding pagination or filtering to the API response to handle large datasets.

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