# TokenLenz

- **Event:** [The Persistent Context Sprint Hackathon | Live at MongoDB .Local Build Fest](https://cerebralvalley.ai/e/persistent-context-sprint-hackathon)
- **When:** Thu, Aug 13 at 12:30 – 8:00 PM (PDT)
- **Where:** Pier 48, San Francisco, CA
- **Team:** [Sashreek Kalakota](https://cerebralvalley.ai/u/Skalakota), [Nirav Kanthed](https://cerebralvalley.ai/u/nkanthed06)
- **GitHub:** https://github.com/nkanthed06/Claude_Token_Counter
- **Demo video:** https://www.loom.com/share/be931c5e8473415e87eecf0c252cb016
- **Gallery:** https://cerebralvalley.ai/e/persistent-context-sprint-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/persistent-context-sprint-hackathon/hackathon/gallery/46

Claude Token Counter

Real-Time AI Cost & Environmental Impact Tracking

The Problem: Developers using Claude Code have no visibility into prompt costs before sending them, leading to budget surprises and wasted resources.

Our Solution: A Claude Code plugin that pauses every prompt to show:
- 💰 Real-time cost — Exact USD (cache-aware pricing)
- 📝 ML-predicted reply length — Trained on 12k+ real API calls
- 💧 Environmental impact — Water usage of inference
- 📊 Session totals — Cumulative spending tracker
- 🔄 Prompt optimization — AI suggests rewrites with token % savings (LangGraph + OpenRouter + MongoDB)

Tech Stack:
- Node.js plugin (UserPromptSubmit hook)
- Python ML service (scikit-learn, 1.8 MB model)
- 224 automated tests, production-ready
- Graceful degradation (never blocks users)

Impact: Developers make informed decisions, prevent budget overruns, quantify environmental cost of AI.

---

Markdown version of https://cerebralvalley.ai/e/persistent-context-sprint-hackathon/hackathon/gallery/46. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
