Spend Guard

v0.2.0
io.github.vulinh1704/spend-guard Checked 2 days ago Published 1 month ago

Budgets, payee allowlists, price-spike checks and human approval for agents paying x402 paywalls

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

pay_and_fetch Fetch, paying the paywall if there is one

Fetch a URL and, if it answers HTTP 402 (an x402 paywall), pay it through the user's Spend Guard. The payment goes out only if it fits the user's budget, goes to an address the service is known to use and is not a price spike; larger payments and unknown services wait for the user to approve them on the dashboard. Returns the HTTP status, what was paid (amount, payee, transaction) and the response body. Redirects are not followed. A refused payment is final: tell the user what was refused and why, and do not try to pay another way.

ParameterTypeDescription
url *stringThe http(s) URL to fetch.
bodystringRequest body, for POST, PUT and PATCH.
headersobjectExtra request headers, e.g. {"accept": "application/json"}. Payment, cookie and origin headers are set by the guard or dropped.
methodstringDefault GET.

spending_status Spending so far

What has been spent today against the user's daily budget, payments waiting for the user's approval, and the latest payments with their outcome (paid, denied, declined or failed) and every reason. Check it before a series of paid calls.

ParameterTypeDescription
limitintegerHow many recent payments to list. Default 10.

spending_policy Spending rules

The rules the guard enforces: the networks it can pay on, the daily and per-payment limits, the amount above which the user approves, the price-spike ratio, and the known services with the addresses they may be paid at. Read only: only the user can change them.