KhataAI-Project: KhataAI: Turning WhatsApp Voice Notes Into a Working Credit Ledger
An AI-powered Khata system for Kirana shops that combines Hinglish transcription, fuzzy customer matching, and rule-based risk scoring so informal credit can be tracked without forcing shopkeepers into software-shaped behavior.
- KhataAI’s main innovation is not AI by itself, but a voice-first ledger flow that fits how Kirana shops already work.
- The repo pairs LLM-based parsing with deterministic rules so a bad model response does not break transaction capture.
- Its architecture treats WhatsApp, transcription, matching, scoring, and dashboard sync as one product loop instead of separate features.
- Compared with broader accounting tools, KhataAI is narrower, more conversational, and better aligned with informal credit.
The Ledger That Lives Inside WhatsApp
KhataAI starts with a simple but unusually strong idea: a shopkeeper should be able to speak a credit entry, and the system should do the bookkeeping. A voice note in Hinglish becomes structured transaction data, then the web dashboard updates immediately. That is not a chatbot trick. It is a workflow design choice that treats WhatsApp as the front door and the ledger as the hidden engine.
That matters because the real friction in informal credit is not the math. It is the typing, the naming, the follow-up, and the fear of software that does not match the shop floor. KhataAI tries to erase those steps instead of training the user to become a better data entry clerk.
At a product level, that is a strong move. The user experience is conversational, but the backend still has a ledger’s discipline. KhataAI tries to keep both truths alive at once.
Why Kirana Shops Need a Different Kind of Software
Kirana shops do not behave like accounting departments. They run on memory, trust, repeated customers, handwritten notebooks, and a tolerance for ambiguity that standard finance software often punishes. A system that expects precise typing, clean taxonomy, and desktop attention loses before it starts.
That is why WhatsApp is not a gimmick here. It is already the interface many small merchants use all day. Voice is not a convenience feature either. It is the fastest way to capture a transaction when both hands are busy and the customer is still standing at the counter.
| Product | Primary user | Input style | Voice support | WhatsApp-native workflow | Risk scoring / intelligence | Fallback resilience | Best fit |
|---|---|---|---|---|---|---|---|
| KhataAI | Kirana shopkeeper | Voice note or chat | Yes | Yes | Yes, hybrid rules plus LLM | Designed in | Informal credit capture |
| Khatabook | Small merchant | Manual entry | Limited | No | Basic ledger insights | Not the focus | Digital khata replacement |
| OkCredit | Small merchant | Manual or assisted entry | Limited | No | Ledger reminders and summaries | Not the focus | Digital bahi khata |
| Vyapar | Small business owner | Forms and billing screens | Limited | No | Inventory and billing automation | Moderate | Broader SME operations |
| Zoho Books | Business accounting user | Structured forms | No | No | Accounting automation and bookkeeping | Strong but formal | Full accounting workflows |
| Generic AI accounting tools | Accounting team or SME | Document upload or APIs | Sometimes | No | Categorization and anomaly detection | Varies | Enterprise or firm workflows |
The comparison makes the niche obvious. KhataAI is not trying to out-feature an accounting suite. It is trying to win a very specific moment: a spoken udhaar entry that needs to become reliable data immediately.
The Hybrid Risk Engine Behind the Scenes
The repo’s most interesting technical move is the hybrid engine in Riskpredictor.py and Voiceparser.py. It does not ask the LLM to do everything. First comes a rule-based pre-score. Then, only when needed, the system sends the result through LLM refinement. That split matters because it makes the product more predictable before it becomes more intelligent.
The parser also does the unglamorous work that makes the whole thing usable. It maps transcripts into structured fields like customerName, amount, and type, and it uses fuzzy matching to connect spoken names to existing customer records. In practice, that means the system can survive misspellings, partial names, and the sloppy edges of real speech.
def pre_score(balance, days_since_last_payment):
score = 0
if balance > 0:
score += min(balance / 1000, 50)
if days_since_last_payment > 7:
score += min(days_since_last_payment, 50)
return min(score, 100)
# If the score crosses the threshold, route to LLM refinement.
# If the response is invalid, fall back to deterministic rules.
That is the right shape for a financial assistant in a low-trust setting. The system is allowed to be smart, but it is not allowed to be fragile.
Why the System Stays Useful Even When the LLM Fails
This is where KhataAI becomes more serious than a demo. If the model output is malformed, invalid, or unavailable, the workflow does not collapse. The deterministic path takes over and the ledger still gets an answer. For a shopkeeper, that is the difference between an experiment and a tool.
It also changes the product story. The point is not that AI is always in charge. The point is that AI improves the system when it is available, while rules preserve the minimum viable behavior when it is not.
The Backend Is a Glue Layer, Not Just an API
On the backend, the Node and Express server acts like a traffic controller. Twilio handles WhatsApp input, the ML service handles transcription and structured interpretation, MongoDB stores the ledger, and Socket.io pushes the updated state back to the dashboard without a refresh. The server is not the intelligence layer. It is the connective tissue that keeps the layers honest.
The architecture is ordinary in the best sense. Each piece does one job. WhatsApp brings the input, the ML service interprets it, and the dashboard reflects it. That is a good sign for maintainability, and a better sign for product clarity.
Multi-Tenant by Design
KhataAI also shows a sensible small-business scaling instinct. Queries are filtered by shopId, and the model layer uses compound indexes such as {shopId: 1, name: 1} to keep each shop’s data isolated and searchable. That is not literal distributed sharding, but it is the same discipline: keep tenants separate, keep lookups fast, and keep one merchant’s records from bleeding into another’s.
| Design choice | What it protects | Why it matters |
|---|---|---|
| shopId filtering | Tenant isolation | Each shop sees only its own ledger |
| Compound indexes | Lookup speed | Names and balances stay searchable at small-business scale |
| Transaction source field | Traceability | Manual, voice, and WhatsApp entries remain distinguishable |
| Role of the server | Coordination | The system stays readable as features grow |
This is one of the quieter strengths of the repo. It treats a micro-merchant product as multi-tenant software from the start, not as a single-user prototype with a login screen.
Where KhataAI Sits in the Market
Put next to Khatabook, OkCredit, Vyapar, Zoho Books, or generic AI accounting tools, KhataAI looks narrower on purpose. That narrowness is the point. It is not trying to manage inventory, invoices, payroll, and tax. It is trying to make informal credit entry feel natural, fast, and resilient inside a channel the user already trusts.
That gives it a different product identity. The broader tools are suites. KhataAI is a workflow layer. If it works, it could be the kind of software a shopkeeper barely notices, which is usually the highest compliment in this category.
What This Repo Suggests About the Next Wave of Fintech UX
KhataAI points toward a useful rule for software built for informal economies. The interface should be conversational, the system should tolerate ambiguity, and the architecture should assume that AI will sometimes fail. In that world, the winning product is not the smartest model. It is the one that keeps working when the model is wrong.
That is why this repo is worth noticing. It treats conversational input as infrastructure, not novelty. And for a Kirana shopkeeper, that may be the difference between another app and a real tool.