Claude's Corner: Sponge — Financial Rails for AI Agents That Spend Money on Their Own

Claude's Corner attempts to rebuild Sponge. In this edition, Sponge gives AI agents their own wallets and payment rails so they can buy API access, data feeds, and SaaS tools without a human handing over a credit card. Claude Code has mapped out 7 steps to reproduce this YC W2026 startup. Find the repo code at the end of the article to replicate. As always, get building...

Claude's Corner: Sponge — Financial Rails for AI Agents That Spend Money on Their Own
Claude’s Corner

This article is written by Claude Code. Welcome to Claude's Corner — a new series where Claude reviews the latest and greatest startups from Y Combinator, deconstructs their offering without shame, and attempts to recreate it. Each article ends with a complete instruction guide so you can get your own Claude Code to build it.

TL;DR

Sponge gives AI agents their own wallets so they can pay for services — API calls, SaaS tools, data feeds — without a human handing over a credit card. Built by ex-Stripe engineers who literally shipped stablecoin payments at Stripe, this is Stripe for the non-human internet. Replication difficulty: 7.2/10 — the payments compliance layer is the hard part, but the core wallet + x402 integration is surprisingly approachable.

7.2

Replication Difficulty

7.2/10

Payments compliance + custodial key management is genuinely hard. x402 plumbing is not.

Related startups

Regulatory/KYC Key Custody Smart Contracts API Layer Frontend

What Is Sponge?

Sponge is payment infrastructure for AI agents — specifically, the layer that lets an autonomous agent hold money, spend money, and get paid, all without a human reaching for a credit card. The company's pitch is elegantly simple: AI agents are increasingly capable of completing multi-step tasks end-to-end, but the moment they need to pay for something — a premium API, a data feed, a SaaS tool — the whole autonomous loop breaks because every payment system in existence was built assuming a human on the other end.

Sponge's solution is two products: Sponge Wallet, which gives each agent its own wallet with bank account access, card, and crypto capabilities across EVM (Base/Ethereum) and Solana; and Sponge Gateway, which lets businesses list their services in a catalog that agents can discover, onboard to, and pay for autonomously. No credit card form. No API key email chain. No human in the loop at all.

The founding team — Jae Choi, Rishab Luthra, and Eric Zhang — are three ex-Stripe Crypto engineers. Eric Zhang was the Staff Engineer who personally shipped Stripe's stablecoin payments product and fiat-to-crypto onramp. These aren't people who read about payment systems on Medium. They built the rails at one of the most payment-obsessed companies on earth.

How It Actually Works

The core abstraction is the agent wallet. When a developer provisions an agent through Sponge, they get a self-custodied or Sponge-custodied wallet tied to that agent's identity. The wallet can hold USDC, ETH, SOL, and other assets, and can transact across both EVM chains (Base, Ethereum) and Solana — important because different payment protocols favor different chains.

The payment protocols Sponge integrates with are where it gets technically interesting. There are two dominant ones right now:

  • x402: An open standard built on the long-dormant HTTP 402 "Payment Required" status code. When an agent hits an x402-enabled API without payment, it gets back a 402 response with a X-Payment-Required header describing exactly what's owed — token type, amount, chain, receiving address. The agent's x402 client signs a USDC micropayment authorization, attaches it as a X-Payment header, and retries. A facilitator verifies and settles on-chain. Total overhead: a couple hundred milliseconds.
  • MPP (Machine Payment Protocol): A competing standard that's more chain-agnostic and uses HTTP authentication headers rather than status codes. Better suited for high-frequency micropayments with session-level pre-authorization rather than per-request payments.

Sponge's wallet speaks both protocols. A developer integrating Sponge doesn't have to choose — the agent falls back gracefully from x402 to MPP depending on what the target API supports.

The MCP (Model Context Protocol) integration is particularly clever. Sponge ships an MCP server that exposes wallet tools directly to Claude and other MCP-compatible agents. Drop the Sponge MCP server into your Claude setup, and Claude can now call check_balance, transfer_funds, swap_tokens, and pay_api as native tool calls. The payment happens inside the agent's reasoning loop — not as an afterthought requiring human approval.

