Watch your Claude Code spend in real-time. Save up to 90% with prompt caching.
A lightweight always-on-top desktop widget (Windows / PowerShell + WinForms) that shows live cache heat and actual token costs for your Claude Code sessions. No estimatesβreal numbers from your transcript.
The problem it solves: Long Claude Code sessions are expensive. Prompt caching can save 90%+ on tokens, but you can't see it happening. This widget makes the invisible visible.
- Cache Clock β See your cache expire (green "hot" β yellow "cooling" β red "cold")
- Live Token Count β In / Cached / Out tokens with cost breakdown
- Cost Per Turn β Actual USD spent (from real API usage)
- Total Spend β Cumulative tokens + savings + burn rate ($/min)
- Plan Usage β Monthly quota utilization (optional)
β
Live cache heat tracking β Know when you're about to lose your 90% discount
β
Actual costs β Reads real message.usage from transcripts, not estimates
β
Multiple models β Claude 3.5 Sonnet, Opus, Haiku pricing built-in
β
Automatic hooks β Installs into Claude Code lifecycle (SessionStart, Stop)
β
Draggable widget β Always visible, never blocking
β
Right-click menu β Quick access to transcripts and settings
β
Single-instance β No dupes, auto-restarts cleanly
The widget displays:
- Top section β Cache countdown (time until 5-min TTL expires)
- Middle β Your current turn breakdown (input / cache-read / output tokens)
- Bottom β Session totals (all tokens + USD + how much cache saved you)
- Right-click menu β Copy summary, open transcript, open project folder
Example:
βββββββββββββββββββββββββββββββββββββββ
β CACHE: quente (4m 23s) [ββββββββ] β β Cache fresh!
β Token: 1,200 in | 450 cache | 380 out
β Cost: $0.042 per turn | Total: $1.83 | Saved: $8.70 (90%)
β Plan: 21% of month quota
βββββββββββββββββββββββββββββββββββββββ
- Windows 10/11 + PowerShell 5.1+ (PowerShell 7 recommended)
- Claude Code (writes transcripts to
~/.claude/projects/) - Python 3 (optional β only for plan/budget section)
git clone https://github.com/Codyte/claude-cache-widget.git
cd claude-cache-widget
powershell -ExecutionPolicy Bypass -File .\install.ps1Done. The widget launches immediately and auto-starts on next Claude Code session.
powershell -ExecutionPolicy Bypass -File .\install.ps1 -UninstallEdit config.json to customize:
context_limitβ Your model's token limitcache_ttl_secondsβ How long cache stays hot (default: 300s)idle_close_minutesβ Auto-close after N min of inactivityprices.jsonβ Token pricing (auto-updates when Anthropic changes rates)
-
Install hooks β
install.ps1registers three lifecycle hooks in~/.claude/settings.json:SessionStartβ launches widgetUserPromptSubmitβ marks turn as "busy" (pauses cache clock)Stopβ marks turn as "idle" (starts cache expiry countdown)
-
Read transcripts β Widget monitors
~/.claude/projects/*/latest.jsonlfor realmessage.usageobjects -
Calculate costs β Applies pricing from
prices.json:in= input tokenscr= cache-read tokens (cheap!)cw= cache-write tokensout= output tokens
-
Show savings β Displays how much cheaper this turn was vs. no caching
- β Local-only β reads only your transcripts on disk
- β No tracking β never sends data anywhere
- β OAuth optional β plan section uses same token Claude CLI already has
- β
Credentials safe β
.credentials.jsonnever committed
Before: Load full codebase context each turn β $15 per turn (5K tokens)
After: Cache keeps context hot β $0.50 per turn (45 cache-read tokens)
πΎ 90% savings per turn!
Turn 1: Load error context β $2.10 (cache written)
Turn 2-5: Reuse context β $0.20 each (cache hit!)
πΎ Saved $8 on just 5 turns
Session runs for 2 hours with context reuse
Total spend: $18.50 | Total saved via cache: $167
πΎ That's an 90% savings day!
# One-shot install for Copilot or other agents
git clone https://github.com/Codyte/claude-cache-widget.git claude-cache-widget
powershell -ExecutionPolicy Bypass -File .\claude-cache-widget\install.ps1The installer is fully idempotent β running it twice just restarts the widget.
.\install.ps1 -InstallDir "C:\MyTools\Claude".\install.ps1 -NoHooksGood first issues:
- Translate UI to English (currently Portuguese) β see
config.jsonfor string keys - Support other LLM cost models (GPT-4, Gemini, Mixtral)
- Add dark mode toggle
- Cross-platform port (macOS + Linux via system tray)
- Test on Windows 11 + PowerShell 7
Development:
# Edit widget-ui.ps1, then restart
.\install.ps1 # Restarts instantlyQ: Does this work with Claude Web UI (not Claude Code)? A: Not currently β it only reads Claude Code transcripts. The web UI doesn't write transcripts locally.
Q: Will this slow down my session? A: No. The widget runs in a separate process and uses negligible CPU (<1%).
Q: Is my data safe? A: Completely. The widget is local-only and never connects to the internet (except optional OAuth for plan usage).
Q: Can I see historical costs?
A: Yes β explore ~/.claude/projects/*/latest.jsonl directly or check the widget's right-click menu.
Q: Why the Portuguese UI? A: The author is Brazilian π§π·. English translation is a welcome contribution!
# Check if it's running
Get-Process | Where-Object {$_.ProcessName -like "*PowerShell*"}
# Restart manually
.\install.ps1- Check
prices.jsonβ is it up to date with Anthropic's current rates? - Verify
message.usagein your transcript β sometimes early turns don't have it - Reload config:
Ctrl+Rin widget (if implemented)
The installer uses ConvertFrom-Json -AsHashtable which doesn't exist in PS 5.1. Use PowerShell 7+ or edit settings.json manually (instructions printed by installer).
Default pricing (as of 2024):
- Claude 3.5 Sonnet β $3/$15/$3/$15 per 1M tokens (in/cache-read/cache-write/out)
- Claude 3 Opus β $15/$75/$15/$75 per 1M tokens
- Claude 3 Haiku β $0.25/$1.25/$0.25/$1.25 per 1M tokens
Update prices.json when rates change. Contributions welcome!
MIT β See LICENSE
Not affiliated with Anthropic. "Claude" is a trademark of Anthropic.
- English UI (v2)
- Dark mode
- Alerts for cache expiry
- Cost trending over time
- macOS version
- GPU memory tracking (for local LLMs)
Have an idea? Open an issue!