Spend-Cap Guard

Your agent pays per call. What stops it paying forever? This tiny library does: set a daily cap per wallet + endpoint, and any call that would exceed it is blocked before the payment happens. Client-side only — no server, no account, no trust in us required.

How it works

RuleDetail
Priced at list priceEvery call counts at the endpoint's list price — even free-trial calls. Conservative on purpose: your budget math never depends on a trial being active.
Local ledgerSpend is tracked in ./spend-ledger.json on your machine, keyed by wallet + endpoint + UTC day. Nothing is sent anywhere.
Block before paycheck() runs before the paid call. Over cap → a clear SPEND CAP BLOCKED error with the exact remaining budget. No partial payments, ever.
ResetThe day bucket is UTC. Yesterday's spend never blocks today's calls.

JavaScript library

loading…

Raw: GET https://api.mekongtradeintel.com/clinic/guard?lang=js

Python library

loading…

Raw: GET https://api.mekongtradeintel.com/clinic/guard?lang=python

Zero-effort option

The code generator can emit any endpoint's client code with the guard already wired in — tick “Add spend-cap guard” or pass &guard=1 to GET /clinic/codegen. The generated snippet carries a DAILY_CAP_USD constant you set once.

Built by Mekong Trade Intelligence — pay-per-call APIs for AI agents, settled in USDC on Base. Related: 402 Clinic · code generator · buyer ratings.