x402 AI Agents Cloudflare Workers USDC / Base

WDH.sh

A family of pay-per-call CLI tools that an AI agent can discover and use with a single funded wallet — no accounts, no API keys, no manual provisioning. Authentication is the payment.

Screenshots

WDH.sh homepage — the x402 shell toolkit WDH.sh docs — install and CLI quickstart WDH.sh how it works — pay per call, no accounts

Overview

WDH.sh ("Working Dev's Hero") is a toolkit of small, single-purpose CLI tools — file transfer, URL shortening, chart rendering, markdown publishing, and QR codes — each exposed as a paid HTTP endpoint. Instead of signups and API keys, every call is settled in USDC on Base using x402, the HTTP-native "402 Payment Required" payment protocol. The first request returns a 402 with a price; the caller signs a USDC authorization and resends, and the result comes back. The whole toolkit runs on Cloudflare Workers, so it's globally distributed and scales to zero.

The Challenge

Spinning up a new AI agent usually means a tedious provisioning ritual: create accounts on every service it might need, generate and store API keys, wire up OAuth flows, set rotation schedules, and manage billing dashboards. Multiply that across charts, file hosting, link shortening, and media generation and the setup cost dwarfs the agent itself.

We wanted to answer a sharper question: what if an agent needed nothing but a wallet? Give it a single funded address and let it find, price, and pay for whatever resources it needs at runtime — no human in the loop creating accounts for capabilities the agent might never use.

Our Solution

WDH.sh turns each utility into a paid HTTP endpoint behind an x402 paywall. There are no accounts and no keys — the wallet signature on each request is the authentication. Fund one wallet with a few dollars of USDC and an agent can call any tool, paying cents to fractions of a cent per request. Revoke the wallet and access is gone.

Crucially, the tools are discoverable. Every endpoint, its price, and its request/response schema are published to a machine-readable manifest at /.well-known/x402 and an OpenAPI spec per service — plus the x402 Bazaar discovery extension that facilitators read to auto-catalog a service. An agent can crawl what's available, learn how to call it, and pay — all without a developer pre-wiring a single integration. That self-service discovery loop is the whole point: one wallet in, capabilities out.

The toolkit ships as one CLI (@wdhsh/cli) and runs entirely on Cloudflare Workers, settled through the Coinbase x402 facilitator on Base mainnet. We built it, deployed it, and ran 600+ live paid calls end-to-end for a total of $6.22 in USDC — proof the micropayment model works at real-world prices.

Platform

  • Cloudflare Workers (one per service)
  • Workers KV & R2 storage
  • Astro marketing + docs site
  • TypeScript monorepo (Turborepo + Bun)

Payments & Protocol

  • x402 v2 (HTTP 402 + EIP-3009)
  • USDC on Base mainnet
  • Coinbase x402 facilitator
  • Shared x402 middleware package

The Tools

  • files — up to 5GB transfers · $0.001–$0.10
  • short — URL shortener · $0.001
  • charts — chart rendering · $0.005
  • md — markdown publishing · $0.002
  • qr — QR generation · $0.001

Discovery & Ops

  • /.well-known/x402 manifest
  • Per-service OpenAPI 3.1 specs
  • x402 Bazaar discovery extension
  • Paid feedback & support → Linear

What We Learned About x402

Building WDH.sh end-to-end gave us hard-won, production-level experience with a protocol that's still taking shape. A few of the takeaways:

One wallet beats N accounts

The single biggest unlock: an agent with one funded wallet can use every tool immediately. No per-service signup, no key rotation, no dashboard sprawl — provisioning collapses to "send USDC."

Discovery is fragmented

There's no single x402 registry yet — it's a mix of crawlers, a DNS convention, and the Bazaar extension. We made WDH.sh discoverable across all of them from one source-of-truth registry.

Mainnet ≠ testnet wiring

The default public facilitator is testnet-only; Base mainnet needs Coinbase's facilitator with CDP-signed JWTs. Several footguns (atomic-unit amounts, v2 header names, nodejs_compat) only surface with real money.

Idempotency must live outside the paywall

Verify is free; settle is the on-chain write. We settle only on a 2xx, and keep idempotency caching outside the paywall so a retry never charges a caller twice — the kind of detail that protects real funds.

Building for AI Agents?

We've shipped real x402 services on mainnet — from payments and discovery to Cloudflare Workers infrastructure. Let's talk about agent-native tools your customers can pay for per call.