litellm - ✅(Solved) Fix [Bug]: Budget Alerts Not Working for End User Budgets [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#24790Fetched 2026-04-08 01:53:57
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
1
Participants
Timeline (top)
labeled ×1

PR fix notes

PR #22279: feature: support end_user_budget alerts to slack

Description (problem / solution / changelog)

Relevant issues

Expected to see slack alerts when my end_users are exceeding spend limit when they have a budget attached. But nothing happened, so went into the code to see if we already support alerting for end_users. No support for alerting currently, this addresses this.

Pre-Submission checklist

  • I have Added testing in the tests/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

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:

Type

🆕 New Feature 🐛 Bug Fix

Changes

Introducing a end_user_budget alert to slack for alerting.

Decoupled _check_end_user_budget from get_end_user_object as they serve different functionality

Changed files

  • litellm/integrations/SlackAlerting/budget_alert_types.py (modified, +10/-0)
  • litellm/integrations/SlackAlerting/slack_alerting.py (modified, +1/-0)
  • litellm/proxy/auth/auth_checks.py (modified, +64/-23)
  • litellm/proxy/utils.py (modified, +1/-0)
  • tests/proxy_unit_tests/test_auth_checks.py (modified, +27/-26)
  • tests/proxy_unit_tests/test_default_end_user_budget_simple.py (modified, +24/-13)
  • tests/test_litellm/integrations/SlackAlerting/test_budget_alert_types.py (modified, +45/-2)
  • tests/test_litellm/proxy/auth/test_auth_checks.py (modified, +204/-4)
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?

Looks like unintentional gap but there are no alerts or webhooks for end user budgets.

Is it possible this would resolve? https://github.com/BerriAI/litellm/pull/22279

This is a blocker for us

Steps to Reproduce

  1. Create a budget for end user
  2. Set soft budget
  3. Receive no alert

Relevant log output

What part of LiteLLM is this about?

No response

What LiteLLM version are you on ?

v1.81

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To resolve the issue of missing alerts for end user budgets, we will implement a webhook notification system.

Step-by-Step Solution:

  1. Update the budget creation endpoint: Modify the endpoint that handles budget creation to trigger a webhook notification when a soft budget is set.
  2. Create a webhook notification service: Develop a service that sends notifications to end users when their budget is approaching or has exceeded the soft limit.
  3. Integrate with existing alert system: Integrate the new webhook notification service with the existing alert system to ensure seamless notifications.

Example Code (Python):

import requests

# Webhook notification service
def send_notification(budget_id, user_id, notification_type):
    url = f"https://example.com/webhook/{notification_type}"
    payload = {"budget_id": budget_id, "user_id": user_id}
    response = requests.post(url, json=payload)
    if response.status_code == 200:
        print("Notification sent successfully")
    else:
        print("Error sending notification")

# Update budget creation endpoint
def create_budget(budget_data):
    # Create budget logic here
    if budget_data["soft_limit"]:
        send_notification(budget_data["id"], budget_data["user_id"], "soft_limit_approaching")
    return budget_data

Verification

To verify that the fix worked, create a new budget with a soft limit and check if a notification is received when the limit is approached or exceeded.

Extra Tips

  • Ensure the webhook notification service is properly configured and integrated with the existing alert system.
  • Test the notification system thoroughly to avoid false positives or negatives.
  • Consider implementing a retry mechanism for failed notifications to ensure reliable delivery.

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 [Bug]: Budget Alerts Not Working for End User Budgets [1 pull requests, 1 participants]