Statistics API
POST /api/calc/stats $0.005 per call
USDC on Base · x402
Exact descriptive statistics — LLMs cannot reliably sum 200 numbers; this can. POST {values:[…]} for count/sum/mean/median/stddev/percentiles; {x:[],y:[]} for Pearson correlation + linear regression; {rows:[…], field} for object arrays — or {collection, field?} to run stats DIRECTLY ON YOUR DATASTORE collection (the paying wallet is the identity; reading extends its life 30 days). Up to 100k values, Kahan-summed.
Parameters
| Name | In | Description | |
|---|---|---|---|
values | body | numbers to describe | |
x | body | with y: correlation + regression | |
y | body | ||
rows | body | objects — with field/fields to pick columns | |
field | body | ||
collection | body | run stats on YOUR datastore collection instead of posting data |
Example request
curl -X POST "https://api.webbersites.com/api/calc/stats" \
-H "Content-Type: application/json" \
-d '{"values":[12.5,14.1,11.8,15.2,13.9]}'
# first call returns 402 + payment requirements; an x402 client pays and retries automaticallyExample response
{
"count": 5,
"sum": 67.5,
"mean": 13.5,
"median": 13.9,
"stddev": 1.41,
"percentiles": {
"p25": 12.5,
"p75": 14.1,
"p95": 15
}
}MCP tool: post_calc_stats — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.
How payment works
There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.