Pay-per-call AI risk analysis for any Base address. No account, no API key. An agent (or a person) sends an address, pays a few cents of USDC over x402, and gets back a clean, structured read on what that address is and whether it looks safe to deal with.
It is the check agents need before they transact, sold the way agents pay for things: per call, in stablecoin, on Base.
AI agents are starting to move money and call contracts onchain. Before an agent transacts with an address, it wants to know who it is dealing with. Today that means stitching together an explorer, a few APIs, and some heuristics. BaseLens turns it into one paid call.
This is infrastructure for the agent economy, not a chatbot. The output is structured JSON another agent can act on, and the payment rail is x402, which is how agents are starting to pay each other.
- A caller hits
POST /api/analyzewith{ "address": "0x..." }. - x402 middleware returns HTTP 402 with a price and a pay-to address.
- The caller's wallet (or an x402-aware agent) pays the USDC on Base and replays the request.
- BaseLens pulls the address's onchain context (balance, contract status, recent transactions, counterparties) and runs it through Claude.
- It returns
activitySummary,riskLevel,riskFactors,notableCounterparties, and a one-linerecommendation.
POST /api/analyze
{ "address": "0x4200000000000000000000000000000000000006" }
->
{
"activitySummary": "...",
"riskLevel": "low" | "medium" | "high" | "unknown",
"riskFactors": ["..."],
"notableCounterparties": ["..."],
"recommendation": "...",
"context": { "balanceEth": "...", "txCount": 12, "analyzedTxs": 50, "historyAvailable": true },
"model": "claude-sonnet-4-6"
}
- Next.js (App Router) for the API + a thin landing page.
- x402 (
x402-nextseller side,x402-fetchbuyer side,@coinbase/x402mainnet facilitator) for the pay-per-call rail on Base. - Coinbase CDP SDK (
@coinbase/cdp-sdk) for an optional server wallet so the service can act onchain. - viem for onchain reads, Etherscan v2 (unified, covers Base via chainid) for transaction history.
- Anthropic for the analysis.
You can run the whole 402 flow on Base Sepolia with test money, so it costs nothing to develop.
npm installcp .env.example .env.localand fill it in:X402_PAY_TO_ADDRESS— your receiving wallet.X402_NETWORK=base-sepolia(free testnet) for now.ANTHROPIC_API_KEY— for the analysis.ETHERSCAN_API_KEY— optional. Without it you still get balance + contract-status analysis, just no tx history.
npm run typecheckto confirm the build is clean.npm run devand open http://localhost:3000.- In another terminal, run the buyer-agent demo: put a throwaway
DEMO_PRIVATE_KEY(funded from the Base Sepolia faucet) in.env.local, thennpm run demo. It pays your endpoint and prints the analysis. That is the agent-paying-agent demo.
On testnet, x402 defaults to the free x402.org facilitator, so no real money moves.
Set X402_NETWORK=base and add your CDP keys. On mainnet the middleware uses Coinbase's CDP facilitator (fee-free USDC settlement, with KYT/OFAC screening on each payment). You only need a receiving address to get paid.
These need a person and must never be done by an automated agent:
- Create a Coinbase Developer Platform account and generate
CDP_API_KEY_ID,CDP_API_KEY_SECRET, and theCDP_WALLET_SECRET. Keep them in.env.local, never in code or git. - Fund any mainnet agent wallet with real USDC (plus a little ETH for gas, or use a CDP smart account with a paymaster to go gasless).
This is a v0. It is a real, working pay-per-call service, but the analysis is only as good as the onchain context it pulls. The roadmap to make it defensible:
- Token transfers + ERC-20/721 context, not just native txs.
- Known-contract and known-scam labels, so risk calls are grounded in more than heuristics.
- Register in the x402 discovery bazaar (
listX402DiscoveryResources/searchX402Resourcesin the CDP SDK) so other agents can find and call it automatically. - A small reputation cache so repeat lookups are cheap.
It is a risk read, not financial advice.
Three things at once, off one repo:
- Useful product: a real x402 service other agents can call.
- Builder Rewards: open-source work on a public Base repo plus real Base onchain activity is exactly what Coinbase/Base Builder Rewards scores (weekly ETH at builderscore.xyz / talent.app). Requires a Basename + Builder Score 40+ + the Human Checkmark, all one-time human setup.
- Hackathon submission: a clean x402 + Base + AI-agent build, ready for the next online ETHGlobal / Base / agent bounty (ETHOnline 2026 is the headline target).