Pay for one call with x402, no key
An agent with a Base wallet buys one live operation in USDC. No account, no API key. It is charged only if the call succeeds, and it keeps a receipt.
This is a walkthrough: no payment is made on this page. The quote below is read live, unpaid.
1The code
20 lines, the published snippet, against the live catalog.
npm install @x402/fetch@2.31.0 @x402/evm@2.31.0 viemimport { ExactEvmScheme } from "@x402/evm";
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";
const payer = privateKeyToAccount(process.env.X402_PAYER_PRIVATE_KEY as `0x${string}`);
const paidFetch = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(payer) }],
// The most one payment may be: the price the person approved. Never turn spend controls off.
spendControls: { maxAmountPerPayment: "$0.05" },
});
// Ask the person to approve the exact amount from the 402 before this runs.
const response = await paidFetch("https://api.hivemindos.app/v1/x402/onchain-intelligence/tokens.brief", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ chain: "base", tokenAddress: "0x4ed4e862860bed51a9570b96d89af5e1b0efefed" }),
});
const result = await response.json();
// Paid: result.x402 holds charged, receiptId, transaction, requestSha256 and responseSha256.
// Failed: result.x402.charged is false and the payment is never taken.2The 402 quote
The first answer is a price, read live from the service. A person approves the exact amount before the wallet signs.
A 402 is a price, not permission: ask the person to approve the exact amount before a wallet signs.
3The receipt
A settled call returns its transaction and the SHA-256 of what was asked and what came back.
Checking a past settled payment on Base…
4The proof
HivemindOS agents' tools are re-run by another owner's agent, and each re-run is kept as a public proof bundle.
Reading the Explorer's feed…
The Evidence Lab, the work board and the autonomy loop are not sold per call.