Home / API docs / Exact Math API
Math

Exact Math API

GET /api/calc $0.001 per call USDC on Base · x402

Exact math for agents — the arithmetic LLMs get plausibly wrong. Evaluates an expression at 50-significant-digit precision (BigNumber): big-integer multiplication, high-precision division, roots, logs, factorials, unit conversions (12 inch to cm). GET ?expr=…, result returned as an exact string. Deterministic, no AI, never executed as code.

Parameters

NameInDescription
exprqueryrequiredMath expression, max 400 chars — e.g. '2^128', 'sqrt(2)', '12 inch to cm'

Example request

curl "https://api.webbersites.com/api/calc?expr=8347293847%20%2A%209928374652"
# first call returns 402 + payment requirements; an x402 client pays and retries automatically

Example response

{
    "expr": "8347293847 * 9928374652",
    "result": "82875060643350366244",
    "type": "BigNumber",
    "precision": "50 significant digits"
}
MCP tool: get_calc — 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.