Paying for the REST gauntlet (x402)
AlphaAssay's x402 surface is exactly POST /x402/v1/gauntlet — a REST payment path,
not a wrapper around every MCP tool. It needs no account or API key. x402 revives the HTTP status
code 402 Payment Required as a machine-to-machine payment handshake.
How does the x402 payment handshake work?
Your agent calls that gauntlet route like any HTTP API; the first response is 402 Payment Required
carrying a machine-readable price quote; the agent attaches a USDC payment authorization and retries; the
completed gauntlet result comes back with a named x402_receipt. No account, no API key,
no card form — four steps, settled on-chain.
| step | what happens |
|---|---|
| 1 · request | your agent calls POST /x402/v1/gauntlet |
| 2 · quote | the response is 402 with a machine-readable price quote — the exact amount, before anything is charged |
| 3 · pay & retry | the agent attaches the payment authorization and retries; settlement is on-chain (USDC), typically cents |
| 4 · result | the gauntlet result plus its named payment receipt — you paid for a completed trial, not for access |
What if the response gets lost — do I pay twice?
No. Every x402 payment nonce is idempotent: the same nonce with the same input re-delivers the cached
response without a second settlement — one payment buys one result — and the same nonce with a
different input is refused. The x402_receipt binds payment id, input digest and
verdict digest. Its own signed field is authoritative: it carries Ed25519 signature fields
when the deployment signing key is configured and reports signed:false otherwise. Fresh
throwaway wallets inherit a conservative prior until they have settlement history — a new wallet cannot
reset a family's trial budget.
What does it cost?
The exact current quote comes from https://api.alphaassay.com/v1/meta/pricing and the route's 402 response. The human-readable table is on pricing. The free tier (specimens, calibration record, certificate checks) never requires payment.
What does a paid call look like in code?
# the x402 client reads the gauntlet route's 402 quote, pays and retries: # the client reads the 402 quote, pays (USDC), retries. You see the verdict. r = x402_session.post("https://api.alphaassay.com/x402/v1/gauntlet", json=my_signal) verdict = r.json() # the quote is visible before paying, if you want to gate on price: q = requests.post(url, json=my_signal) # → 402 + machine-readable quote if quote_amount(q) <= my_budget: r = pay_and_retry(q)
What if I want an API key instead of x402?
The hosted public MCP server uses an api_key tool argument; bearer-authenticated REST
uses its own routes and headers. Those transports share application operations where documented, but
their request shapes and limits are not universally identical. Start here for an
account, and check the live pricing endpoint before calling.