DEV Community

roblambert9
roblambert9

Posted on

Monetize any Python function with one decorator

https://github.com/roblambert9/nano-empire-tollbooth

Author here. One decorator:

@monetize(price_usd=0.01)
def summarize(text): ...
Enter fullscreen mode Exit fullscreen mode

pip install nano-empire-tollbooth

100 calls free. $19/mo Pro. MIT licensed. Your own Stripe.
No platform cut. No wallet. Self-hosted.

Paper mode simulates the full x402 loop (402 → pay → receipt).
Live payments enabled, capped at $1 with operator approval.

$0.00 collected so far. 537 PyPI downloads/week.
Looking for the first user who wants to shape this.

Honest feedback wanted on two things:
(1) Is a decorator the right seam, or should metering live
at the framework/middleware layer?
(2) For those building agent tools — would you pay per-call,
or is flat-rate the only thing that flies?

Top comments (0)