Repository navigation
Spend limits now hold against x402 v2 servers
The CabalSpy API speaks x402 v2. Earlier versions only read the v1 locations, which meant:
- The price was unreadable, so
max_spend_per_callwas skipped. The price is now read from thePAYMENT-REQUIREDheader (v1 body as fallback), taking the highest amount across offered networks. - No payment was counted, so
max_spend_totalnever tripped: v2 receipts carry no amount. The checked price is now recorded, andPAYMENT-RESPONSEis read beforeX-PAYMENT-RESPONSE.
Behaviour change
A 402 without a readable price is now refused with SpendLimitError (kind == "unpriced") instead of paid blind. It is only allowed when both limits are float("inf").
Also
- New export:
read_price(response).price_of(body)is kept and now takes the highest offered amount. - A pytest suite (16 checks) now runs in the publish workflow before anything is built.
- README: testnet section corrected —
api.cabalspy.xyztakes mainnet payments only.
🤖 Generated with Claude Code