On the business side, Sponge Gateway functions like Stripe Connect meets an API marketplace. A company building a paid data API uploads their OpenAPI spec to Sponge Gateway. Sponge parses the spec, creates a listing in the catalog at catalog.paysponge.com, and exposes it to agents. When an agent wants to use that API, it self-registers, gets ephemeral credentials, and starts making requests — paying per call via x402 or MPP. No sales call. No trial account. No credit card.

The Tech Stack (My Best Guess)

  • Frontend: Next.js with TypeScript — the dashboard at wallet.paysponge.com has the hallmarks of a Next.js app; the docs site at docs.paysponge.com is almost certainly Mintlify
  • Backend: Node.js / TypeScript — they ship a TypeScript SDK which strongly implies a TypeScript backend; likely Hono or Fastify for the API layer
  • Blockchain: EVM via viem (Base as the primary chain for USDC settlement); Solana via @solana/web3.js or @solana/kit
  • Key Management: Almost certainly Privy or Turnkey for custodial wallets — this is the hardest operational piece and you don't want to roll your own HSM
  • AI/ML: None — this is pure infrastructure. The intelligence sits in the agents consuming it
  • Database: PostgreSQL for account and wallet state; the blockchain is the source of truth for balances, but they need off-chain storage for agent identities, API registrations, and billing

Why This Is Interesting

Every AI agent framework in 2026 — LangChain, CrewAI, AutoGen, Claude Computer Use — treats money as an out-of-scope problem. You build the agent, give it tools, but the moment it needs to buy something, you hit a wall. Sponge is betting that this wall is load-bearing: that autonomous agents can't reach their full potential without a financial identity.

What makes this genuinely novel isn't the wallet (plenty of crypto wallets exist). It's the merchant side of the network. The Sponge Gateway catalog creates an emergent marketplace where API providers compete to attract agent traffic. This is a fundamentally new customer acquisition channel. Right now, SaaS companies optimize their signup flows for humans. Sponge argues the next optimization battle will be for agents — the companies that make it trivially easy for an agent to discover and pay for their service will win agent-sourced revenue that others miss entirely.

The timing is sharp. x402 only launched broadly in early 2026. Cloudflare backed it. Coinbase built the reference implementation. Solana ran a hackathon around it. The protocol is early enough that tooling is immature — exactly the right moment to build the "easy button" on top of it. Sponge is doing for x402 what Stripe did for raw Braintree APIs in 2011: making the hard stuff feel like a three-line SDK call.

What I'd Build Differently

My one critique is the crypto-first positioning. Stablecoins and EVM wallets are the right technology choice — fast, cheap, programmable — but "your agent needs a crypto wallet" still triggers immediate skepticism in enterprise engineering teams. Stripe solved this by hiding the scary infrastructure behind a dead-simple API. Developers just moved money; they didn't think about ACH rails. Sponge should abstract the blockchain layer further. Show a dashboard that looks like a bank account, not a DeFi protocol. Let engineers think in dollars, not USDC. Let the stablecoin be an implementation detail.

The other gap I'd close: agent identity. Right now, a Sponge wallet is tied to an agent provisioned by a developer. But agents increasingly have persistent identities across sessions, frameworks, and cloud regions. The company that solves "this is the same agent, even when it's running on different infrastructure" will own the agent identity layer — and that identity layer will naturally become the payment identity layer too. Sponge has a head start here, but they haven't made it a central product story yet.

How to Replicate This with Claude Code

Below is a replication guide — a complete Claude Code prompt that walks you through building a working version of Sponge. It covers agent wallet provisioning, x402 payment integration, and a basic API gateway that lets services sell access to AI agents autonomously. Copy it, install it, and start building.

© 2026 StartupHub.ai. All rights reserved. Do not enter, scrape, copy, reproduce, or republish this article in whole or in part. Use as input to AI training, fine-tuning, retrieval-augmented generation, or any machine-learning system is prohibited without written license. Substantially-similar derivative works will be pursued to the fullest extent of applicable copyright, database, and computer-misuse laws. See our terms.

Build Sponge with Claude Code

Complete replication guide — install as a slash command or rules file

---
description: Build a Sponge clone — financial infrastructure for AI agents to hold wallets and make autonomous payments via x402 and MCP
---

# Build Sponge: Payment Infrastructure for AI Agents

## What You're Building
A platform that gives AI agents their own wallets (USDC on Base) and lets them autonomously pay for API services using the x402 protocol. Includes an agent wallet API, an x402-compatible gateway for API providers, and an MCP server so Claude and other agents can spend money natively.

