Routeweiler¶
The neutral micropayment router for autonomous agents.
A single async HTTP client — await client.get(url) — that transparently handles
402 Payment Required across four payment rails. Your agent pays for data, compute,
and inference calls without knowing which rail the API uses.
import asyncio
from eth_account import Account
from routeweiler import Routeweiler, Funding
async def main():
signer = Account.from_key("0xYOUR_PRIVATE_KEY")
async with Routeweiler(funding=[Funding.base_usdc(wallet=signer)]) as client:
response = await client.get("https://api.example.com/data") # 402 handled silently
print(response.json())
asyncio.run(main())
Get started in 5 minutes GitHub
What Routeweiler does¶
When a server returns 402 Payment Required, Routeweiler:
- Parses the challenge — x402, L402, MPP-Tempo, or MPP-SPT wire format.
- Routes to the best rail using cost, policy, and sticky-session preferences.
- Signs and sends the payment header client-side — keys never leave your process.
- Enforces budgets — per-agent spend caps with Ed25519-signed draw receipts.
- Emits a trace — one structured SQLite event per call for audit and reconciliation.
Supported rails¶
| Rail | Protocol | Settlement |
|---|---|---|
| x402 | EVM signed transfer | On-chain USDC (Base, etc.) |
| L402 | BOLT-11 Lightning | Sats |
| MPP-Tempo | Tempo 0x76 transaction | PathUSD / USDC |
| MPP-SPT | Stripe Shared Payment Token | Fiat card |
Non-custodial by design¶
Keys stay in the caller's process. Routeweiler never holds funds, never proxies payments through a server, and never transmits private keys. This keeps it outside money-transmitter and CASP regulations. See the FAQ for details.