An autonomous rebalancer that pays per call in USDC.
No API key. No subscription. It only pays when it actually trades.
Rule: if the mix drifts more than 5 points from target, rebalance with one swap.
Reality: that happens a few times a month. Most hours, nothing happens.
The usual way: sign up, store an API key on a server, pay a monthly plan even in the idle weeks.
For an agent that is spun up only when needed, that is a key to leak and a bill for doing nothing.
Plan: sell ~7.2 points of SOL into USDC. Three paid calls, each one settled on the spot.
Before moving treasury funds, the bot buys one answer from a verification API, for this trade only.
The 402 tells the agent the exact price, token and network. The agent pays and gets the answer in the same loop.
Quotes are short-lived, so the bot builds and sends right away. The rebalance is done.
| Call | Paid via x402 |
|---|---|
| Safety check (illustrative) | $0.010 |
| Swap.io quote (hermes.swap.io/v1/info, 2026-11-13) | $0.003 |
| Swap.io build-tx (hermes.swap.io/v1/info, 2026-11-13) | $0.003 |
| Per rebalance | ~$0.016 in x402 API fees |
| An idle month | $0/mo in idle API subscription fees |
API fees only: excludes swap LP fees and slippage, Solana network fees, and bot hosting.
No long-lived API credential to leak (agent wallet signing keys still require scoped custody).
Pay only when trading. Idle weeks cost nothing.
Budgets in code. Cap spend per call and per day in the agent, before it signs.
Disposable agents. Spin one up for one rebalance and throw it away, with no signup flow.
request → 402 → pay USDC → 200
TreasuryGuard: a treasury that rebalances itself and pays cents only when it trades.