I put two small web utilities behind x402 — the HTTP 402 Payment Required protocol — so an AI agent can call them without an account or API key and pay a fraction of a cent per call in USDC on Solana.
Base URL: https://agent-tools.faling-bot.workers.dev
| Endpoint | Price | What it does |
|---|---|---|
POST /api/markdown |
$0.002 | Fetch a public web page, return clean Markdown (title, main text, links) |
POST /api/summarize |
$0.003 | Bullet-point summary of {text} or a {url} (Llama 3.1 8B on Workers AI) |
It runs on a Cloudflare Worker. Payments are verified and settled by the PayAI facilitator, which sponsors Solana gas, so the paying agent only needs USDC.
The flow
- Call the endpoint with no payment. You get
402with a JSON body and aPAYMENT-REQUIREDheader (base64 JSON, x402 v2) listing what's accepted:scheme: exact,network: solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp, the USDC mint, and the amount in atomic units (2000= $0.002). - Your x402 client signs a USDC transfer and retries with a
PAYMENT-SIGNATUREheader (v1X-PAYMENTis accepted too). - The server verifies the payment, does the work, settles, and returns
200with the result. The settlement receipt is inPAYMENT-RESPONSE. If the input is invalid or the upstream page fails, the payment is not settled.
curl -i -X POST https://agent-tools.faling-bot.workers.dev/api/markdown \
-H 'content-type: application/json' -d '{"url":"https://example.com"}'
# HTTP/2 402 + payment requirements
Paying from TypeScript
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactSvmScheme } from "@x402/svm/exact/client";
import { toClientSvmSigner } from "@x402/svm";
import { createKeyPairSignerFromBytes } from "@solana/kit";
const signer = await createKeyPairSignerFromBytes(secretKeyBytes); // a wallet holding a little USDC
const pay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "solana:*", client: new ExactSvmScheme(toClientSvmSigner(signer)) }],
});
const res = await pay("https://agent-tools.faling-bot.workers.dev/api/markdown", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ url: "https://example.com" }),
});
console.log(await res.json()); // { url, title, markdown, chars, truncated }
As an MCP server
There's also a stateless streamable-HTTP MCP endpoint at https://agent-tools.faling-bot.workers.dev/mcp with tools url_to_markdown and summarize. It's listed in the official MCP Registry as dev.workers.faling-bot.agent-tools/x402-web-tools. A tool call without payment returns isError with the x402 requirements. To pay, pass the base64 payment payload as arguments.x402_payment, or as _meta["x402/payment"]. Not every MCP client can do this yet, so the plain HTTP endpoints are the more reliable option.
Machine-readable discovery
-
/llms.txt: a short guide for agents -
/openapi.json: OpenAPI 3.1 withx-payment-info(it's indexed on x402scan) -
/.well-known/x402: x402 resource list -
/.well-known/agent.json: an A2A agent card
Limits and caveats
- Rate limit: 30 requests/min per IP. The summarizer has a daily cap because it runs on a free-tier model.
- The Markdown extractor is heuristic (main/article detection plus tag stripping). It doesn't execute JavaScript, so SPAs and pages behind logins return little.
- This is a small, new, experimental service. Expect rough edges, and send feedback in the comments.
Written with AI assistance.
Top comments (0)