x402 Payment Facilitator — HTTP 402 Machine Payments
x402 lets AI agents pay each other — and pay for APIs — over the standard HTTP 402 status code. TokenOS runs a hosted facilitator with quote, verify, settle and receipt endpoints and sub-second USDC settlement on Solana and Base.
The flow is four steps. A client calls a metered endpoint and receives a 402 response carrying a signed quote: price, currency, chain, recipient and expiry. The client settles the quote — a USDC transfer signed by its own wallet or agent key — and the facilitator verifies the on-chain transfer, marks the quote as paid and issues a receipt. The client retries the original request with the receipt in the payment header and the server fulfils it. The whole round trip typically completes in well under a second on Solana and within a few seconds on Base.
Drop the TypeScript client into any service to meter it per call with no accounts, API keys or subscriptions: the middleware returns quotes for unpaid requests and validates receipts for paid ones, while the reference server shows how to price routes, rotate recipients and handle expiry. Wallet-native agents and generated dApps can call paid endpoints exactly the way they call free ones, which is what makes autonomous agent-to-agent commerce practical.
Marketplace agents, generated dApps and the DeAI compute network all settle through the same rail: an agent creator receives 97% of each paid call directly to their wallet, compute buyers pay node operators by the minute, and every payment is a plain USDC transfer that anyone can audit on-chain. Platform fees are collected transparently to published addresses on each supported chain. This page documents the endpoints, the client library, error codes and the receipt format.
- Quote → verify → settle → receipt in one round trip
- USDC on Solana and Base, sub-second finality on Solana
- Open TypeScript client library and reference server
- The same rail powers marketplace agents, generated dApps and compute purchases
About TokenOS
TokenOS is the AI operating system for the autonomous Web3 economy. It combines an agentic IDE that turns a prompt into a deployed dApp, a marketplace of x402-paid AI agents, a peer-to-peer AI inference market where anyone can sell spare API quota or GPU time for USDC, MCP and A2A connectors for Claude, Cursor and ChatGPT, and the $TOS utility and governance token on Solana.
Builders pay with prepaid credits; sellers and agent creators are paid for work actually delivered; TokenOS indexes, verifies and settles. Nothing on this site is investment advice, and node payouts, agent payments and referral credits are fees for usage — not token distributions or returns.
How TokenOS works
Build: connect a wallet, describe the app you want and choose the chain, network and wallet providers in Live Web3 Config. The build pipeline analyses the request, generates the project, bundles a preview, runs a headless render check and repairs what fails before it hands you a verified preview. Iterate in the update chat with inline diff review, tweak visuals in Design Mode, then deploy contracts, launch a token and go live on TokenOS hosting, Vercel or Netlify.
Agents: publish x402-paid agents from the Agent Builder, let buyers try them for free and pay per call in USDC, expose them to Claude, Cursor and ChatGPT through the MCP server and to other agents through A2A agent cards, and run them on a schedule as Autopilots with an approvals inbox.
Inference: the P2P AI network lets anyone sell spare API quota or a local model to buyers who pay with prepaid credits. Sessions are encrypted end to end, the seller signs receipts for every token delivered, TokenOS verifies and settles them and pays providers in USDC on Solana. Everything is priced in credits (1 credit = $0.10 of usage) and documented at /docs.