Live GB grid carbon intensity and the lowest-carbon window to run your job. An agent asks when to start a training run, a batch job, or an EV charge, pays $0.002 in USDC, and gets a start time with the saving, the runners-up, and the full 48-hour curve. Keyless and live.
git clone https://github.com/nirholas/x402-carbon
cd x402-carbon && npm install
npm run dev
| Route | Price | Returns |
|---|---|---|
GET /now | $0.001 | Current gCO2/kWh with its index band, the full generation mix, low-carbon / renewable / fossil shares, and the wind and solar conditions behind them |
POST /best-window | $0.002 | The best start time with mean intensity and the saving against running now, three non-overlapping runners-up, the worst window for contrast, and the full half-hourly forecast curve |
GET /, GET /health, GET /.well-known/x402 |
free | Service info, liveness, discovery manifest |
Every paid route returns the purchased artifact in the 200 response body.
The 402 challenge advertises both. Your client picks whichever it can sign.
base-sepolia · base on mainnetsolana · solana-devnet on devnetimport { wrapFetchWithPayment, createSigner } from "x402-fetch";
const signer = await createSigner("base-sepolia", process.env.PRIVATE_KEY!);
const payFetch = wrapFetchWithPayment(fetch, signer);
const res = await payFetch(
"http://localhost:4025/now?postcode=SW1A"
);
const artifact = await res.json(); // purchased artifact, in-response