πŸ‹ 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.

demo

  ╦  ╔═╗╔╦╗╔═╗╔╗╔  ╔═╗╔═╗╦╔═╔═╗
  β•‘  β•‘β•£ β•‘β•‘β•‘β•‘ β•‘β•‘β•‘β•‘  β•‘  ╠═╣╠╩╗║╣   πŸ‹
  β•©β•β•β•šβ•β•β•© β•©β•šβ•β•β•β•šβ•  β•šβ•β•β•© β•©β•© β•©β•šβ•β•
  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 stepLemonCake mechanic
discover a paid toolx402 402 + accepts[] (buyUrl + mintUrl)
fund a capped walletPOST /api/lc/agent/tokens β†’ Stripe charge β†’ Pay Token (JWT)
pay per callPOST /g/<shortId> with Authorization: Bearer <jwt> (seller's upstream key injected server-side)
can't overspendper-mint / daily / monthly caps, server-enforced
owner earns97% 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:

  1. Add your API at lemoncake.xyz/app, set a price, paste your upstream key (stays server-side).
  2. Share the gateway URL /g/<shortId>.
  3. Agents pay per call, you keep 97%, first 3,000 calls free.

β†’ lemoncake.xyz Β· agent-payment-mcp on npm

License

MIT