Skip to main content

Overview

LiteLLM Proxy provides comprehensive budget tracking and alerting capabilities:
  • Budget Enforcement: Hard limits to prevent overspending
  • Soft Budgets: Warnings before hitting limits
  • Webhook Alerts: Real-time notifications
  • Slack Integration: Team notifications
  • Spend Tracking: Monitor usage across keys, users, and teams

Budget Types

Global Budget

Set a budget for the entire proxy:
config.yaml
When the global budget is exceeded, all requests are rejected:

Key Budget

Set budgets per virtual key:

Team Budget

Set budgets for teams:

User Budget

Set budgets per user:

Soft Budgets (Alerts)

Soft budgets trigger alerts without blocking requests:
1

Set Soft Budget

Configure soft budget threshold (80% of max budget)
2

Monitor Usage

Proxy tracks spending in real-time
3

Receive Alert

Webhook/Slack notification when soft budget is exceeded
4

Take Action

Increase budget or optimize usage before hitting hard limit

Slack Alerts

Configure Slack notifications for budget alerts:

Setup

1

Create Slack Webhook

  1. Go to https://api.slack.com/apps
  2. Create a new app
  3. Enable Incoming Webhooks
  4. Create a webhook URL
2

Configure Proxy

Add Slack settings to your config:
config.yaml
3

Set Environment Variable

4

Restart Proxy

Alert Example

When a budget threshold is reached, Slack receives:

Webhook Alerts

Send budget alerts to custom webhooks:
config.yaml
Webhook payload:

Email Alerts

Configure email notifications:
config.yaml
Required environment variables:

Budget Reset Schedule

Budgets automatically reset based on the configured duration:

Manual Budget Reset

Reset a key’s budget manually:

Spend Tracking

View Key Spend

Response:

View All Keys Spend

View Team Spend

View User Spend

Projected Spend Alerts

Alert based on projected monthly spend:
config.yaml
If current usage trends suggest exceeding budget, alerts are sent proactively.

Advanced Alerting

Multi-Channel Alerts

Send to multiple channels:
config.yaml

Team-Specific Alerts

Configure different alert settings per team:
config.yaml

Custom Alert Thresholds

config.yaml
Alerts are sent at 50%, 75%, 90%, and 100% of budget.

Monitoring Dashboard

Admin UI

Access the admin dashboard at http://localhost:4000/ui:
  • Overview: Total spend across all keys
  • Keys: Individual key spend and budgets
  • Teams: Team-level spend tracking
  • Users: Per-user spend analysis
  • Charts: Spend trends over time

Prometheus Metrics

Export budget metrics to Prometheus:
config.yaml
Metrics available:
  • litellm_spend_total - Total spend
  • litellm_key_spend - Per-key spend
  • litellm_team_spend - Per-team spend
  • litellm_budget_remaining - Remaining budget
Query in Prometheus:

Best Practices

1. Set Conservative Budgets

Start with lower budgets and increase as needed:

2. Use Soft Budgets

Always set soft budgets for early warnings:

3. Monitor Regularly

Check spend daily or weekly:

4. Team Budgets

Use team budgets for organizational cost allocation:

5. Metadata for Cost Tracking

Use metadata to track costs by project:

Troubleshooting

Alerts Not Firing

Check configuration:

Incorrect Spend Tracking

Verify database is configured:
config.yaml

Budget Not Resetting

Check budget reset schedule:

Next Steps

Virtual Keys

Learn about key management

Configuration

Advanced configuration options

Docker Deployment

Deploy in production

Quick Start

Get started guide