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.

7 to 8 min read • View on GitHub • More from PriyaPandey19

A Kirana shop counter shown as a transition from paper to software. A battered notebook sits beside a phone receiving a WhatsApp voice note, and the note appears to flow into a tidy ledger grid and dashboard screen. The image explains that the product turns spoken udhaar into structured bookkeeping.
KhataAI’s real interface breakthrough is not the model. It is the translation of informal speech into a ledger that can be queried, scored, and synced.
Key Takeaways

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.

This pipeline is the project’s real product thesis. Spoken input is accepted, structured, scored, corrected if needed, and then pushed live without making the shopkeeper notice the machinery.

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.

ProductPrimary userInput styleVoice supportWhatsApp-native workflowRisk scoring / intelligenceFallback resilienceBest fit
KhataAIKirana shopkeeperVoice note or chatYesYesYes, hybrid rules plus LLMDesigned inInformal credit capture
KhatabookSmall merchantManual entryLimitedNoBasic ledger insightsNot the focusDigital khata replacement
OkCreditSmall merchantManual or assisted entryLimitedNoLedger reminders and summariesNot the focusDigital bahi khata
VyaparSmall business ownerForms and billing screensLimitedNoInventory and billing automationModerateBroader SME operations
Zoho BooksBusiness accounting userStructured formsNoNoAccounting automation and bookkeepingStrong but formalFull accounting workflows
Generic AI accounting toolsAccounting team or SMEDocument upload or APIsSometimesNoCategorization and anomaly detectionVariesEnterprise 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.

A close-up of a split mechanism that transforms a loose voice transcript into structured ledger data. On the left, handwritten fragments from speech appear as raw text. On the right, the same input becomes a neat card with customer name, amount, type, and risk badge. A small lever below routes failure into a fallback path instead of stopping the machine. The image explains the hybrid intelligence layer and its safety net.
The interesting part of KhataAI is not that it uses an LLM. It is that the LLM sits inside a system with a deterministic escape hatch.

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 choiceWhat it protectsWhy it matters
shopId filteringTenant isolationEach shop sees only its own ledger
Compound indexesLookup speedNames and balances stay searchable at small-business scale
Transaction source fieldTraceabilityManual, voice, and WhatsApp entries remain distinguishable
Role of the serverCoordinationThe 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.