@ruponchain/modu
v0.1.13
Published
CLI to monetize any HTTP API with x402 micropayments on Algorand
Maintainers
Readme
@ruponchain/modu
Turn any existing HTTP API endpoint into a pay-per-request endpoint settled with x402 on Algorand — with zero payment code written by the developer.
Quick Install
Install globally:
npm install -g @ruponchain/moduOr run instantly without installing:
npx @ruponchain/modu --helpOnce installed, the modu command is available everywhere in your terminal:
modu --helpQuick Start
1. Configure Authentication & Payout Wallet
modu configOpens your browser to authorize your CLI session, then prompts for your Algorand payout wallet address where all endpoint micropayments settle.
2. Monetize Any API Endpoint
modu registerOr pass options directly:
modu register --url https://httpbin.org/get --price 0.02 --asset USDC --path my-apiOutput:
⚡ Endpoint Registered Successfully!
Endpoint ID: 07ec880f
Proxy URL: https://modu-proxy.onrender.com/p/f21408
Origin URL: https://httpbin.org/get
Price: 0.02 USDC
Payout To: YAVQWCPKM6D4HR63K7GYTR5AFR727RCA3VNWSMSJ7VTUJHNRRHEIIJJP4A
⚡ Pay via browser:
modu get https://modu-proxy.onrender.com/p/f21408
💡 Tip: AI agents can also pay this endpoint automatically via MCP.
Run `modu mcp:serve` to connect it to Claude Desktop or Claude Code.3. Call & Pay with modu get
modu get https://modu-proxy.onrender.com/p/f21408When challenged with HTTP 402, modu automatically opens a browser page to connect and sign via Lute wallet, then retrieves the paid 200 OK response.
The x402 Micropayment Protocol
When consumers call your proxy:
Unpaid Request (
HTTP 402):curl -i https://modu-proxy.onrender.com/p/f21408Returns an
HTTP 402 Payment Requiredchallenge containing recipient address, price, and a one-time cryptographic nonce.Consumer Pays on Algorand: Consumer transfers
0.02 USDCon Algorand testnet with transaction notemodu:<nonce>.Paid Request (
HTTP 200):curl -i -H "X-PAYMENT-TXID: <txid>" https://modu-proxy.onrender.com/p/f21408The edge proxy queries the Algorand indexer, verifies the payment, prevents replays, settles revenue into your account, and streams back the origin API response with the
X-PAYMENT-RESPONSEsettlement receipt.
CLI Command Reference
| Command | Description |
| :--- | :--- |
| modu config [address] | Configure authentication and Algorand payout destination (--address, --relogin) |
| modu register [options] | Monetize an origin endpoint (--url, --price, --asset, --path) or interactive wizard |
| modu get <url> / modu call <url> | Call an x402 endpoint with automated browser payment via Lute wallet |
| modu list | List all registered endpoints, today's volume, and revenue |
| modu stats <endpointId> | View detailed revenue summary, daily volume, and top payers |
| modu logs <endpointId> [--follow] | View recent request logs or stream live traffic (-f, -n <limit>) |
| modu revoke <endpointId> | Immediately revoke an endpoint (HTTP 410 Gone) |
| modu wallet create | Generate a fresh Algorand keypair locally (mnemonic shown once) |
| modu wallet connect <address> | Set your payout Algorand wallet address |
License
MIT (c) Rupam Ghosh
