Skip to content

AQI calculator (US EPA)

FREE with proof-of-workor $0.001 in USDCGET /api/aqi-calc

US EPA Air Quality Index from the pollutant concentrations you supply: PM2.5 and PM10 (µg/m³, 24-hour), ozone (ppb, 8-hour), carbon monoxide (ppm, 8-hour), sulfur dioxide and nitrogen dioxide (ppb, 1-hour). Send GET /api/aqi-calc with no required fields (6 optional) and pay $0.001 per call over x402 or MPP, or call it free by solving a proof-of-work challenge. It returns a JSON object with aqi, category, dominantPollutant, pollutants and scale.

Returns each pollutant's sub-index and category, the overall AQI (the highest sub-index) and the pollutant that sets it, using the published EPA breakpoint tables with the 2024 PM2.5 revision.

Category: Live public dataTags: aqi air-quality pm25 ozone pollution epa calculator

Try in playground →

Parameters

NameTypeRequiredDescription
pm25numbernoPM2.5, µg/m³, 24-hour average
pm10numbernoPM10, µg/m³, 24-hour average
o3numbernoOzone, ppb, 8-hour average
conumbernoCarbon monoxide, ppm, 8-hour average
so2numbernoSulfur dioxide, ppb, 1-hour average
no2numbernoNitrogen dioxide, ppb, 1-hour average

Example request

curl -i "https://agent402.tools/api/aqi-calc?pm25=35.4&pm10=80&o3=60"

Without payment this returns HTTP 402 Payment Required with the exact price for aqi-calc; any x402 v2 or MPP client pays it and retries.

Example response

{
  "aqi": 100,
  "category": "Moderate",
  "dominantPollutant": "pm25",
  "pollutants": [
    {
      "pollutant": "pm25",
      "name": "PM2.5",
      "concentration": 35.4,
      "unit": "µg/m³",
      "averaging": "24-hour",
      "aqi": 100,
      "category": "Moderate"
    },
    {
      "pollutant": "pm10",
      "name": "PM10",
      "concentration": 80,
      "unit": "µg/m³",
      "averaging": "24-hour",
      "aqi": 63,
      "category": "Moderate"
    },
    {
      "pollutant": "o3",
      "name": "Ozone",
      "concentration": 60,
      "unit": "ppb",
      "averaging": "8-hour",
      "aqi": 67,
      "category": "Moderate"
    }
  ],
  "scale": "US EPA Air Quality Index (40 CFR Part 58 Appendix G; PM2.5 breakpoints as revised in 2024)"
}
FieldTypeAlways presentIn the example
aqinumberyes100
categorystringyesModerate
dominantPollutantstringyespm25
pollutantsarray of objectsyes3 items in the example
scalestringyesUS EPA Air Quality Index (40 CFR Part 58 Appendix G; PM2.5 breakpoints as rev...

From an MCP client

catalog.call {
  "slug": "aqi-calc",
  "params": {
    "pm25": 35.4,
    "pm10": 80,
    "o3": 60
  }
}

On the hosted connector at https://agent402.tools/mcp, catalog.call runs aqi-calc free (rate-limited, no wallet). Local install: npx -y agent402-mcp@0.13.32.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.001" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/aqi-calc?pm25=35.4&pm10=80&o3=60");

No wallet? Pay with compute

Fetch a challenge, solve the sha256 puzzle (16 leading zero bits, a fraction of a second of CPU), and resend with the X-Pow-Solution header:

import { createHash } from "node:crypto";
const lz = (b) => { let t = 0; for (const x of b) { if (!x) { t += 8; continue; } t += Math.clz32(x) - 24; break; } return t; };
const c = await (await fetch("https://agent402.tools/api/pow/challenge?slug=aqi-calc")).json();
let n = 0;
while (lz(createHash("sha256").update(c.challenge + ":" + n).digest()) < c.difficulty) n++;
await fetch("https://agent402.tools/api/aqi-calc?pm25=35.4&pm10=80&o3=60", { method: "GET", headers: { "X-Pow-Solution": c.token + ":" + n } });

Related tools

Air quality (global)

$0.002GET /api/weather-air-quality

Air quality index and current pollutant concentrations for any location: US AQI, PM2.5, PM10, ozone, NO2, SO2, CO.

Degree days calculator

FREE w/ computeor $0.001POST /api/degree-days-calc

Heating, cooling and growing degree days from a daily temperature series you supply: daily means, or min/max pairs (the.

Heat index and wind chill calculator

FREE w/ computeor $0.001GET /api/heat-index-calc

Heat index, wind chill, humidex, dew point and wet-bulb temperature from the temperature, humidity and wind you supply.

A2A Agent Card validate

FREE w/ computeor $0.002POST /api/a2a-card-validate

Validate an A2A (Agent2Agent protocol) Agent Card: required fields, skill shape, transport names, capability flags.

Amortization schedule

FREE w/ computeor $0.001POST /api/amortization

Build the full per-period amortization schedule for a fully-amortizing loan.

Annuity present/future value

FREE w/ computeor $0.001POST /api/annuity

Present and future value of a level annuity (equal periodic payments).