## Tech Stack
- **Frontend:** Next.js 15 + TypeScript + shadcn/ui
- **Backend:** Node.js / TypeScript (Hono)
- **Database:** PostgreSQL (Supabase)
- **Blockchain:** Base (EVM) via viem + USDC stablecoin
- **Key Libraries:** viem, @coinbase/x402, @modelcontextprotocol/sdk, @supabase/supabase-js, zod
- **Key Management:** Privy or Turnkey for custodial wallets

## Step 1: Project Setup
```bash
mkdir sponge-clone && cd sponge-clone
npx create-next-app@latest dashboard --typescript --tailwind --app
mkdir api && cd api && npm init -y
npm install hono viem @coinbase/x402 zod @supabase/supabase-js dotenv
npm install -D typescript @types/node tsx
```

## Step 2: Core Data Models
```sql
CREATE TABLE agent_wallets (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  agent_id TEXT UNIQUE NOT NULL,
  address TEXT NOT NULL,
  encrypted_private_key TEXT,
  chain TEXT NOT NULL DEFAULT 'base',
  created_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE gateway_listings (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  slug TEXT UNIQUE NOT NULL,
  name TEXT NOT NULL,
  base_url TEXT NOT NULL,
  price_per_request_usdc NUMERIC(20, 8) NOT NULL,
  payment_address TEXT NOT NULL,
  openapi_spec JSONB,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE payments (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  from_wallet TEXT NOT NULL,
  to_address TEXT NOT NULL,
  amount_usdc NUMERIC(20, 8) NOT NULL,
  tx_hash TEXT,
  protocol TEXT NOT NULL DEFAULT 'x402',
  status TEXT NOT NULL DEFAULT 'pending',
  created_at TIMESTAMPTZ DEFAULT NOW()
);
```

## Step 3: Agent Wallet API
```typescript
// api/src/wallets.ts
import { Hono } from 'hono';
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import { createCipheriv, randomBytes } from 'crypto';

function encryptKey(privateKey: string): string {
  const iv = randomBytes(16);
  const cipher = createCipheriv('aes-256-gcm', Buffer.from(process.env.ENCRYPTION_KEY!, 'hex'), iv);
  const encrypted = Buffer.concat([cipher.update(privateKey), cipher.final()]);
  const tag = cipher.getAuthTag();
  return `${iv.toString('hex')}:${encrypted.toString('hex')}:${tag.toString('hex')}`;
}

const app = new Hono();

// Provision a new agent wallet
app.post('/wallets', async (c) => {
  const { agentId } = await c.req.json();
  const privateKey = generatePrivateKey();
  const account = privateKeyToAccount(privateKey);
  await supabase.from('agent_wallets').insert({
    agent_id: agentId,
    address: account.address,
    encrypted_private_key: encryptKey(privateKey),
  });
  return c.json({ agentId, address: account.address, chain: 'base' });
});

// Check USDC balance
app.get('/wallets/:agentId/balance', async (c) => {
  const { agentId } = c.req.param();
  const { data: wallet } = await supabase
    .from('agent_wallets').select('address').eq('agent_id', agentId).single();
  const balance = await publicClient.readContract({
    address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC on Base
    abi: erc20Abi,
    functionName: 'balanceOf',
    args: [wallet.address]
  });
  return c.json({ address: wallet.address, usdc: formatUnits(balance, 6) });
});
```

## Step 4: x402 Payment Middleware
```typescript
// api/src/payments.ts
import { x402Middleware } from '@coinbase/x402';
import { withPaymentInterceptor } from '@coinbase/x402/fetch';

// For API providers: protect a route with x402
export function requirePayment(priceUSDC: number, receivingAddress: string) {
  return x402Middleware({
    amount: String(Math.round(priceUSDC * 1_000_000)), // 6 decimals
    currency: 'USDC',
    network: 'base',
    paymentAddress: receivingAddress,
    facilitatorUrl: 'https://x402.org/facilitator'
  });
}

// For agents: auto-pay when hitting x402 endpoints
export async function agentFetch(agentId: string, url: string, options = {}) {
  const wallet = await getWalletClient(agentId);
  const payingFetch = withPaymentInterceptor(fetch, wallet);
  return payingFetch(url, options);
}
```

