Every agent payment,
verified or refunded.
x402 lets an agent pay for anything. It doesn't let an agent get its money back. Assay pays the provider from its own wallet, checks what comes back against the contract that provider published, and only then lets your payment settle.
Every agent payment, verified or refunded. A stream of identical payments flows toward a central gate. Only after passing through it does each one resolve into a settled payment or a cancelled one.
The field, measured
A market with no recourse doesn't get a demand side.
Before writing a line of Assay we pulled the whole facilitator catalog and did the arithmetic. Every figure below is settle counts against list prices — measured, not estimated. The picture it paints is not a market that is early. It is a market where nobody on the buying side has a reason to trust anybody.
- Source
- Facilitator discovery API
- Measured
- 2026-08-04
- Network
- Algorand Mainnet
- 709resources
- payable on Algorand Mainnet
- $643lifetime
- settled across the entire field
- 0of 709
- declare a JSON schema
- $0.005median
- price per call
Across 59 merchants — but a single merchant holds 513 of them. Route count is not a signal.
Settle counts × list prices. One merchant accounts for roughly $558 of it. The fiftieth-ranked merchant has settled nothing at all.
194 publish a worked example and nothing more. Inferring structure from examples is not a fallback path — it is the only path.
452 of 709 routes are priced at a penny or less. The cost of one bad call is small; the cost of not knowing is not.
The third figure is the one Assay is built on. Not a single provider publishes a JSON schema — but 194 publish a worked example, and the Bazaar requires that declaration in order to be listed at all. That example is a promise the provider made to the catalog. The standard already supplies the contract. What was missing was anyone enforcing it.
The part that isn't obvious
The whole assay fits inside the payment window.
- 01
Verify
The agent's payment to Assay is verified by the facilitator. It is authorised and nothing has moved — no USDC has left the agent's wallet.
- 02
Forward
Assay pays the provider from its own wallet. A second, real x402 payment on Algorand. This is the money Assay puts at risk on the agent's behalf.
- 03
Assay
The response is checked against the output contract that provider published to the Bazaar — the schema if there is one, the shape inferred from its worked example if not.
- 04
Settle, or cancel
Pass and the handler returns 200, so the agent's payment settles. Fail and it returns 424, so the payment is cancelled. Assay absorbs what it already spent upstream.
Position
- agent → assay
- authorised · not moved
- assay → provider
- —
- verdict
- —
The agent's USDC has not moved.
Everything up to this point is reversible at no cost to them. The only money genuinely at risk is Assay's.
The assay
Two of these three responses are failures.
All three returned HTTP 200.
A status code tells you the request arrived. It does not tell you the body is a quote rather than a rate-limit notice, or that a number arrived as a string. Assay compares what came back against the shape the provider itself published to the Bazaar.
- Taken from
npm run demo- Failure codes
- error_shaped · schema_violation
- Implements
src/assay/validators.ts
{
"symbol": "ALGO",
"priceUsd": 0.1712,
"updatedAt": "2026-08-06T12:00:00Z"
}{
"symbol": "ALGO",
"priceUsd": 0.1734,
"updatedAt": "2026-08-07T11:06:58.290Z"
}Same keys, same types. The provider kept the promise it published, so the agent's payment settles — $0.0100 passed through and a $0.0460 fee — and the observation is recorded as a success that lowers the price of the next call.
Agent charged
$0.0560
Which makes this an underwriting business
We eat the loss on a bad call. So the fee is a risk premium, not a markup.
When Assay routes a call it takes on the provider's counterparty risk: on failure the agent pays nothing and Assay is out the pass-through it already spent. That has to be priced. The middle term below is the expected loss per call — which is why the score endpoint is free and load-bearing rather than decorative. It is the input to the price.
- Base fee
- $0.03
- Risk load
- ×1.6
- Routing floor
- 0.45
- Implements
src/pricing.ts
What we have observed
every observation is a real payment we made on a customer's behalf
wrong shape, error envelope under a 200, timeout, or empty body
median across the live Mainnet catalog is $0.005
Route below the score floor anyway
allowUnverified: true — the caller accepting that they are helping establish a score.
Wilson lower bound
0.801
The naive success rate is 93% over 40 calls. The score is lower because 40 calls are reasonable evidence.
The premium
fee = 0.03 + (1 − 0.801) × 0.0098 × 1.6
- pass-through to provider
- $0.0098
- base fee
- $0.0300
- risk premium· expected loss $0.0019 × 1.6
- $0.0031
Agent pays
$0.0429
And $0.0000 of it if the response fails the assay.
Two properties matter here more than sophistication. The score is conservative on thin evidence — drag the call count to one and watch a perfect record score 0.21 rather than 1.00. And it forgets: observations decay with a seven-day half-life, so a provider that broke last month and has been healthy since recovers, and one that was healthy last month and is broken now is marked down immediately.
The hard questions
The four objections that are actually worth raising.
Each of these has an answer in the code rather than in the pitch. Where the honest answer is a limitation, it is written as one.
- Enforceable
- 194 of 709 resources
- Structural checks
- all 709
- Implements
src/assay/validators.ts
Why would a provider agree to this?
A reliable provider is also the one that benefits: the premium falls as its score rises, so routing it becomes cheaper than routing its competitors.
What happens when a provider declares nothing?
Three checks still apply, because they need no declaration: the response arrived with a success status, it carries a payload rather than an empty object, and it is not an error envelope wearing an HTTP 200. That last one alone catches the failure mode the whole ecosystem is currently blind to. The receipt records
basis: "none", so a caller can always tell how much was actually verified.What stops you inflating your own scores?
payTo is our own address, so Assay cannot route to itself even by accident. Beyond that, every observation is a real payment made on a real customer's behalf — there is no sampling process to bias, because we are not sampling. We are reporting what our own money bought.The incentive runs the right way too. Scoring a bad provider as good means underwriting it at too low a premium, and we are the ones who absorb that.
What if the assay itself is wrong?
Every verdict is also auditable.
GET /v1/receipt/:id returns the individual checks, the exact violation string, and the transaction ids for both legs.Surface
One paid route. Everything that makes it trustworthy is free.
The score endpoint is not a courtesy. It is the input to the price, which is the only reason we can afford to give it away — and the only reason it is worth anything. It is the sole reliability signal in the ecosystem produced by someone with money at stake on being right.
- Paid routes
- 1 of 7
- Auth
- x402 payment header
- Idempotency
- opt-in
| POST | /v1/call | paid | Route a call through the assay |
| GET | /v1/catalog | free | Every routable resource with its live Assay grade |
| GET | /v1/quote/:resource | free | Price and risk premium before you commit |
| GET | /v1/score/:resource | free | Full reliability record |
| GET | /v1/receipt/:id | free | Audit trail for one call, with transaction ids |
| GET | /v1/health | free | Readiness and solvency |
| CRON | /internal/cron/* | secret | Refund sweep and catalog refresh, for a scheduler |
What POST /v1/call can tell you
payment settles
The response matched the contract the provider published. Your payment settles and you get the data.
payment cancelled
The provider failed its own declared contract. Your payment is cancelled — not refunded afterwards, never charged. Assay eats what it already spent upstream.
payment nothing
Assay declines to underwrite that resource at any price. You are told why, and what score it would need.
Idempotency is opt-in, via idempotencyKey. Without one, an identical request is a genuinely new call — asking a price feed the same question twice is two questions — and a key that has already resolved returns 409 rather than charging twice for one answer. That distinction is not a detail; the first version of this got it backwards and quietly billed an agent twice for one answer.
Distribution
Give your agent a wallet, not twelve API keys.
Assay ships as an MCP server, so any Claude or Cursor session can discover, price and buy data with four tools and no per-provider signup. The wallet belongs to the person running it — their agent pays; we route, underwrite, and score.
- Transport
- stdio
- Custody
- none — the key stays with the user
- Implements
src/mcp/server.ts
{
"mcpServers": {
"assay": {
"command": "node",
"args": [
"--experimental-strip-types",
"/path/to/assay/src/mcp/server.ts"
],
"env": {
"ASSAY_URL": "https://<deployed origin>",
"ASSAY_AGENT_KEY": "<base64 Algorand key>"
}
}
}
}Four tools
- assay_search
- find a resource in the Bazaar, with its grade
- assay_quote
- what it will cost and why
- assay_score
- the full reliability record
- assay_call
- route the call, underwritten
Twelve signups become none
No account, no key rotation, no invoice per provider. Discovery and payment are the same protocol.
The key never leaves the user
The agent signs its own payments. Assay holds no customer funds and cannot spend on their behalf.
See it for yourself
No wallet. No funding. No network. One command.
npm run demo stands up a complete local x402 network — a facilitator, three providers that charge for data, an agent with a wallet — and runs the real service in the middle of it. Every payment in it is a real x402 payload built by the SDK and signed with a real key, and the facilitator decodes each one and checks the receiver, asset and amount before agreeing to it. Only the chain is simulated.
- Requires
- Node ≥ 22.5
- Wallet
- none
- Tests
- 84, including this run
git clone github.com/mimisco-git/Assay
cd Assay && npm install
npm run demoWhat is not simulated
The state machine, the assay, the pricing, the scoring, both x402 legs, and every signature. The single fact taken on trust is that the payer is solvent — which is exactly what the Testnet round trip exists to establish.
16 settlements, every one a signed transaction group
… 9 more
The six unsettled ones are the guarantee. Assay had already paid those providers and absorbed it; the agent's payment was cancelled before it moved. That loss is what the risk premium prices, which is why the reliability score has to be honest — we are the ones paying for it to be wrong.
Proven, and re-proven on every commit
- The full settlement state machine, on every commit
- Both x402 legs — agent to Assay, Assay to provider
- Shape inference and conformance against declared output
- Wilson scoring, decay, and the risk-priced quote
- Every Postgres statement, and the pg client, on a real server
- 84 tests, including the end-to-end run above
Not proven yet
- Settlement on a real chain, with two funded wallets
npm run roundtrip with two funded wallets is the gate, and it is the only claim on this page the test suite does not currently back. It is listed here rather than left out.
Read the state machine. It's the part that has to be exactly right.
Every transition is guarded on its prior state in SQL, because a crash between paying a provider and returning its response must not be able to charge twice or refund twice.
Read the source