◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SONNET 4.5 — Retires on the Claude API on 11/30, 34 days left. If your app calls it, check the migration target●SDK 58 ISSUE — Early reports include Android widgets not refreshing on a schedule and Stripe linking statically●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SONNET 4.5 — Retires on the Claude API on 11/30, 34 days left. If your app calls it, check the migration target●SDK 58 ISSUE — Early reports include Android widgets not refreshing on a schedule and Stripe linking statically●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/AI Models
◉ AI Models/2026-10-27Advanced

Remembering What the AI Decided: Four Marks in the Cache Key Paid Off on Model-Swap Day

A small on-device cache for AI answers, with the model name and prompt version in the key so old answers vanish on swap day. TypeScript plus simulated results.

Rork604cache designMMKV7TypeScript9AI integrationmodel swapindie development44

✦ Premium Article

I was scrolling a wallpaper list slowly one evening. Every time I scrolled back to a picture I had just passed, another classification request went out. Nothing changed on screen. Only the request count, and eventually the bill, changed.

As an indie developer, I use an image-reading AI to sort wallpapers into categories. A few people have asked how to do the same inside an app, so I wrote down the layer I would put in a Rork-built screen: one that remembers answers. The hard part turned out not to be remembering. It was deciding when to forget.

Below is the TypeScript for a small cache layer, exactly as I ran it, followed by results from a 400-image simulated catalog on my machine's Node. These are simulated runs with a fixed random seed, not measurements on a phone, and I want to say that up front.

What to remember, and what not to

Remember answers that can safely stay the same for the same input. A wallpaper category fits: if the image does not change, neither does the answer. A conversational reply does not, because it is allowed to differ each time.

Decide what not to remember, too. If the AI reports low confidence, do not store the answer. A stored low-confidence answer freezes that vagueness in place, and the image keeps the same fuzzy label every time you see it.

SituationStore it?Why
Classification with confidence 0.9YesSame image, same answer is fine
Classification with confidence 0.4NoStoring it would freeze the vagueness
Network failure or timeoutNoA stored failure keeps coming back after the network recovers
Right after swapping the model or promptIgnore old versionsOld answers would pass as new ones

Four marks go in the key

The image ID alone is not enough for a cache key. Put these four side by side.

MarkExampleWhat happens without it
taskwallpaper-categoryAnswers for different jobs get mixed up
modelclaude-sonnet-5-5After a model change, the old model's answers keep coming back
promptVersionp3Edited instructions still get answers from before the edit
contentIdthe image IDYou cannot tell which image an answer belongs to

You can see why the model belongs in the key by trying the naive version. I keyed on the image ID alone with a 30-day expiry, swapped the model, and counted the next 1,000 views. All 1,000 were answers from the old model. An expiry is a way to throw away what has become old; it is not a way to throw away what has been replaced.

For context on timing, Anthropic deprecated Claude Sonnet 4.5 (claude-sonnet-4-5-20250929) on September 30, 2026, with API retirement tentatively set for November 30. The recommended replacement is claude-sonnet-5-5. I wrote about finding model IDs hard-coded in an app in Find out whether your Rork app still calls Sonnet 4.5, before November 30. The layer below is where you land safely once you have found them.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You can now copy a small layer that remembers the AI's answers on the device, and cut repeat calls for the same image to almost zero on the second launch
✦You will be able to stop old answers from lingering on screen after you swap a model or a prompt, before you ship
✦You can now spot, before writing it, the bug where one failed request makes every retry fail too
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◉ AI Models2026-04-25
Rork AI App Builder 2026 Review: What 3 Months and 3 Shipped Apps Taught Me
An honest review from an indie developer who shipped three apps to the App Store using Rork over three months. The real strengths, the real friction, and whether the price tag holds up.
◉ AI Models2026-10-27
Sending temperature to the Claude API Now Returns a 400 on the New Version. Finding Every Spot in Your App
Claude API version 2026-10-21 returns a 400 if you send temperature, top_p or top_k. When it hits you, a script to scan your app and SDK setup, and the order to fix things in.
◉ AI Models2026-10-25
Is Your Rork App Still Calling Sonnet 4.5? Finding Out Before November 30
Claude Sonnet 4.5 is scheduled to retire from the API on November 30, 2026. A small script to find leftover model IDs in your app, and the order to fix them in depending on where they live.