1

Create Worker

Start with our Cloudflare Worker template. Zero infrastructure to manage.

2

Add Your Logic

Implement your tool's functionality. Any AI model, API, or computation.

3

Set Pricing

Define your price per request. Receive USDC directly to your wallet.

4

Deploy

One command deploys globally. AI agents can start using immediately.

Quick Start

// x402 tool with Cloudflare Workers
import { Hono } from 'hono';

const app = new Hono();

// Price: $0.05 per request
const PRICE_USDC = 50000; // micro-units

app.post('/api/my-tool', async (c) => {
  // Check for payment receipt
  const receipt = c.req.header('X-Payment-Receipt');

  if (!receipt) {
    // Return 402 with payment requirements
    return c.json({
      x402Version: 1,
      accepts: [{
        scheme: 'exact',
        network: 'base',
        maxAmountRequired: PRICE_USDC.toString(),
        asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC
        payTo: 'YOUR_WALLET_ADDRESS',
      }]
    }, 402);
  }

  // Verify payment and execute tool logic
  const result = await doYourToolLogic(c.req);

  return c.json({ success: true, result });
});

export default app;

Starter Templates

AI Text Tool

Template for AI-powered text processing tools (summarization, translation, etc.)

View Template

Data Enrichment

Template for enriching data with external APIs (lead data, company info, etc.)

View Template

Web Scraper

Template for paid web scraping services (SEO analysis, content extraction, etc.)

View Template

Need help building?

Our team can help you design and implement x402 tools.

Get Expert Help