x402-paid-agent-starter

x402 paid agent starter (TypeScript + Python) with on-chain proof

Browse source · Live demo · x402-paid-agent-starter.tar.gz · x402-paid-agent-starter.bundle
commit 7eda168 · 7eda168e81dfc7ae53f9a687f7fa74d32646611d
Clone: curl -O https://agentgate-source.pages.dev/x402-paid-agent-starter/x402-paid-agent-starter.bundle && git clone x402-paid-agent-starter.bundle x402-paid-agent-starter
Mirror note: this repo used to live on GitHub under the agentgate-builder account (suspended Oct 21, 2026). Links in the README below were rewritten for this mirror: source links point here, GitHub Pages demos to /x402-paid-agent-starter/demo/ where one exists, npx github: installs to the tarball on this site, and CI badges became a "tests passing locally" note. The tarball, bundle and raw files are unmodified.

x402 paid agent starter (TypeScript and Python)

Two starter templates for a paid agent listed on LAX (https://lax.kognai.ai), one per folder, each usable on its own:

TypeScript Python
Paid route typescript/src/app.ts: createApp({price, payTo, network, facilitator, description?}), a web standard fetch handler (Node, Hono, Bun, workers) python/app.py: create_app(...), FastAPI
LAX offer typescript/lax-offer.json python/lax-offer.json
Listing script typescript/src/list.ts listOffer({offer, registryUrl?, fetch?, pay}) and scripts/list.ts python/list_offer.py
Tests npm test (node:test via tsx) pytest

Both speak x402 version 1, exact scheme, USDC on Base (base) or Base Sepolia (base-sepolia):

The facilitator comes from the configuration: an object with verify and settle, or a URL (default https://x402.org/facilitator, which settles x402 v1 on base-sepolia; https://facilitator.payai.network settles v1 on base).

On-chain proof (21 October 2026): each starter settled one real paid call of 0.01 test USDC on Base Sepolia through the x402.org facilitator: TypeScript https://sepolia.basescan.org/tx/0x352aa808ef460fdaf8de6a9ba8a0e5bac7f2cf7b26c426f6b9440cd0de13cacf and Python https://sepolia.basescan.org/tx/0xef8fb6cd9f8f6c4d8e0552d21bd7863743392371b13f64efa7762f6dbe93c648. Details and how to reproduce: PROOF.md.

Keys are read by the caller from the environment (LAX_PAYER_KEY, PAYER_KEY) and never logged. Every payment script has a spend cap (MAX_FEE_ATOMIC, default 10000 = 0.01 USDC).

Derived in part from the MIT AgentGate x402 service (https://agentgate-source.pages.dev/agentgate/). MIT licence.


agentgate-source: code mirror on Cloudflare Pages. All repos