Accurate cost tracking and quota monitoring for Claude Code
Project description
ccbar
Vibe coding is no longer for fun. Know what it costs.
One file. Zero dependencies. Pure Python stdlib.
Install
pip install ccbar
ccbar --install
Restart Claude Code. Two lines appear at the bottom. Done.
What you see
| Row | Content |
|---|---|
| 1 | 5h quota bar + countdown · today tokens + ♻cache + cost › per-project breakdown · week total · month total |
| 2 | 7d quota bar + countdown · session cost + $/h burn rate + →projection + duration + lines changed · context% + model + clock · total project cost + path |
Terminal too narrow? Trailing columns drop automatically. Content within columns is never modified.
Why the numbers are right
- Per-model pricing — Opus output costs $75/M, Haiku costs $4/M. ccbar reads the model ID from every message. No flat-rate guessing.
- Streaming dedup — Each API call writes 2–7 JSONL entries. ccbar deduplicates by
message.id. Each 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.
More
- Burn rate —
$8.50/htells you how fast this session is spending.→$18projects the total by quota reset. - Quota bars — Green→yellow→red HSL gradient. 5-hour and 7-day limits at a glance.
- Per-project —
› proj ♻56M/97% $124— which project is eating your budget. - Adaptive layout — 2 rows × 4 columns by default. Columns drop when terminal narrows. Content never truncates.
Configure
export CCBAR_LAYOUT="5h,today,week,month|7d,session,model,total"
# or
ccbar --init-config # → ~/.config/ccbar.json
Config reference
{
"rows": [["5h", "today", "week", "month"], ["7d", "session", "model", "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 week month 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 · For developers who treat AI compute as a budget line item.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ccbar-0.1.0.tar.gz.
File metadata
- Download URL: ccbar-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63192e526dd31cb811edac83d246a65ce397b3b38d9af681c83a7c0220c432a8
|
|
| MD5 |
05478bfd21877a790b110dd053d28f8f
|
|
| BLAKE2b-256 |
1603f781d6360826ba991a310214688b0d7e7d1652c29f8c3c3f1096c65e4bd2
|
File details
Details for the file ccbar-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ccbar-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e3da7158c303b3561b91d815ee642037ff3bf31b4e8b76a141ca2ac8366d1ca
|
|
| MD5 |
82d0174affbe09a8fb9d814785fb9381
|
|
| BLAKE2b-256 |
1b930a53daffe544ae0db0cbc396f765351cd8188647776c0faf1bd5ea327c09
|