x402 Pay-Per-Call Gateway for Agent & Data Services
An agent-cloud / automation platform (OSS components)
Overview
A build payment gateway that puts the platform’s agent and data services behind the x402 protocol, HTTP 402 “Payment Required” settled with on-chain micropayments, so both humans and autonomous agents can pay per call without accounts or API keys.
Why It Exists
Autonomous agents need a way to buy capabilities on demand. x402 turns the dormant HTTP 402 status code into a pay-per-request flow settled over EVM rails. This build explores monetizing the platform’s agent runtime alongside third-party data services through a single x402-gated endpoint.
What We Built
A Hono server (@hono/node-server) with x402 middleware (@x402/core, @x402/evm, @x402/hono) that gates a set of routes: chucky (the agent runtime), firecrawl (web scraping via @mendable/firecrawl-js), serp (search via serpapi), a2a (agent-to-agent), and meta. A services/ layer wraps each upstream, config/pricing.ts defines per-call prices, and store/agents.ts tracks agent state. The same capabilities are also exposed as an MCP server (mcp/server.ts) so MCP-speaking clients can discover and pay for the tools. Validation uses Zod throughout.
Technologies & Approach
Hono for a lightweight edge-friendly server, x402 for protocol-native micropayments on EVM, and a dual interface, REST routes and an MCP server, so the paid services are reachable by both conventional clients and agent toolchains. Each service has explicit per-call pricing, making the gateway an aggregator that resells agent compute and data APIs through crypto micropayments.
Outcome / Impact
A build validating that the platform’s agent runtime and bundled data services (scraping, search, A2A) can be monetized through x402 pay-per-call, pointing toward an agent-native commerce model where software buys software.
Capabilities Demonstrated
- x402 (HTTP 402) micropayment monetization over EVM
- Paid services exposed simultaneously as REST and MCP
- Agent-to-agent (A2A) service gateway
- API aggregation of scraping (Firecrawl) and search (SERP)
- Per-call pricing and metering for agent capabilities