Check for existing issues
What happened?
Email budget alerts do not trigger for virtual keys when soft_budget threshold is crossed, despite having all required configuration in place. I want to basically send email alerts when a user's usage crosses a threshold. Please let me know if this feature exists as mentioned in documentation and what config is needed for that to work.
LiteLLM Version: v1.80.11-stable.1 (also tested v1.80.15-stable)
Deployment: Kubernetes (GKE)
Database: PostgreSQL
Email Provider: SMTP
Python Version: 3.13
When a virtual key's spend crosses soft_budget threshold, an email alert should be sent via SMTP according to the configuration.
According to release notes, v1.80.11 introduced "Email Budget Alerts - Send email notifications when budgets are reached."
No email alert is sent when soft_budget threshold is crossed, even though:
Spend is at 101% of soft_budget (threshold crossed)
SMTP configuration is verified working (manual test successful)
All required configuration present
Budget table properly configured and linked
Steps to Reproduce
litellm_settings:
callbacks: ["smtp_email"]
general_settings:
alerting: ["email"]
alerting_threshold: 0.8
alert_emails: ["test@example.com"]
smtp_host: "smtp.example.com"
smtp_port: 25
smtp_sender_email: "alerts@example.com"
smtp_use_tls: false
sql
budget_id: test-budget-001
soft_budget: 0.001
max_budget: 0.002
sql
key_alias: test-key
budget_id: test-budget-001 -- Linked to budget
spend: 0.00101 -- 101% of soft_budget
soft_budget_cooldown: false
sql
user_id: test-user
user_email: test@example.com
Configure SMTP settings in ConfigMap
Create budget in LiteLLM_BudgetTable with soft_budget: 0.001
Create virtual key linked to budget via budget_id
Make API requests until spend crosses soft_budget (100%)
Observe: No email alert sent
Relevant log output
Email alert functions exist:
base_email.py: send_soft_budget_alert_email()
base_email.py: budget_alerts() with type="soft_budget" support
Check function exists and is called:
auth_checks.py: _virtual_key_soft_budget_check()
Called from user_api_key_auth.py during authentication
Uses condition: if valid_token.soft_budget and valid_token.spend >= valid_token.soft_budget
Root cause:
Budget table is loaded for end users, tags, and team members
Budget table is NOT loaded for virtual keys (LiteLLM_VerificationToken)
valid_token.litellm_budget_table remains None
valid_token.soft_budget is never populated from database
Check condition fails, alert never triggers
What part of LiteLLM is this about?
No response
What LiteLLM version are you on ?
v1.80.11-stable.1
Twitter / LinkedIn details
No response
Check for existing issues
What happened?
Email budget alerts do not trigger for virtual keys when soft_budget threshold is crossed, despite having all required configuration in place. I want to basically send email alerts when a user's usage crosses a threshold. Please let me know if this feature exists as mentioned in documentation and what config is needed for that to work.
LiteLLM Version: v1.80.11-stable.1 (also tested v1.80.15-stable)
Deployment: Kubernetes (GKE)
Database: PostgreSQL
Email Provider: SMTP
Python Version: 3.13
When a virtual key's spend crosses soft_budget threshold, an email alert should be sent via SMTP according to the configuration.
According to release notes, v1.80.11 introduced "Email Budget Alerts - Send email notifications when budgets are reached."
No email alert is sent when soft_budget threshold is crossed, even though:
Spend is at 101% of soft_budget (threshold crossed)
SMTP configuration is verified working (manual test successful)
All required configuration present
Budget table properly configured and linked
Steps to Reproduce
litellm_settings:
callbacks: ["smtp_email"]
general_settings:
alerting: ["email"]
alerting_threshold: 0.8
alert_emails: ["test@example.com"]
smtp_host: "smtp.example.com"
smtp_port: 25
smtp_sender_email: "alerts@example.com"
smtp_use_tls: false
sql
budget_id: test-budget-001
soft_budget: 0.001
max_budget: 0.002
sql
key_alias: test-key
budget_id: test-budget-001 -- Linked to budget
spend: 0.00101 -- 101% of soft_budget
soft_budget_cooldown: false
sql
user_id: test-user
user_email: test@example.com
Configure SMTP settings in ConfigMap
Create budget in LiteLLM_BudgetTable with soft_budget: 0.001
Create virtual key linked to budget via budget_id
Make API requests until spend crosses soft_budget (100%)
Observe: No email alert sent
Relevant log output
What part of LiteLLM is this about?
No response
What LiteLLM version are you on ?
v1.80.11-stable.1
Twitter / LinkedIn details
No response