Overview
Every query is routed through a fallthrough chain: smalltalk → semantic cache → emergency handler → 12 live/curated handlers → intent dispatch → curated KB (17.3M entries) → web fallback. First hit wins. Warm-path latency: P50 2ms · P95 3ms.
Answer endpoint
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
17.3M keyword-indexed entries across ministries, services, culture, medical pathways.
web_fallback
Wikipedia + DuckDuckGo when no KB confidence — Nepal-context biased.
Auxiliary endpoints
Structured JSON of today's Nepal news feed (up to 20 items from 13 sources). Refreshed every 30 min.
Live-handler cache stats (hits, misses, hit-rate, active entries, TTL config).
Query volume + P50/P95 latency + cache hit-rate for the rolling window.
Top-N most-frequent queries.
Actionable KB-expansion targets: queries with low confidence + low volume.
Auto-refreshing analytics dashboard (24h volume, top queries, misroutes, coverage, cache stats).
Partner search API
One call returns an AlifZetta engine answer (text, sources, confidence, source tier) plus web results (title, url, snippet). English and Nepali. Requires a partner key with scope search (or full) in the X-Partner-Key header. Keys are issued by padam@axz.si.
Server to server only. Call this from your backend. Never ship the key in a web page or a mobile app; browser CORS is not enabled for this endpoint.
Request
POST https://demo.axz.si/api/partner/search
X-Partner-Key: <your search key>
Content-Type: application/json
{"q": "who is the prime minister of Nepal", "lang": "auto", "limit": 5, "include_web": true, "safe": true}
| Field | Type | Default | Notes |
|---|---|---|---|
q | string | required | Up to 500 characters. query is accepted as an alias. |
lang | en | ne | auto | auto | auto picks ne when the query contains Devanagari. |
limit | int 1 to 10 | 5 | Maximum web results. |
include_web | bool | true | false returns the engine answer only (faster). |
safe | bool | true | Accepted for forward compatibility. The abuse guard is always on. |
GET takes the same fields as query parameters, for example /api/partner/search?q=capital%20of%20nepal&include_web=false.
Response
{
"ok": true,
"query": "who is the prime minister of Nepal",
"lang": "en",
"answer": {
"text": "As of 2026, the Prime Minister of Nepal is Balen Shah, sworn in on 27 March 2026. ...",
"sources": [{"title": "balen shah", "url": null}],
"confidence": 0.99,
"engine": "alifzetta-gsi",
"tier": "canonical_query",
"grounded": true,
"status": "ok"
},
"web": [
{"title": "Prime Minister of Nepal", "url": "https://en.wikipedia.org/wiki/Prime_Minister_of_Nepal", "snippet": "The Prime Minister of Nepal is the head of government ..."}
],
"status": {"answer": "ok", "web": "ok"},
"took_ms": 611,
"request_id": "srch_2b6a442d36b1"
}
Each section reports its own status (ok, empty, timeout, error, skipped). If one source fails the other is still returned. Budgets: answer about 12 s, web about 8 s.
DTL v0.1 output
Send Accept: application/dtl or add ?format=dtl. The body is a signed DTL v0.1 document with header @DTL v0.1 | dom:dtSRCH | C0 | cs:<sha256> | prf:partner-search | ts:.... dtSRCH is a custom domain code (DTL v0.1 has no search domain); C0 because search results are public. The checksum is also in the X-DTL-CS response header.
Errors and quotas
| HTTP | error | Meaning |
|---|---|---|
| 400 | missing_query, query_too_long, invalid_lang, invalid_json | Fix the request. |
| 401 | missing_partner_key, invalid_partner_key | Header absent or key unknown. |
| 403 | scope_not_allowed | Key exists but is not a search key. |
| 422 | content_policy_violation | Abusive or unsafe query. A polite message in the request language is included. |
| 429 | quota_exceeded | Hourly quota used. Honour the Retry-After header (seconds). |
| 503 | upstream_unavailable | Both the engine and web search failed. Retry with backoff. |
Every response carries X-Request-Id. Successful responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Quotas are per key per clock hour; nginx also applies a per-IP burst limit.
Example
curl -sS -X POST https://demo.axz.si/api/partner/search \
-H "X-Partner-Key: $AZ_SEARCH_KEY" -H 'Content-Type: application/json' \
-d '{"q":"नेपालको प्रधानमन्त्री को हुन्?","lang":"ne","limit":3}' | jq
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
- Sovereign. No proprietary LLM, no external RAG, no vector database, no chain-of-thought. Pure grounded structural intelligence.
- Bilingual by default. Every handler accepts English + Nepali (Devanagari) queries and emits bilingual response fields.
- Safety-first. Emergency handler runs UNCONDITIONALLY before any intent classifier — safety trumps latency.
- Warm-path fast. Live handlers cache with per-intent TTL. P95 3ms warm; cold live-fetch 200-500ms one-time.
- No black boxes. Every response includes
traversal_trace,citations, and_intentmetadata.