Documentation.

Everything needed to run Spikewatch: the hosted service when it launches, and the self-hosted engine that works today.

Get started

There are two ways to run Spikewatch, and they use the same detection code:

Hosted serviceSelf-hosted
StatusWaitlist openWorks today
What you doReserve the founding price; at launch you paste a read-only key and pick Slack or emailFork the repo, add two secrets, enable the workflow
Where your key livesStored encrypted; used only to read usage reportsGitHub encrypted secrets, inside your own repo
Cost$15/month founding price, locked while foundingFree - you run it on your own GitHub Actions minutes

The hosted service charges nobody before the first integration is live. Join the waitlist to hold the founding price either way.

The read-only key

Spikewatch never asks for your regular API key. It uses an Anthropic Admin API key, which is a separate credential type scoped to organization administration - in this case, to reading usage and cost reports only.

  • It can: read hourly token usage and cost data for your organization.
  • It cannot: create messages, spend money, read or write prompts, manage members, or change any setting.

Create one in the Anthropic Console under your organization's Admin API keys. If it is ever exposed, revoke it in the same place - because it is read-only, a leaked key can reveal usage totals but can never run up a bill.

Configuration reference

Four parameters define when you get paged. The defaults are sane for most small teams; every one is tunable, in the hosted service and as environment variables when self-hosting.

ParameterEnv varDefaultWhat it doesTune it when
ThresholdMULT3xAn hour must reach this multiple of its baseline to alertRaise toward 4-5x if normal swings trip it; lower toward 2x if you want earlier warnings
FloorFLOOR$5/hrSpend below this in an hour can never alert, whatever the ratioRaise it if small absolute spend is never worth a message to you
BaselineMODEsameHourHow "usual" is computed: median of the same hour over 14 days, or median of the trailing 24 hours (trailing24)Switch to trailing24 if your usage has no daily rhythm or is brand new
CooldownCOOLDOWN_H6 hoursAfter an alert, repeats are suppressed for this long (and counted)Shorten if you want ongoing confirmation during an incident; lengthen if one message is enough

The rule reads as one sentence: "If spend in any hour reaches 3x your usual level for that hour (median of the same hour over the last 14 days), and is at least $5, send one message. The same alert is not repeated for 6 hours." The live checker prints this sentence for whatever values you set.

Alert format

One message per spike, to your Slack channel via incoming webhook (email at launch):

Spikewatch: AI spend is at 3.4x your usual level (threshold 3x).
Hour starting 2026-10-16 04:00 UTC: $41.00. Usual: $12.00.
  • Times are UTC, matching how provider usage data is bucketed. The example above is 9:30am IST.
  • "Usual" is the baseline value the hour was compared against, in dollars, at list prices.
  • Suppressed repeats during the cooldown window are counted in the job log, not sent.

How tokens become dollars

Anthropic's usage report returns token counts per model per hour. The engine estimates dollars using list prices per million tokens:

Model familyInput / 1MOutput / 1M
Opus$15$75
Sonnet$3$15
Haiku$1$5

Cached tokens are priced at their discounted rates: cache writes at 1.25x (5-minute) or 2x (1-hour) the input price, cache reads at 0.1x. Unknown model names fall back to the Sonnet rates. These figures are estimates for spike detection, not billing - if you have negotiated pricing, edit the price table in engine/detect.mjs (it is one small object) and the same code keeps working.

Self-host the engine

The whole system is three small files in the repo: engine/detect.mjs (detection), engine/spikewatch.mjs (the hourly job), and a GitHub Actions workflow that runs them. To run it yourself:

  1. Fork or clone shantanupatil-debug/spikewatch into a private repo of your own.
  2. Create a read-only Admin API key in the Anthropic Console (see The read-only key).
  3. Create a Slack incoming webhook for the channel that should get alerts.
  4. Add two repository secrets (Settings → Secrets and variables → Actions):
ANTHROPIC_ADMIN_KEY=sk-ant-admin-...   # read-only usage key
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
  1. Enable the workflow. It is scheduled for 7 minutes past every hour (cron: "7 * * * *") and can also be run manually from the Actions tab. Tune the rule with the optional secrets MULT, FLOOR, MODE, and COOLDOWN_H.

Each run prints a one-line summary (checked 360 hours, 1 new alert(s)) in the Actions log, so you can confirm it is alive without waiting for a spike. GitHub's free tier covers the minutes for a job this small.

Testing

The workflow runs engine/test.mjs before every scheduled check. If the tests fail, the detection step does not run - a broken alerter fails loudly instead of silently. The suite asserts, among other things:

  • A 4.1x spike in 15 days of data produces exactly one alert, on the right hour.
  • A second spike inside the cooldown is suppressed, not sent.
  • Spend scaled down to cents produces zero alerts (the floor works).
  • A usage-report response converts to the expected dollar figure.

You can exercise the same code interactively, on your own data, in the live checker - it imports the engine file straight from this repo and runs it in your browser.

Honest limits

  • Hourly is the floor, not the ceiling. Provider usage APIs publish on a delay and rate-limit reads. Hourly is the fastest cadence that stays honest about that.
  • Dollars are estimates. Detection uses list prices; invoices include your actual rates, credits, and taxes. The shape of a spike is unaffected.
  • Anthropic only, today. Other providers join when their usage data access is confirmed working - not before.
  • It warns; it does not act. Spikewatch never touches your service. If you need automatic shutoffs, pair it with provider-side spend limits.

Stuck?

The repo is the support doc.

Everything described on this page is visible in the source. Open an issue on GitHub if something doesn't match what you read here.