Skip to content

Work / AskCal / Architecture

AskCal architecture

A phone app that keeps the meal log on the device. One small server does only what the phone cannot: read a plate, look up food, and count paid scans.

last verified 2026-10-30

Known cost a month
$8 + ₹45
Apple fee, shared across products, this project's ₹14, and ₹31 of Gemini paid from Aakalan's balance.
What makes cost grow
Photo scans
Barcode, search and manual logging do not call the model.
Plus user at the 100-scan cap
$0.11 / mo
Against a $5.99 monthly price, before store fees.

How it fits together

Pick something a user does to see its path and what it costs.

On the phoneOur server · asia-south1Outside servicesAskCal appAskCal appExpo, on iOS and Android$0Meal log and photosMeal log and photosMMKV and app documents, on the device$0apiapiCloud Function · 512 MiB · max 10₹0.03, after ₹3.97 of free tierGeminiGeminiReads a plate · swap by config$0.00088 a scanUSDA FoodDataUSDA FoodDataNot readFirestoreFirestoreScan counters only₹0: no line on the October billRevenueCatRevenueCatIs this user on Plus?Not readEASEASBuilds and updatesNot readApp Store · Google PlayApp Store · Google PlayPayments and installs$8 / mo AppleSecret ManagerSecret Manager
$0.00088
a scan, plus $0.00066 if it asks a question
  1. The phone sends the photo to the server.
  2. The server checks Plus. If it cannot tell, it stops and counts nothing.
  3. It reserves one scan in Firestore.
  4. Gemini reads the plate. 3.4–4.9 s end to end.
  5. If that fails, the scan is refunded.
  6. The meal is saved on the phone.

Cost

Every number says where it came from.

ServicePays forTodayGrows withBasis
AskCal appExpo, on iOS and Android$0NothingStatedCLAUDE.md
Meal log and photosMMKV and app documents, on the device$0NothingStatedwiki/concepts/local-photos.md
apiCloud Function · 512 MiB · max 10₹0.03, after ₹3.97 of free tierRequests: 1,004 in 30 daysMeasuredCloud Billing report, Oct 1-30, read 2026-10-30
GeminiReads a plate · swap by config₹30.84 in Oct, from Aakalan's prepaid balancePhoto scans and clarifiesMeasuredCloud Billing and AI Studio, 2026-10-30; ops/gemini-credits.md
USDA FoodDataNot readFood searches: 251 in 30 days, two calls eachNot known
FirestoreScan counters only₹0: no line on the October billEvery quota check: 594 of the 1,004 requestsMeasuredCloud Billing report, Oct 1-30, read 2026-10-30
RevenueCatIs this user on Plus?Not readSubscription revenueNot known
EASBuilds and updatesNot readBuilds, app updatesNot known
App Store · Google PlayPayments and installs$8 / mo Apple fee, shared by all productsNothingStatedAnother product's architecture page; no receipt read

What if it grows?

The model's cost only. Other services stay unknown until their bills are read.

Scans a month
Model cost at the paid rate
$0.09 / mo
Scans a month, per day
3

Prepaid, so there is no free-tier limit here. Uses the live figure, $0.00088 a scan. It predates the current model, which measured $0.00028 in testing, so this is the high estimate. Today's 97 scans include the owner's own testing.

What breaks when something fails

If this failsThe user seesTheir dataBasis
apiScans and search stop. Manual logging should still work.Safe, on the phoneAssumedThe log lives in MMKV; no test named
GeminiThe scan fails and is refunded, and the screen says so. Barcode, search and manual logging stay on screen. The same happens when the prepaid balance reaches ₹0.Safe, on the phoneIn codewiki/concepts/metering.md; src/quota.ts refundScan
FirestoreNot written down.Only counters thereNot known
RevenueCat"Could not check", answered with 409. No scan is counted against them.SafeMeasuredops/incidents/2026-09-22-entitlement-lockout.md

Where the data goes

Scanned photoTo the server, then the model
Meal logStays on the phone
Saved photosStay on the phone; leave only through the share sheet
Scan countsFirestore

What we do not know yet

  • About ₹320-710 of credit is spent before both balances expire on 2027-09-11, so most of AskCal's ₹2,500 goes unused unless scans grow or it is refunded. See ops/gemini-credits.md.
  • RevenueCat and EAS bills are not read.
  • Two scan costs disagree: $0.00088 live, $0.00028 in testing.
  • wiki/entities/scan-cost.md says $0.11 at the cap, but 100 × $0.00088 is $0.088.