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.
$0.00088
a scan, plus $0.00066 if it asks a question
- The phone sends the photo to the server.
- The server checks Plus. If it cannot tell, it stops and counts nothing.
- It reserves one scan in Firestore.
- Gemini reads the plate. 3.4–4.9 s end to end.
- If that fails, the scan is refunded.
- The meal is saved on the phone.
Cost
Every number says where it came from.
| Service | Pays for | Today | Grows with | Basis |
|---|---|---|---|---|
| AskCal app | Expo, on iOS and Android | $0 | Nothing | StatedCLAUDE.md |
| Meal log and photos | MMKV and app documents, on the device | $0 | Nothing | Statedwiki/concepts/local-photos.md |
| api | Cloud Function · 512 MiB · max 10 | ₹0.03, after ₹3.97 of free tier | Requests: 1,004 in 30 days | MeasuredCloud Billing report, Oct 1-30, read 2026-10-30 |
| Gemini | Reads a plate · swap by config | ₹30.84 in Oct, from Aakalan's prepaid balance | Photo scans and clarifies | MeasuredCloud Billing and AI Studio, 2026-10-30; ops/gemini-credits.md |
| USDA FoodData | Not read | Food searches: 251 in 30 days, two calls each | Not known | |
| Firestore | Scan counters only | ₹0: no line on the October bill | Every quota check: 594 of the 1,004 requests | MeasuredCloud Billing report, Oct 1-30, read 2026-10-30 |
| RevenueCat | Is this user on Plus? | Not read | Subscription revenue | Not known |
| EAS | Builds and updates | Not read | Builds, app updates | Not known |
| App Store · Google Play | Payments and installs | $8 / mo Apple fee, shared by all products | Nothing | StatedAnother 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 fails | The user sees | Their data | Basis |
|---|---|---|---|
| api | Scans and search stop. Manual logging should still work. | Safe, on the phone | AssumedThe log lives in MMKV; no test named |
| Gemini | The 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 phone | In codewiki/concepts/metering.md; src/quota.ts refundScan |
| Firestore | Not written down. | Only counters there | Not known |
| RevenueCat | "Could not check", answered with 409. No scan is counted against them. | Safe | Measuredops/incidents/2026-09-22-entitlement-lockout.md |
Where the data goes
| Scanned photo | To the server, then the model |
| Meal log | Stays on the phone |
| Saved photos | Stay on the phone; leave only through the share sheet |
| Scan counts | Firestore |
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.