From bungkust-skills
Tracks AI token consumption across providers, detects waste, estimates theoretical costs, and suggests optimizations. Useful for monitoring usage, quotas, and efficiency in AI interactions.
npx claudepluginhub bungkust/bungkust-skillsThis skill uses the workspace's default tool permissions.
Pantau dan analisis token consumption AI. Inspired by [CodeBurn](https://github.com/AgentSeal/codeburn).
Analyzes Claude Code conversation logs for token usage, costs, cache hit rates, workflow patterns (skills, agents, hooks), and cost optimizations. Generates interactive HTML dashboard.
Analyzes Claude Code usage, costs, tokens, efficiency, cache hits, and burn rate using ccusage for stats and termgraph for visuals on work or personal profiles.
Displays per-session token usage breakdown for the last N days (default 7). Invoke via /token-usage or /token-usage <days> to track AI costs.
Share bugs, ideas, or general feedback.
Pantau dan analisis token consumption AI. Inspired by CodeBurn.
| Metric | Cara Hitung | Target |
|---|---|---|
| Total tokens | input + output + cache_read + cache_write + reasoning | - |
| Input tokens | Token yang dikirim ke model | Minimalisir dengan prompt caching |
| Output tokens | Token yang di-generate model | <500 per response ideal |
| Cache read | Token dari cache (hemat!) | >80% dari total input |
| Cache write | Token untuk buat cache baru | Minimal setelah warm-up |
| Reasoning tokens | Token internal thinking (o3, Claude extended) | Monitor, bisa besar |
| Token per session | total_tokens / jumlah_session | Track tren naik/turun |
| Token per message | total_tokens / jumlah_message | <2K ideal |
| Cache hit rate | cache_read / (input + cache_read + cache_write) | >80% |
๐ค Tokens:
Input: 1.5M โ yang dikirim ke API
Output: 146K โ yang di-generate
Cache Read: 39.4M โ dari cache (hemat!)
Cache Write: 0 โ sudah warm, tidak perlu tulis ulang
Reasoning: 0 โ model tidak pakai thinking
โโโโโโโโโโโโโโโโโโโโโ
Total: 41M โ total token yang lewat
Cache hit: 96.4% โ sangat bagus (>80%)
| Pattern | Indikasi | Fix |
|---|---|---|
| Output > Input | Model terlalu verbose | Tambah "be concise" di prompt |
| Cache hit < 80% | Prompt/context tidak stabil | Cek system prompt, jangan ubah tiap turn |
| Reasoning tinggi | Model overthinking | Turunkan reasoning effort |
| Token/session naik | Context bengkak | Compress context, hapus history lama |
| Cache write terus | Cache tidak persist | Cek provider caching config |
| Model | Input | Output | Notes |
|---|---|---|---|
| MiMo / GLM / Qwen | $0 | $0 | Free tier |
| DeepSeek | $0.14 | $0.28 | Murah |
| Claude Haiku | $0.25 | $1.25 | Budget Claude |
| GPT-4o | $2.50 | $10.00 | Mid-range |
| GPT-5/5.4 | $5.00 | $15.00 | Premium |
| Claude Sonnet | $3.00 | $15.00 | Balanced |
| Claude Opus | $15.00 | $75.00 | Top-tier |
Bahkan model gratis tetap dihitung "berapa jika bayar":
๐ค Models:
xiaomi/mimo-v2-pro: $0.0000 (240x, 0%)
gpt-5.4: $0.0000 actual ยท ~$11.69 if paid (6x)
๐ก Theoretical cost if paid: ~$11.69
13 kategori dari tool usage pattern:
| Kategori | Trigger |
|---|---|
| Coding | edit, write_file, patch |
| Debugging | fix, debug, error, bug |
| Feature Dev | create, implement, add, build |
| Refactoring | refactor, rename, simplify |
| Testing | test, pytest, vitest |
| Exploration | read_file, search_files, browser |
| Planning | plan, writing-plans, todo |
| Delegation | delegate_task |
| Git Ops | git, commit, push, merge |
| Build/Deploy | deploy, docker, build |
| Communication | send_message, clarify |
| Data/Analysis | execute_code, jupyter |
| General | lainnya |
# Summary
python3 ~/.hermes/scripts/cost-logger.py # All-time
python3 ~/.hermes/scripts/cost-logger.py today # Hari ini
python3 ~/.hermes/scripts/cost-logger.py week # 7 hari
python3 ~/.hermes/scripts/cost-logger.py month # 30 hari
# Status (one-liner)
python3 ~/.hermes/scripts/cost-logger.py status
# Optimize scan
python3 ~/.hermes/scripts/cost-logger.py optimize
# Budget
python3 ~/.hermes/scripts/cost-logger.py budget 50 # Set $50/hari
python3 ~/.hermes/scripts/cost-logger.py budget # Cek budget
# Export
python3 ~/.hermes/scripts/cost-logger.py export csv # CSV
python3 ~/.hermes/scripts/cost-logger.py report --json # JSON
Script companion untuk Hermes. Taruh di ~/.hermes/scripts/cost-logger.py.
Fitur:
Untuk cek code burn sebelum implementasi:
# Structure scan
find . -name "*.py" | xargs wc -l | tail -1
find . -name "*.js" | xargs wc -l | tail -1
tree -L 3 --dirsfirst -I 'node_modules|.git|__pycache__|venv'
# Dependencies
cat requirements.txt
cat package.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(json.dumps(d.get('dependencies',{}), indent=2))"
# Security scan
grep -rn "password\|secret\|api_key" --include="*.py" --include="*.js"
grep -rn "eval\|exec\|os.system" --include="*.py" --include="*.js"
## Token Analysis: [project]
### Overview
- Sessions: [X]
- Messages: [X]
- Tools: [X]
### Token Consumption
- Input: [X]M
- Output: [X]K
- Cache hit: [X]%
- Theoretical cost: ~$[X]
### Activities
- Coding: [X]%
- Exploration: [X]%
- ...
### Risks
- ๐ด [blocker]
- ๐ก [medium]
- ๐ข [low]