photostructure

Go Claude Costs — Development skill for Claude Code

Development community

Analyze Claude Code usage costs and token statistics from local metadata files.

How to install Go Claude Costs

This entry records only its repository, not the path inside it, so there is no exact command to give. Open photostructure/go-claude-costs and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Go Claude Costs does

Analyze Claude Code usage costs and token statistics from local metadata files.

Alternatives in Development

  • Claude Usage — A local dashboard for tracking your Claude Code token usage, costs, and session history 864 ★
  • Memory Statistics — Show statistics about Claude's persistent memory file including total memories, storage size, and recent activ 332 ★
  • Claude Code Otel — A comprehensive observability solution for monitoring Claude Code usage, performance, and costs 306 ★

README

go-claude-costs

A Go implementation of [claude-costs](https://github.com/photostructure/claude-costs) - analyze your Claude Code usage costs and statistics by parsing local metadata files.

Features

  • 💰 Cost Analysis: Calculate actual API costs with cache savings
  • 📊 Token Usage: Track input, output, and cached tokens
  • 📁 Project Breakdown: See costs grouped by project
  • ⏰ Activity Patterns: Visualize usage by hour and day
  • 🤖 Model Usage: Distribution of different Claude models
  • ⏱️ Response Times: Analyze response time statistics
  • 🔧 Tool Usage: Track tool acceptance/rejection rates

Installation

From Source

go install github.com/photostructure/go-claude-costs/cmd/claude-costs@latest

Build Locally

git clone https://github.com/photostructure/go-claude-costs
cd go-claude-costs
go build -o claude-costs ./cmd/claude-costs

Usage

# Analyze last 30 days (default)
claude-costs

# Analyze last 7 days
claude-costs -d 7

# Show all projects (not just top 10)
claude-costs -v

# Show detailed cache statistics
claude-costs --cache

# Use custom Claude directory
claude-costs -c /path/to/.claude

Command Line Options

  • -d, --days: Number of days to analyze (default: 30)
  • -v, --verbose: Show all projects instead of top 10
  • --cache: Show detailed cache statistics
  • -c, --claude-dir: Path to Claude directory (default: ~/.claude)
  • -h, --help: Show help message

Output Example

Analyzing: /home/user/.claude

💰 $1234.56 API value (last 30 days, 25 with activity)
📊 142 sessions • $8.69/session • $49.38/day
Note: This shows API value, not your actual subscription cost
🔤 345.2M tokens total

📁 Project Costs
┌─────────────────────────────┬─────────┬──────────┬────────┬──────┬──────────────┐
│ PROJECT                     │ COST    │ SESSIONS │ TOKENS │ DAYS │ AVG RESPONSE │
├─────────────────────────────┼─────────┼──────────┼────────┼──────┼──────────────┤
│ my-web-a