Skip to main content

ccbar

Vibe coding is no longer just for fun. Know what it costs.

Real-time cost tracking and quota monitoring for Claude Code. Zero dependencies.

PyPI Downloads Python License Dependencies

English 中文


ccbar demo

Why ccbar

You're burning through API credits or a $200/month Max subscription — but Claude Code doesn't tell you how fast, which project, or what it'll cost by end of day. ccbar fills that gap.

It works with both billing models: whether you're on the API (pay-per-token) or a Pro/Max subscription (quota-based), ccbar tracks your spend in real time. No guessing, no surprises at the end of the month.

Install

pip install ccbar
ccbar --install

Restart Claude Code. Two status lines appear at the bottom. That's it.

What you get

Row 1:  5h quota bar + countdown · today tokens + cost › proj tokens ♻cache/hit% cost · week cost › proj tokens cost │ month tokens cost › proj cost
Row 2:  7d quota bar + countdown · session cost + $/h + →projection + duration + ctx% + lines · total cost › proj tokens ♻cache cost + path

Terminal too narrow? Trailing columns drop automatically. Content within columns is never truncated.

Lightweight by design

ccbar is a single Python file. No frameworks, no background daemons, no node_modules. It reads JSONL logs that Claude Code already writes and the OAuth API you already have. The entire package installs in under a second.

ccbar typical alternatives
Dependencies 0 10–50+ npm/pip packages
Install time < 1s 30s – 2min
Background process None — runs on each statusline refresh Persistent daemon
Config 1 JSON file or 1 env var YAML + env + dashboard setup

Accurate to the cent

Most tools estimate costs with a flat rate. That's wrong — Opus output is 19x more expensive than Haiku. ccbar gets it right:

  • Per-model pricing — reads the model ID from every message. Opus, Sonnet, Haiku each priced correctly.
  • Streaming dedup — each API call writes 2–7 JSONL entries. ccbar deduplicates by message.id. Every message counted exactly once.
  • Cache separation — cache reads cost 10% of fresh input. ccbar tracks them separately and shows ♻hit rate per project.
  • Cross-session history — session cost resets when you restart. Your bill doesn't. ccbar scans all JSONL — today, this week, this month, per project.

Full-spectrum monitoring

Metric What it tells you
5h / 7d quota bars Green→yellow→red gradient. Know when you'll hit the limit before you hit it.
Burn rate $8.50/h How fast this session is spending.
Projection →$18 Where you'll land by quota reset at the current pace.
Per-project › proj ♻56M/97% $124 Which project is eating your budget. Cache hit rate included.
Lines changed +250/-40 Code output this session — are you getting value for the spend?
Context % How full the context window is. Helps you decide when to compact.
Today / Week / Month Running totals so you always know where the bill stands.

API & Subscription — both covered

API users — ccbar calculates exact costs from per-model token pricing. You see dollars spent per session, per project, per day.

Pro / Max subscribers — ccbar reads your OAuth quota via the Anthropic API. The 5-hour and 7-day progress bars show exactly how much runway you have left, with countdowns to reset.

Either way, you get a single statusline that tells the full story.

Configure

export CCBAR_LAYOUT="5h,today,history|7d,session,total"
# or
ccbar --init-config   # → ~/.config/ccbar.json
Config reference
{
  "rows": [["5h", "today", "history"], ["7d", "session", "total"]],
  "columns": null,
  "colors": {},
  "pricing": {
    "claude-opus-4-6":    { "in": 15,  "out": 75, "cc": 18.75, "cr": 1.5  },
    "claude-sonnet-4-6":  { "in": 3,   "out": 15, "cc": 3.75,  "cr": 0.3  },
    "claude-haiku-4-5":   { "in": 0.8, "out": 4,  "cc": 1,     "cr": 0.08 }
  }
}
Field Description
rows Layout grid — items: 5h 7d today history session model total
columns Override terminal width (null = auto-detect)
pricing $/million tokens per model
colors [R, G, B] overrides

How it works

stdin JSON → detect terminal width → fetch OAuth quota (cached 30s)
           → scan ~/.claude/projects/**/*.jsonl (cached 60s)
           → dedup by message.id → per-model pricing → adaptive layout → stdout

OAuth — macOS: auto-reads Keychain. Linux/CI: export CLAUDE_OAUTH_TOKEN="...". Without it, quota bars show --.

Uninstall

ccbar --uninstall && pip uninstall ccbar

MIT

Release files for ccbar 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ccbar 0.1.3
File Size Uploaded
ccbar-0.1.3.tar.gz 22.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ccbar 0.1.3
File Interpreter ABI Platform
ccbar-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.5 kB

Release files / ccbar-0.1.3.tar.gz

Download URL ccbar-0.1.3.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
46cb7469b330e8f05cd460ec6332a71d4de97c8992a301492621cb1f3680eb63
BLAKE2b-256 checksum
How to use checksums
41e401e47387abe5bb8bf44d19ac898dfe6420f785b33713e2545affe36ee3f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release files / ccbar-0.1.3-py3-none-any.whl

Download URL ccbar-0.1.3-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb3ae6300698b65ac2a17973995925a13da527047828975fe61d72342104dadc
BLAKE2b-256 checksum
How to use checksums
0b1138bfdd51656e38e3c072f8680b5f84493dae25fd11f58c3b7a89e2b00115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page