AlifZetta GSI · API Reference

Sovereign, sub-5ms answer API for Nepal. No RAG, no vector DB, no chain-of-thought — pure grounded structural intelligence with 18 live/curated handlers.

v1 · demo.axz.si · Public preview

Overview

Every query is routed through a fallthrough chain: smalltalk → semantic cache → emergency handler → 12 live/curated handlers → intent dispatch → curated KB (100K+ entries) → web fallback. First hit wins. Warm-path latency: P50 2ms · P95 3ms.

Live handlers12
Curated KB entries94,300
Emergency cards16 · bilingual
Gold-eval pass rate177 / 177 · 100%
P50 warm latency2 ms
P95 warm latency3 ms

Answer endpoint

POST /api/gsi/answer

Route a free-text query to the most appropriate handler and return a structured answer.

Request

POST https://demo.axz.si/api/gsi/answer
Content-Type: application/json

{"query": "petrol price nepal"}

Response

{
  "answer_en":  "⛽ Nepal fuel prices — NOC reference (Kathmandu Valley retail)\n...",
  "grounded":   true,
  "source":     "fuel_handler",
  "match": {
    "id":         "fuel:petrol",
    "title":      "Petrol — NPR 175/litre",
    "category":   "curated_fuel",
    "score":      1800.0,
    "highlighted":"petrol",
    "prices_npr": { "petrol": {"unit":"litre","price":175.00,...}, ... }
  },
  "citations": [{"kind":"curated","source":"Nepal Oil Corporation (noc.org.np)",...}],
  "traversal_trace": ["fuel_handler: petrol"],
  "query_class": "live_handler",
  "compute_ms":  2.4,
  "_cache":      {"hit": false, "key": null},
  "_intent":     {"intent":"fuel","confidence":0.85,...}
}

Handlers

emergency_handler

16 bilingual first-aid cards (snake bite, heart attack, stroke, burn, drowning, choking, seizure, poisoning, fire, quake, flood, landslide, suicide, DV, child abuse).

weather_handler

Live weather for 15 Nepal cities via open-meteo. Bilingual card + advisory (heat, cold, thunder, wind, rain).

aqi_handler

US AQI + PM2.5 + PM10 via open-meteo. 6-level bilingual health advisory.

quake_handler

USGS earthquake feed filtered to Nepal region. Latest quake + 30-day totals + magnitude advisory.

news_handler

Top 8 bilingual headlines from Gorkhapatra + Kantipur + Nagarik + BBC Nepali + Setopati + Al Jazeera + NYT.

calendar_handler

AD ↔ BS date, weekday bilingual, Nepal fiscal year, Bikram Sambat panchang.

currency_handler

Live NPR conversion for USD/EUR/GBP/INR/AED/+9 via open.er-api.com (ECB daily).

holiday_handler

Next Nepal public holiday + all remaining this year (Dashain, Tihar, Buddha Jayanti, Chhath, etc).

distance_handler

Curated km + drive-time between top Nepal cities (KTM ↔ Pokhara, Chitwan, Biratnagar, etc).

geography_handler

Peaks (8 eight-thousanders), rivers (Koshi, Gandaki, Karnali, Bagmati, Mahakali), lakes (Rara, Phewa, Tilicho).

fuel_handler

NOC reference prices for petrol / diesel / kerosene / LPG cylinder.

metals_handler

FENEGOSIDA daily reference for gold (24k / 22k / worked) and silver, per tola + per 10g.

bank_handler

NRB policy rate + commercial bank savings / FD / home / auto / personal loan rates.

calculator

AST-based safe arithmetic (2+2, 2**10, sqrt, log, etc).

date_time

Current NPT + BS date + weekday.

smalltalk_guard

Handles greetings, name questions, capability probes bilingually.

curated_kb

94,300 keyword-indexed entries across ministries, services, culture, medical pathways.

web_fallback

Wikipedia + DuckDuckGo when no KB confidence — Nepal-context biased.

Auxiliary endpoints

GET /api/news/today

Structured JSON of today's Nepal news feed (up to 20 items from 13 sources). Refreshed every 30 min.

GET /api/cache/live/stats

Live-handler cache stats (hits, misses, hit-rate, active entries, TTL config).

GET /api/log/stats?hours=24

Query volume + P50/P95 latency + cache hit-rate for the rolling window.

GET /api/log/top?hours=168&limit=20

Top-N most-frequent queries.

GET /api/log/misroutes?hours=168&limit=20

Actionable KB-expansion targets: queries with low confidence + low volume.

GET /admin/analytics.html

Auto-refreshing analytics dashboard (24h volume, top queries, misroutes, coverage, cache stats).

Example curls

# Emergency (safety-critical, highest score)
curl -sS -X POST https://demo.axz.si/api/gsi/answer \
  -H 'Content-Type: application/json' \
  -d '{"query":"snake bite emergency"}' | jq

# Live weather (any of 15 Nepal cities, bilingual)
curl -sS -X POST https://demo.axz.si/api/gsi/answer \
  -H 'Content-Type: application/json' \
  -d '{"query":"पोखराको मौसम"}' | jq

# Currency (100 USD → NPR)
curl -sS -X POST https://demo.axz.si/api/gsi/answer \
  -H 'Content-Type: application/json' \
  -d '{"query":"100 usd in npr"}' | jq

Design principles