Skip to content

ibrahimokdadov/claudecost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claudeCost

Real-time token cost, context health, and per-project/per-agent cost breakdown for Claude Code sessions.

claudeCost demo

What it shows

  • Session cost — live running total as you work
  • Today / week / month tiles — cumulative spend across all sessions
  • Context window bar — how full your 200K token window is, with a compaction warning when you're close
  • Agent breakdown — per-subagent token and cost attribution (no more mystery burns)
  • By-project table — ranked cost breakdown across all your projects for today / this week / this month

Install

git clone https://github.com/ibrahimokdadov/claudecost.git
cd claudecost
npm install

Run

node bin/claudecost.js
# → http://localhost:7799

Open http://localhost:7799 in your browser. The dashboard updates live as Claude Code runs.

Options

CLAUDECOST_PORT=8000 node bin/claudecost.js   # custom port

How it works

Claude Code writes every API response to JSONL files under ~/.claude/projects/. claudeCost:

  1. Finds the most recently active session file at startup and cold-parses it
  2. Watches all project directories with chokidar for live updates
  3. Computes per-turn cost from token counts using Claude's public pricing
  4. Scans all project directories at startup for the per-project breakdown (this-month only, for performance)
  5. Streams state updates to the browser over SSE

Pricing used

Model Input Output Cache write Cache read
claude-sonnet-4-6 $3/MTok $15/MTok $3.75/MTok $0.30/MTok
claude-opus-4-6 $15/MTok $75/MTok $18.75/MTok $1.50/MTok
claude-haiku-4-5 $0.80/MTok $4/MTok $1.00/MTok $0.08/MTok

Stack

  • Node.js + Express — server + SSE
  • chokidar — JSONL file watcher (polling mode on Windows)
  • Vanilla JS / CSS dashboard — no build step

Budget config

Set a monthly budget in the dashboard to get a % used indicator and a warning color when you're close.

Requirements

  • Node.js 18+
  • Claude Code installed and run at least once (needs ~/.claude/projects/)
  • Windows, macOS, or Linux

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors