π Agent Unleashed
June 5, 2026 Β· View on GitHub
I gave an AI agent a hard-capped card and let it loose. It pays for paid API calls on its own β and stops when the money's gone.
What it buys is paid LLM inference it can't do itself (a regex, a SQL query, a git command) β behind someone else's API key. No human in the loop. No shared key. No crypto β the wallet is a hard-capped prepaid card (Stripe), not USDC.

β¦ βββββ¦βββββββ βββββββ¦βββββ
β ββ£ ββββ ββββ β β ββ£β β©βββ£ π
β©ββββββ© β©ββββββ ββββ© β©β© β©βββ
the x402 payment rail for AI agents
AGENT UNLEASHED β AI edition
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 1 β DISCOVER
task: "answer 6 dev questions I'd otherwise stop and google"
π found a paid AI tool via MCP: ai-answer (β¦/g/<id>)
a dev's LLM endpoint Β· pay-per-call (x402) Β· the seller's key, not mine
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 2 β BUDGET
π³ funding a hard-capped prepaid wallet (Stripe card β not crypto)β¦
agent wallet (LemonCake Pay Token): \$0.50 / daily cap \$5
β \$0.50 Γ· \$0.01/call = up to 50 inference calls
[ββββββββββββββββββ] \$0.50
policy: within cap β approved Β· it physically can't overspend
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 3 β PAY (autonomous Β· each answer is a paid LLM call Β· the owner gets paid each time)
β regex agent paid \$0.01 β π° owner earned \$0.0097 [ββββββββββββββββββ] \$0.49
β³ AI: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
β SQL agent paid \$0.01 β π° owner earned \$0.0097 [ββββββββββββββββββ] \$0.47
β³ AI: SELECT c.customer_name, SUM(o.order_total) AS total_revenue FROMβ¦
β git agent paid \$0.01 β π° owner earned \$0.0097 [ββββββββββββββββββ] \$0.45
β³ AI: git reset --soft HEAD~1
β¦
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phase 4 β RESULT
buyer: 6 AI calls Β· spent \$0.06 of the \$5 cap Β· hard-capped, can't run away
seller: π° your AI endpoint earned \$0.0582 β auto-collected, no invoice
at scale: \$0.01/call Γ 10,000 agent calls/day β \$97/day
no human Β· no shared key Β· no subscription Β· no crypto Β· you keep 97%
Why this is different
Most "agents pay for APIs" demos settle in USDC on-chain β the agent needs a crypto wallet.
This one doesn't. The agent spends a hard-capped prepaid card behind LemonCake's x402 gateway:
- x402-native β the API returns
402 + accepts[]; the agent pays and retries, no human. - Hard-capped β per-mint / daily / monthly limits, enforced server-side. The agent cannot overspend.
- Custody-free, fiat β Stripe Connect Direct Charge. No chain, no token, no wallet seed. The seller keeps 97%.
- Not free data β what's bought is real paid LLM inference (the seller's key/compute is the product).
So any developer with a Stripe account β not just crypto-native ones β can let agents pay per call.
Run it
You need a LemonCake Buyer Key scoped to your AI endpoint, with a saved card (issue one at /app β Pay Tokens, save a card at /agent/fund). The endpoint wraps an OpenAI-compatible chat API (e.g. OpenRouter) β your model key goes in the endpoint's upstream-auth field, never to the agent.
BK=bk_your_key EP=<shortId> MODEL=meta-llama/llama-3.3-70b-instruct node agent-ai.mjs
Options:
BASE=https://www.lemoncake.xyz # gateway
FUND_CENTS=50 # how much to fund this task (Stripe min \$0.50)
MODEL=meta-llama/llama-3.3-70b-instruct # any model the upstream serves
CALL_DELAY_MS=700 # pacing for a clean recording
MAX_CALLS=6 # keep the demo short
JWT=<existing pay token> # reuse a funded token instead of minting (no new charge)
The FX-data variant (
agent-unleashed.mjs) shows the same rail against a GET data API.
How it maps to LemonCake
| Demo step | LemonCake mechanic |
|---|---|
| discover a paid tool | x402 402 + accepts[] (buyUrl + mintUrl) |
| fund a capped wallet | POST /api/lc/agent/tokens β Stripe charge β Pay Token (JWT) |
| pay per call | POST /g/<shortId> with Authorization: Bearer <jwt> (seller's upstream key injected server-side) |
| can't overspend | per-mint / daily / monthly caps, server-enforced |
| owner earns | 97% to the seller per call, auto-collected (100% for the first 3,000) |
Monetize your own model/API
Put any HTTP API or LLM endpoint behind a pay-per-call x402 gateway in minutes β no code changes:
- Add your API at lemoncake.xyz/app, set a price, paste your upstream key (stays server-side).
- Share the gateway URL
/g/<shortId>. - Agents pay per call, you keep 97%, first 3,000 calls free.
β lemoncake.xyz Β· agent-payment-mcp on npm
License
MIT