§ Free tier wake-up — first request may take ~30 seconds
Issue 01 · 2026 · x402 reference implementation

An open-source reference for HTTP 402 — runnable, end-to-end, right in this browser tab.

Pay-per-call AI,
settled on Base Sepolia.

An HTTP 402 reference, end-to-end. The wallet signs once with EIP-712. The Rust verifier checks the signature. The AI provider runs the request. The gateway returns a signed receipt — verifiable right here, in this browser tab.

gatewayx40201Request02Challenge03Sign04Verify05Generate06Receipt
Live x402 protocol diagram showing six steps — request, challenge, sign, verify, generate, receipt — cycling continuously.
Plate § 06
TX 0042 · LIVE
Fee per call
0.001 USDC
Chain
Base Sepolia · 84532
§ 01 — The tool

Sign once. Pay once.

Paste any text. The gateway will challenge you with a 402, your wallet signs it once, and a summary comes back with a verifiable receipt.

01 — Your text

0 words · 0 charscost0.001 USDC

Wallet signs the EIP-712 challenge — no on-chain transaction, no gas. Receipt is signed by the gateway and verifiable in your browser.

Payment flow and result

x402 flowReady
  1. 01
    Request
  2. 02
    Challenge
  3. 03
    Sign
  4. 04
    Verify
  5. 05
    Generate
  6. 06
    Receipt

Awaiting input

Sign once.
Get a signed answer back.

The gateway returns 402 Payment Required with a payment context. Your wallet signs it, the verifier checks the signature, the AI runs the request, and a signed receipt is returned in the response header.

§ 02 — Your receipts

Each signature, filed.

Every successful payment leaves a signed receipt. Click verify on any of them — the check runs locally in your browser, against the gateway's public key.

No receipts yet

Sign a payment above and your receipt will appear here — verifiable client-side.

§ 03 — The protocol

The x402 dance,
in six moves.

Each step has its own failure mode and a structured error code. The status strip in the tool shows where you are in the flow, live.

  1. 01

    Request

    Client posts unsigned text to /api/ai/summarize. The gateway never charges before it has a signature.

  2. 02

    Challenge

    Gateway responds 402 with a payment context: recipient, amount, token, nonce, chainId, and timestamp.

  3. 03

    Sign

    Your wallet signs the EIP-712 typed data. No on-chain transaction, no gas — only an authorization signature.

  4. 04

    Verify

    The Rust verifier recovers the signer, enforces chain ID parity, timestamp window, and rejects replayed nonces.

  5. 05

    Generate

    Only after the signature is verified does the gateway call the AI provider. Failure here doesn't charge you.

  6. 06

    Receipt

    Gateway signs a receipt over the request and response hashes. Returned in X-402-Receipt and verifiable client-side.

A valid signature proves wallet authorization — it does not prove USDC moved on-chain. This implementation is a demo on Base Sepolia. The cryptography is real; the settlement is not.