Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Verifieddanny/BurnGuard/llms.txt

Use this file to discover all available pages before exploring further.

BurnGuard can post a message to a Slack channel or Discord server the moment your AI spend crosses a budget threshold. This lets your team react before costs spiral — whether that means a Slack ping to an on-call engineer, a Discord notification in a shared dev server, or both at once.

How Alerts Work

After every successful request, BurnGuard calls alerter.Check() with the current total spend and your configured budget limit. The alerter compares the spend ratio against each configured threshold and fires any that have not yet been triggered in this session. Key behaviours to understand before you configure:
  • Each threshold fires once per proxy session. The triggered map in memory tracks which thresholds have already fired. Restarting BurnGuard resets the map.
  • Alert delivery is non-blocking. The HTTP POST to your webhook runs in a background goroutine so your application never waits for an alert to be delivered.
  • Slack and Discord can both be active at the same time. Configure either, both, or neither — BurnGuard skips any webhook whose URL is an empty string.
  • Alert message format: BurnGuard: Budget 80% used ($40.0000 of $50.0000)

Setting Up Slack

1

Create an incoming webhook

Open your Slack workspace and navigate to Apps → Manage → Incoming Webhooks (or visit api.slack.com/messaging/webhooks directly). Click Add New Webhook to Workspace, choose the channel where alerts should appear, and click Allow.
2

Copy the webhook URL

After authorizing, Slack shows a webhook URL in the format:
https://hooks.slack.com/services/T.../B.../XXXXXXXXXXXX
Copy the full URL including all three path segments.
3

Add the webhook to burnguard.yaml

Open your burnguard.yaml and set alerts.slack_webhook:
alerts:
  slack_webhook: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
4

Restart the proxy

burnguard start
BurnGuard reads the config file at startup. The new webhook takes effect immediately on restart.

Setting Up Discord

1

Open your server's webhook settings

In your Discord server, go to Server Settings → Integrations → Webhooks and click New Webhook.
2

Configure and copy the webhook URL

Give the webhook a name (for example, “BurnGuard”), choose the channel where alerts should be posted, and click Copy Webhook URL. The URL will look like:
https://discord.com/api/webhooks/1234567890/XXXXXXXXXXXXXXXXXXXX
3

Add the webhook to burnguard.yaml

Open your burnguard.yaml and set alerts.discord_webhook:
alerts:
  discord_webhook: "https://discord.com/api/webhooks/YOUR/WEBHOOK/URL"
4

Restart the proxy

burnguard start
If slack_webhook or discord_webhook is an empty string (or missing from your config), BurnGuard skips that destination entirely — no error is logged and no placeholder message is sent. You can safely configure only one of the two.

Configuring Thresholds

The alerts.thresholds list controls which spend ratios trigger an alert. Each value is a decimal fraction of your total budget (0.5 = 50%, 1.0 = 100%). The default thresholds generated by burnguard init are:
alerts:
  thresholds:
    - 0.5   # alert at 50%
    - 0.8   # alert at 80%
    - 1.0   # alert at 100%
To use different thresholds, replace the list in your burnguard.yaml:
alerts:
  slack_webhook: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
  thresholds:
    - 0.25  # alert at 25%
    - 0.75  # alert at 75%
    - 1.0   # alert at 100%
You can add as many thresholds as you like. Duplicate values are deduplicated by the in-memory trigger map — a threshold will only fire once regardless of how many requests push spend past it in the same session.
Add a low threshold like 0.25 when running experiments or one-off scripts that call expensive models. An early warning at 25% gives you time to investigate before you hit 80% or 100%, especially for long-running batch jobs where the spending rate is hard to predict up front.
Thresholds are stored in memory and reset every time the proxy restarts. If BurnGuard restarts and your current spend is already above a threshold (for example, you are at 85% and the 80% threshold has already fired in a previous session), the alerter will fire that threshold again on the first request after restart. Plan accordingly if you restart the proxy near the end of a billing period or when spend is already high.

Build docs developers (and LLMs) love