cacheball
roll the pagesource on GitHub
README
runs onany web pagedepsnonesize23 KBmodelssonnet 5.5 · opus 5.5licenseMIT

cacheball

Roll your agent's context up any web page. Every word you pick up grows the ball, and the ball is what the next turn re-reads from cache.

Cache reads cost $0.20 per 1M on both Sonnet 5.5 and Opus 5.5. So the bigger the ball gets, the smaller the gap between the two models:

context in cacheSonnet 5.5 / turnOpus 5.5 / turnOpus / Sonnet
20K$0.033$0.0621.88x
150K$0.059$0.0881.49x
400K$0.109$0.1381.26x

The counter in the corner shows that ratio live while you roll.

Run it

Open any page, this README included, and paste cacheball.js into the browser console. Or save bookmarklet.txt as a bookmark and click it on any page.

inputwhat it does
mouse, touchroll toward the pointer
arrows, WASDroll
Enterhand off early and see your result
Rroll again from the result card
Ccopy your result
Mmute
Escquit and put every word back

Small words first. Big headings and images stay put until the ball is big enough to take them. Stop for 5 seconds and the cache goes cold: the next pickup pays a cache miss.

Missions and the ending

Eight missions run while you roll: 25 words, a lucky word, a x10 combo, two cache sizes, one heading or image, 20 seconds with a warm cache and a clear page. The cache sizes scale with the page you play on.

Clear 97% of the page and the last words fly into the ball on their own. Then the ball collapses into a 20K handoff.md and you get a result card: words, time, context, cache misses, how far opus / sonnet dropped and a rank from S to C. S means a cleared page, all eight missions and zero cache misses.

Measure your own logs

cost.py reads one JSON line per Messages API call and prints $/turn and $/pass per model.

python cost.py usage.example.jsonl

Read it in this order: the $/turn ratio, the avg turns ratio, then $/pass.

Rules worth remembering

switching models mid-session   -> new session + handoff, never the transcript
switch at 300K context         -> 300,000 x $5 / 1M = $1.50 just to re-cache
same switch with 20K handoff   -> $0.10
one cache miss at 150K         -> $0.38 Sonnet / $0.75 Opus

Prices are Anthropic's standard API rates as of October 3, 2026.

About

Roll your agent's context up any web page. Watch Opus 5.5 go from 2x to 1.26x the price of Sonnet 5.5.

agentsprompt-cachingclaudebookmarkletkatamari

★ 0 stars · 1 watching · 0 forks

Languages

JavaScript 78.4% · Python 21.6%

cacheball

Roll your agent's context up this page.
Every word you pick up grows the ball.

watch opus / sonnet drop from 1.9x toward 1.26x

8 missions · clear the page · get a rank

mouse or touch to roll · arrows / WASD · Enter hand off · Esc quit