Skip to main content

cctrack

A lightweight CLI tool that scans Claude Code JSONL logs and reports token usage and estimated cost. Zero dependencies, runs anywhere Python 3.10+ is available.

Install

# Run directly (no install needed)
uvx cctrack

# Or install globally
uv tool install cctrack

Usage

# Scan local logs and print report
cctrack

# Last 7 days only
cctrack --days 7

# Aggregate with remote machines via SSH
cctrack --remote dgx macbook-air

# Custom log directories
cctrack --dirs ~/.claude/projects ~/.sandy/sandboxes

Example output

cctrack — Claude Code Cost Report
══════════════════════════════════

April 2026 — month to date (day 1, 1 active)
───────────────────────────────────────
  Input tokens:            23,381
  Output tokens:          199,069
  Cache read:          30,862,977
  Cache write:          1,051,023
  Total tokens:        32,136,450
  Total cost:     $25.85
  Avg/day:        $25.85
  Projected/mo:   $775.50 (based on 1-day avg)

Daily breakdown:
  Date                Input       Output      Cache R      Cache W       Cost
  ──────────── ──────────── ──────────── ──────────── ──────────── ──────────
  2026-04-01         23,381      199,069   30,862,977    1,051,023 $   25.85

What it does

  1. Walks ~/.claude/projects/ and ~/.sandy/sandboxes/ for JSONL log files
  2. Parses assistant events with token usage
  3. Deduplicates by requestId (last event wins, matching Claude Code's semantics)
  4. Calculates cost using Anthropic's published rates per model
  5. Prints daily breakdown with input/output/cache token splits and monthly summaries

Remote aggregation

With --remote, cctrack SSHs to each host and streams back both the JSONL logs and the host's statusline hook data (~/.claude/cctrack/) for local parsing, so authoritative hook costs from every machine are summed per day. Requires SSH key auth.

# Aggregate this machine + DGX server + laptop
cctrack --remote dgx macbook-air

# For accurate aggregate costs, install the hook on each host too
cctrack --install-hook --remote dgx macbook-air

Rate card

Prices per million tokens, from Anthropic's pricing page. Cache writes are priced per TTL: 5-minute at 1.25× input, 1-hour at 2× input.

Model Input Output Cache Read Cache Write 5m Cache Write 1h
Fable 5 / Mythos 5 $10.00 $50.00 $1.00 $12.50 $20.00
Opus 4.8 / 4.7 / 4.6 / 4.5 $5.00 $25.00 $0.50 $6.25 $10.00
Opus 4 / 4.1 $15.00 $75.00 $1.50 $18.75 $30.00
Sonnet 5 / 4.x / 3.7 $3.00 $15.00 $0.30 $3.75 $6.00
Haiku 4.x $1.00 $5.00 $0.10 $1.25 $2.00
Haiku 3.5 $0.80 $4.00 $0.08 $1.00 $1.60
Haiku 3 $0.25 $1.25 $0.03 $0.30 $0.50

Unknown models fall back to Sonnet rates and are flagged with ? in the report's Model column.

Origins

This is a Python rewrite of the Go-based cctrack dashboard. The Go version provides a full web dashboard with real-time updates, session explorer, and project breakdown. This Python version strips it down to the essentials: a single command that parses logs and prints a cost report. The JSONL parsing logic, deduplication strategy, and rate card are ported directly from the Go implementation.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cctrack-0.5.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cctrack-0.5.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file cctrack-0.5.0.tar.gz.

File metadata

  • Download URL: cctrack-0.5.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cctrack-0.5.0.tar.gz
Algorithm Hash digest
SHA256 f98701108df76152eefd5c5530a464a1373aac39084537aa69dc9913e9351465
MD5 c8aa60afeada097803c8abe5e9c5e9c2
BLAKE2b-256 1fd0f785e42a38dafaa719ca7891afb79c42389b75198dd01ae1b581c5d462c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cctrack-0.5.0.tar.gz:

Publisher: publish.yml on rappdw/cctrack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cctrack-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: cctrack-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cctrack-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ad627b9d23d191711a95a06b3e354aa24defea8390c9e5abf71306a4e501193
MD5 ff19d56754c06a08697ddf0672c4f1f6
BLAKE2b-256 e76c0d4a0877c59f45908ead529f36e2f7c9720c338baa87958a39414b1c27a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cctrack-0.5.0-py3-none-any.whl:

Publisher: publish.yml on rappdw/cctrack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page