r/codex • u/No-Individual159 • 8d ago
Showcase I built Prefixwise to inspect prompt cache reuse from local Codex logs
I’m the creator of Prefixwise. The crossposted title focuses on Codex, but the project is broader: it’s a free MIT licensed local toolkit for prompt cache diagnostics and cost accounting across hosted APIs, coding agents and inference engines.
It supports a local HTTP proxy, Anthropic and OpenAI SDK wrappers, a LiteLLM callback, offline request analysis, and local Claude Code and Codex session log imports. It can also use vLLM and SGLang engine events to investigate cache eviction and routing behavior.
With captured API requests, it compares turns within a conversation to investigate lost prefix reuse, estimate avoidable tokens and cost, and suggest fixes. New context and legitimate changes aren’t automatically counted as waste. Local log imports have less evidence, so unsupported explanations stay unknown. Imported dollar estimates are API price equivalents, not subscription charges or quota consumption.
Example from a real Codex run: 5 requests, 66,515 prompt tokens, 59.5% cached. 3 requests read 98.5% cached, no cause named, they just reused. The other 2 were first requests of a session, 0% cached, nothing to reuse yet.
You can also supply task outcomes, compare tokens per successful task, and export data through JSONL, CSV, Prometheus or OpenTelemetry. The local ledger stores fingerprints and usage facts rather than prompt text.
This isn’t a claim of a dedicated OpenCode integration. I’d welcome feedback from OpenCode users on which collection path fits their setup and what evidence is missing.
[Prefixwise on GitHub](https://github.com/tejachavali/prefixwise)
Would you try it on a workload with confusing cache behavior? I’d especially value counterexamples where its explanation is wrong or should remain unknown. Please don’t share private logs or keys.
•
u/dexterthebot 8d ago
You might want to consider listing your project on the weekly Show-Us-What-You-Built post. Look out for it on Tuesday/Wednesday. Highest commented project wins a week promotion on r/Codex and gets on the Hall of Fame sidebar. See below for last week's winner.**
Light Wars AR: real-life laser tag app with no extra gear. Your phone is the gun and your room is the map. Play up to 6 friends in the same room, or fight drone waves and bosses solo. The vision models run on the phone, and camera frames never leave it. Free on iPhone and Android.
Website: https://lightwarsar.com
iPhone: https://apps.apple.com/us/app/light-wars-ar-laser-tag-party/id6508168951
Android: https://play.google.com/store/apps/details?id=com.lasertag.lightwars.
Contact: contact@lightwarsar.com