AI Server API
Base URL: http://localhost:8000
Interactive docs: http://localhost:8000/docs
Endpointsโ
GET /healthโ
Returns service status and cache metadata.
{
"status": "ok",
"model_exists": true,
"forecast_cache_exists": true,
"last_compute": "2026-04-28T10:00:00+00:00",
"cache_fresh": true,
"compute_running": false,
"scheduler": { "running": true, "next_run": "2026-04-28T11:00:00+00:00" }
}
GET /forecast/currentโ
Query: ?profile=general
Returns current PM2.5, AQI, risk level, recommendation, and weather data.
GET /forecast/rangeโ
Query: ?days=7&profile=general
Returns hourly PM2.5 and AQI forecast for up to 7 days.
GET /historyโ
Query: ?days=30&profile=general
Returns hourly historical PM2.5 data for up to 30 days.
GET /anomaly/latestโ
Returns the most recent anomaly detection event if any.
POST /admin/computeโ
Requires header: X-Admin-Key: your_admin_key
Triggers a background recompute of all cache files.