Guide · Anthropic

How to get alerted before a surprise Anthropic (Claude API) bill

The fastest way to limit a surprise Anthropic bill is to find out the same day spend jumps, not when the invoice arrives. Here is how to get an alert in Slack or Discord when Anthropic costs spike, in about five minutes, for free.

Why the built-in limits aren't enough

The Anthropic Console lets you set spend limits for your organization and workspaces. Limits stop spend at a ceiling, but they don't tell you that today cost eight times yesterday. Agent loops, long-context retries and batch jobs can spike well before you hit a limit you set for normal months.

What you want is an anomaly alert: "today is 3× your normal day." That catches problems while they are still cheap. Keep the provider's hard limit as a backstop.

1. Create a key that can read costs

Create an admin key (it starts with sk-ant-admin) in the Console under Settings → Admin keys. Admin keys require an organization account and an admin role. Regular API keys cannot read cost reports.

2. Add billshock to a repo

npx billshock init

This writes billshock.yml and .github/workflows/billshock.yml, which runs every hour. Trim the config to what you need:

providers:
  anthropic:
    apiKey: ${ANTHROPIC_ADMIN_KEY}
rules:
  spikeMultiplier: 3
  spikeMinAmount: 5
  monthlyBudget: 300      # also alerts on the month-end projection
notify:
  discordWebhook: ${DISCORD_WEBHOOK_URL}

3. Add secrets and run it once

In your repo, go to Settings → Secrets and variables → Actions and add ANTHROPIC_ADMIN_KEY plus a Slack or Discord webhook URL. Then open the Actions tab and run the billshock workflow manually. The run summary shows today, yesterday, the 7-day average, month-to-date and the projected month total.

When something looks wrong, you get one message per anomaly:

ALERT anthropic: $52.51 spent on 2025-10-07, 6.1x the 7-day average of $8.60

No webhook? A run with a new alert fails, and GitHub emails you about the failed workflow.

Set it up in 5 minutes. npx billshock init creates the config and an hourly GitHub Actions workflow. Free and open source. Prefer a hosted version? Join the waitlist.

How it works

billshock reads GET /v1/organizations/cost_report with daily buckets across all workspaces. Each run compares yesterday and today-so-far against the trailing average and your caps. Sent alerts are remembered in the Actions cache so you're not pinged every hour. Your key stays in your repo's secrets and is only sent to Anthropic's API.

FAQ

How quickly will I be alerted?

Within an hour of the cost showing up in Anthropic's billing data. Billing data usually lags actual usage by a few hours, so expect same-day alerts rather than real-time ones.

Can I monitor other providers too?

Yes. billshock supports OpenAI and Vercel in the same config, plus a combined total budget.

Does billshock stop spending?

No. It only reads cost data and sends alerts. Use Anthropic's own limits to cap spend.