spend-cap
2026-03-08github →
stop runaway AI agent costs before they happen.
spend-cap patches Node.js fetch to intercept all AI API calls (OpenAI, Anthropic, Gemini) and enforce a hard daily spending limit. when the cap is hit, requests are blocked — no $800 surprise bills.
how it works
one line to add to any Node.js app:
SPEND_CAP=5 node --import @safetnsr/spend-cap/register app.js
tracks spend in a local state file. resets daily. zero dependencies. no cloud required.
why
Google Gemini has no spending limit. OpenAI billing alerts are email-only. Anthropic rate limits are server-side. none of these stop a runaway agent loop at 3am.
spend-cap is the client-side kill switch.
pair with
- vet — audit your AI coding workflow before and after sessions
- pinch — track cumulative AI costs over time