Public
x402-paywalled API wrapper around Radicle
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

Radicle × x402 API

A pay-per-request HTTP wrapper around a Radicle seed node. Every /api/* route is gated by an x402 micropayment in USDC — clients (humans or AI agents) pay per call with no accounts or API keys.

How it works

Rendering mermaid diagram...

Endpoints

RouteDescriptionPrice
GET /Landing pagefree
GET /healthHealth + configured seedfree
GET /api/projectsList repos on the seed$0.001
GET /api/projects/:ridRepo metadata$0.005
GET /api/projects/:rid/issuesRepo issues$0.005
GET /api/projects/:rid/patchesRepo patches$0.005
GET /api/projects/:rid/commitsRepo commits$0.005

Setup

Set these environment variables in the Val Town UI:

  • PAY_TO_ADDRESS (required) — your 0x… wallet that receives USDC. Until this is set, the paywall is disabled and /api/* returns 503.
  • X402_NETWORK — defaults to base-sepolia (testnet). Use base for mainnet.
  • FACILITATOR_URL — defaults to https://x402.org/facilitator. Use the Coinbase CDP facilitator for Base mainnet.
  • RADICLE_SEED — the seed node API base. Defaults to https://seed.radicle.garden/api/v1.

Calling it

Any x402-aware client works. With the TypeScript SDK:

import { wrapFetchWithPayment } from "x402-fetch"; import { createWalletClient, http } from "viem"; // ...build a wallet client, then: const fetchWithPay = wrapFetchWithPayment(fetch, wallet); const res = await fetchWithPay("https://<your-val>.web.val.run/api/projects");

A plain fetch (no payment) just returns 402 with the payment requirements in the PAYMENT-REQUIRED header.

Files

  • main.ts — Hono app, x402 paywall middleware, route definitions
  • radicle.ts — thin client for the Radicle seed node HTTP API
  • landing.html — landing page