-
-
Tab: the shop credit book you talk to
-
A polite reminder drafted on the device in the shop’s language; Tab never sends it
-
The book: who owes you and what came in this week, every entry read on the device
-
A Swahili entry the device cannot read, sent to Gemini in the cloud through Firebase AI Logic
-
A Spanish fiado entry read on the device by Gemini Nano, with an English line underneath
-
A handwritten notebook page imported on the device, line by line; crossed-out lines are one tap to skip
Inspiration
Small shops everywhere sell on credit and write it in a paper notebook: the khata in India, fiado in Mexico, utang at a Philippine sari-sari store, deni at a Kenyan duka. The notebook gets lost, the sums go wrong, and asking a regular customer for money is awkward. These shops also have the two problems hybrid inference was made for: patchy signal and no budget for cloud bills.
What it does
The shopkeeper says an entry the way they would say it to a person: "Maria took two loaves of bread and a carton of milk, six dollars, on credit." Tab turns it into a ledger entry, shows a card to check before saving, and adds up who owes what and what came in this week.
- Voice or typed entries in English, Spanish, Hinglish, Swahili or Tagalog. Every card shows where it was understood: "Understood on this device · free" or "Understood in the cloud".
- Import a paper page: photograph an old notebook page and the entries stream in line by line, read on the device; one tap reads it in the cloud instead (about 3 s). A built-in sample page lets anyone try it.
- Polite reminders: a short, friendly message in the shop's language. Tab never sends anything; the shopkeeper copies it or opens it in WhatsApp.
- An English line under any non-English entry or reminder, so anyone can check it.
- No signal is fine: entries save to the device and sync later.
How we built it
Every AI call goes through the Firebase AI Logic SDK with InferenceMode.PREFER_ON_DEVICE:
- Entries: Gemini Nano in Chrome for English, Spanish and Latin-letter Hinglish (structured JSON via
responseConstraint); Gemini 3.5 Flash-Lite in the cloud for Swahili, Tagalog, Devanagari and browsers without Nano (responseSchema). - Paper pages: Nano reads the JPEG on the device and we stream rows into the UI as the model writes them, parsing complete JSON objects from the partial answer. The cloud path is one tap away.
- Reminders: Nano writes English and Spanish drafts on the device; other languages use the cloud. A cloud call adds the English gloss.
Around the AI: App Check with reCAPTCHA Enterprise on every call, anonymous Authentication, Cloud Firestore with the persistent offline cache and security rules that let each shop read only its own book and reject malformed entries, and Firebase Hosting. React, TypeScript and Vite; 25 unit tests.
Challenges we ran into
- Chrome's on-device model takes text and JPEG/PNG only, no audio, and not Hindi. Voice goes through Chrome's speech recognition first, and we route languages the device cannot read to the cloud on purpose.
- An English entry once came back with its items in Spanish because the prompt listed every language. Each shop now gets a prompt in its own language, which also made on-device calls faster.
- Money must never be wrong. The model never does arithmetic: spoken Hindi number words ("dedh sau" = 150) become digits in code first, amounts are stored as integer cents, and every answer is validated before it can be saved.
- Speed: the cloud model was "thinking" by default. Minimal thinking took a typed entry from 7.5 s to 1.5 s and a full page to about 3 s. On the device, the first call after loading was slow, so the app warms the model up in the shop's language when it opens.
- A full page on the device takes about 25 s, so we stream the rows and offer the cloud as a visible choice.
Accomplishments we're proud of
- A real hybrid product, not a toggle: the shopkeeper sees which side did the work on every entry, and the app is honest about which languages work offline.
- On-device reading of a handwritten page, streamed line by line.
- Tested end to end: entries in five languages, the sample page on both paths, reminders on both paths, and an offline entry that saved and then synced.
What we learned
On-device AI changes the economics for small businesses: most entries cost nothing and never leave the device. The cloud is still essential for the languages and images the device cannot handle yet, and hybrid inference lets one code path serve both.
What's next
More languages on the device as Chrome adds them, an Android build with Gemini Nano through the same SDK, shared books for shops with two people at the counter, and an export for the shop's accountant.
Built during the submission period
All code was written from 16 Nov 2026, starting from the Vite React TypeScript template. AI coding assistance (Claude Code) was used. The sample notebook page is an image made for this project. No pre-existing app.
Try it
- Product site: https://khata-ledger-2026.web.app
- One-click demo book (nothing is saved): https://khata-ledger-2026.web.app/app/demo
- Code (Apache 2.0): https://github.com/0xvikram/tab-ledger
Built With
- chrome-built-in-ai
- cloud-firestore
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-hosting
- gemini
- gemini-nano
- react
- recaptcha-enterprise
- typescript
- vite