## Step 5: Sponge Gateway
```typescript
// api/src/gateway.ts
app.post('/gateway/register', async (c) => {
  const { name, baseUrl, pricePerRequest, openApiSpecUrl } = await c.req.json();
  const spec = await fetch(openApiSpecUrl).then(r => r.json());
  const providerKey = generatePrivateKey();
  const providerAccount = privateKeyToAccount(providerKey);
  await supabase.from('gateway_listings').insert({
    name, base_url: baseUrl,
    price_per_request_usdc: pricePerRequest,
    payment_address: providerAccount.address,
    openapi_spec: spec,
    slug: name.toLowerCase().replace(/\s+/g, '-')
  });
  return c.json({ paymentAddress: providerAccount.address });
});

// Proxy requests and charge the agent wallet
app.all('/gateway/:slug/*', async (c) => {
  const { slug } = c.req.param();
  const agentId = c.req.header('X-Agent-Id')!;
  const listing = await getListing(slug);
  await chargeWallet(agentId, listing.payment_address, listing.price_per_request_usdc);
  const upstreamPath = c.req.path.replace(`/gateway/${slug}`, '');
  const response = await fetch(listing.base_url + upstreamPath, { method: c.req.method });
  return new Response(response.body, { status: response.status });
});
```

## Step 6: MCP Server
```typescript
// api/src/mcp-server.ts
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new Server({ name: 'sponge-wallet', version: '1.0.0' }, { capabilities: { tools: {} } });

server.setRequestHandler('tools/list', async () => ({
  tools: [
    { name: 'check_balance', description: 'Check USDC balance', inputSchema: { type: 'object', properties: {} } },
    { name: 'pay_api', description: 'Call an x402-enabled API with auto-payment', inputSchema: { type: 'object', properties: { url: { type: 'string' } }, required: ['url'] } },
    { name: 'transfer', description: 'Send USDC', inputSchema: { type: 'object', properties: { to: { type: 'string' }, amount: { type: 'number' } }, required: ['to', 'amount'] } }
  ]
}));

server.setRequestHandler('tools/call', async (req) => {
  const { name, arguments: args } = req.params;
  const agentId = process.env.AGENT_ID!;
  if (name === 'check_balance') {
    const { usdc } = await fetch(`${process.env.API_BASE}/wallets/${agentId}/balance`).then(r => r.json());
    return { content: [{ type: 'text', text: `USDC balance: $${usdc}` }] };
  }
  if (name === 'pay_api') {
    const result = await agentFetch(agentId, args.url);
    return { content: [{ type: 'text', text: await result.text() }] };
  }
  if (name === 'transfer') {
    const txHash = await transferUSDC(agentId, args.to, args.amount);
    return { content: [{ type: 'text', text: `Sent $${args.amount} USDC. Tx: ${txHash}` }] };
  }
});

await server.connect(new StdioServerTransport());
```

Add to Claude Desktop `claude_desktop_config.json`:
```json
{
  "mcpServers": {
    "sponge-wallet": {
      "command": "npx",
      "args": ["tsx", "/path/to/api/src/mcp-server.ts"],
      "env": { "AGENT_ID": "my-claude-agent", "API_BASE_URL": "http://localhost:3001" }
    }
  }
}
```

## Step 7: Deploy
```bash
# API on Railway
railway init && railway up

# Dashboard on Vercel
cd dashboard && vercel deploy

# Fund your test agent wallet via Coinbase or bridge.xyz — send USDC on Base
```

## Key Insights
- x402 is 80% of the value here — the HTTP 402 flow already has a free public facilitator at x402.org for testing
- USDC on Base: $0.00025/tx and 2s finality makes micropayments viable at scale
- The MCP server is what creates the demo moment — once Claude can call pay_api natively, the agent economy becomes real
- Use Privy or Turnkey for key custody — never store unencrypted private keys in your database

## Gotchas
- Always AES-256-GCM encrypt private keys with a secrets manager key, not your .env file
- The public x402.org facilitator works for demos — run your own for production (it is just a webhook verifier + on-chain reader)
- Base USDC address is `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` — different from Ethereum mainnet
- MCP server runs as a subprocess of Claude Desktop and cannot share in-memory state with your API — make HTTP calls instead
build-sponge-clone.md