Goccc is a fast, zero-dependency CLI tool designed to function as both a cost calculator and a live statusline provider for Claude Code. It breaks down your API costs by model, day, project, and month — more precise and lightweight than ccusage, with additional features like MCP server tracking and local currency support.
Track every dollar Claude Code spends — by model, day, and project.
Key Features
-
Precise Cost Calculation: Automatically calculates costs associated with API usage using per-model pricing that accounts for cache write tiers (5-minute vs 1-hour), long-context premiums (>200K input tokens), and web search expenses.
-
Flexible Usage Tracking: Provides comprehensive insights into spending by aggregating data daily, monthly, and per project. Filter by project name, limit results to the last N days, or show only the top N entries. JSON output is available for scripting and piping to tools like
jq, ensuring that all financial aspects are clearly understood and accounted for. -
Live Statusline: goccc can serve as a Claude Code statusline provider — a live cost line right in your terminal prompt, presenting vital information at a glance: session cost, total cost for the day, context window usage percentage, active MCP servers, and the current model in use. All values are color-coded yellow → red as they increase.
-
MCP Server Tracking: Detects active MCP servers from five sources: global settings, marketplace plugins, project-level configs, local settings, and per-project overrides in
~/.claude.json. Respects per-project disable lists, giving you an accurate view of which integrations are active in each session. -
Local Currency Support: Display costs in your local currency by setting an ISO 4217 code in
~/.goccc.json. goccc auto-fetches exchange rates from USD and caches them for 24 hours. One-off overrides are available through command flags for quick conversions without configuration. -
Zero Dependencies, Cross-Platform: Built in pure Go with zero external dependencies (stdlib + one color library). Ships as a single binary for macOS, Linux, and Windows (amd64/arm64). Install via Homebrew,
go install, or grab a pre-built binary from the releases page.
Example Usage
The functionality of goccc can be leveraged through various command options. Here are some usage examples:
# Display summary of all-time usage
goccc
# Show last 7 days with all breakdowns
goccc -days 7 -all
# Monthly breakdown
goccc -monthly
# Filter by project and display daily usage
goccc -project webapp -daily
# Top 5 most expensive projects
goccc -projects -top 5
# Output JSON format for further analysis
goccc -json | jq '.summary.total_cost'
Statusline Setup
Add to ~/.claude/settings.json to enable the live dashboard:
{
"statusLine": {
"type": "command",
"command": "goccc -statusline"
}
}
This displays a line like:
💸 $1.23 session · 💰 $5.67 today · 💭 45% ctx · 🔌 2 MCPs (confluence, jira) · 🤖 Opus 4.6
Configuration
To customize currency display and exchange rates, create ~/.goccc.json:
{
"currency": "EUR"
}
For one-off overrides without a config file:
goccc -currency-symbol "€" -currency-rate 0.92
How It Works
goccc operates by scanning JSONL files located in the ~/.claude/projects/ directory. It uses mtime-based file skipping and directory-level filtering for performance, applies a byte-scan pre-filter before JSON parsing (only "type":"assistant" entries carry billing data), and deduplicates streaming entries by requestId. Costs are calculated using Anthropic's published pricing models, including proper handling of cache write tiers and long-context premiums.
Links
- GitHub: https://github.com/backstabslash/goccc
- Releases: https://github.com/backstabslash/goccc/releases/latest
- Homebrew:
brew install backstabslash/tap/goccc
No comments yet.
Sign in to be the first to comment.