x402 Paid Forecast API

Paid Crypto Forecast API for AI Agents

This website's free forecast tool shows a 30-step Monte Carlo projection for a single timeframe. The Pro API extends it into a machine-readable, paid endpoint designed for AI agents and automated clients:

  • 90-step horizon instead of 30
  • Drift (μ) and volatility (σ) of the fitted diffusion process
  • 50 Monte Carlo sample paths per timeframe
  • 95% prediction interval and uncertainty bounds (± standard error)
  • Multiple timeframes in one request: intervals=1d,1w
  • Trading pairs: BTCUSDT and ETHUSDT on the daily timeframe and beyond

How x402 payments work

x402 turns the long-forgotten HTTP 402 Payment Required status code into a real machine-payment layer. No API keys, no accounts, no subscription — the HTTP client pays on-chain and gets the content:

  1. The agent requests /forecast-pro without payment and receives 402 with a payment-required header describing price, asset and recipient.
  2. The agent signs an EIP-3009 transfer authorization (USDC on Base) — an offline signature, no gas needed from the payer.
  3. The agent retries the request attaching the signed payload in the payment header.
  4. The server verifies the payment via a facilitator, serves the forecast, and settles the transfer on-chain.

Live demo (unpaid request)

Press the button to send a real request to the endpoint without a payment header. You will get the genuine 402 response exactly as an agent sees it before paying.

Query parameters

ParameterTypeDefaultDescription
symbolstringBTCUSDTBinance spot trading pair: BTCUSDT or ETHUSDT
intervalsstring1dComma-separated list of kline intervals: 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
fromdateTraining data range start, YYYY-MM-DD
todateTraining data range end, YYYY-MM-DD

Example response

A paid response contains one forecast block per requested interval (trimmed here to a single timestamp for readability):

{
  "symbol": "ETHUSDT",
  "horizon": 90,
  "status": "ok",
  "build_at_utc": "2026-09-12T12:00:00+00:00",
  "forecasts": {
    "1d": {
      "rows": 999,
      "t0": "2023-12-24",
      "s0": 2516.43,
      "μ": 0.000126,
      "σ": 0.035405,
      "mean_path":             {"2026-09-13 00:00:00+00:00": {"price": 2519.6}},
      "sample_paths":          {"2026-09-13 00:00:00+00:00": {"0": 2550.7, "1": 2488.2, "...": "..."}},
      "prediction_interval_95": [
        {"2026-09-13 00:00:00+00:00": {0: 2290.5}},
        {"2026-09-13 00:00:00+00:00": {0: 2760.1}}
      ],
      "uncertainty_bounds": [
        {"2026-09-13 00:00:00+00:00": {0: 2511.8}},
        {"2026-09-13 00:00:00+00:00": {0: 2527.4}}
      ]
    }
  },
  "errors": {}
}

Paying from code

Any x402-capable HTTP client handles the 402 flow automatically.

curl -i "https://stochastic.fastapicloud.dev/forecast-pro?symbol=BTCUSDT&intervals=1d"

# HTTP/1.1 402 Payment Required
# payment-required: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIiw...

# Decode the header (base64 JSON) to see:
# {
#   "x402Version": 2,
#   "accepts": [{
#     "scheme": "exact",
#     "network": "eip155:8453",
#     "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",   # USDC on Base
#     "amount": "10000",                                        # 0.01 USDC (6 decimals)
#     "payTo": "0x9e6a..."
#   }]
# }
import asyncio
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm.exact import ExactEvmScheme

async def main():
    buyer = Account.from_key("0x...")  # your wallet with USDC on Base

    client = x402Client()
    client.register("eip155:8453", ExactEvmScheme(signer=buyer))

    async with x402HttpxClient(client) as http:
        r = await http.get(
            "https://stochastic.fastapicloud.dev/forecast-pro",
            params={"symbol": "BTCUSDT", "intervals": "1d,1w"},
        )
        print(r.status_code)   # 200 — payment was settled automatically
        print(r.json())

asyncio.run(main())
import { wrapFetchWithPayment } from "x402-fetch";

const signer = await privateKeyToAccount("0x..."); // wallet with USDC on Base

const fetchWithPayment = wrapFetchWithPayment(fetch, signer);

const res = await fetchWithPayment(
  "https://stochastic.fastapicloud.dev/forecast-pro?symbol=BTCUSDT&intervals=1d",
);

console.log(res.status);              // 200
const forecast = await res.json();    // μ, σ, 50 paths, 95% interval...
Endpoint specification
Method
GET
URL
https://stochastic.fastapicloud.dev/forecast-pro
Price
$0.01 per request
Asset
USDC (native, Base)
Scheme
x402 exact (EIP-3009, gasless for payer)
Facilitator
PayAI
Response
application/json