Skip to main content

AirPilot Blackbox - Analyze Claude AI usage logs and calculate costs

Project description

AirPilot Blackbox

Analyze your Claude AI usage logs and calculate costs from ~/.claude or Docker containers.

Quick Start

Option 1: Run directly with uvx (recommended)

uvx airpilot-blackbox
# or use the short alias
blackbox

Option 2: Clone and run

git clone https://github.com/shaneholloman/airpilot-blackbox.git
cd airpilot-blackbox
uv run .

Runtime Usage

# Analyze local ~/.claude directory (default)
blackbox
# or
uvx airpilot-blackbox

# Analyze Docker containers
blackbox --docker

# Export results to JSON
blackbox --output results.json

# Show only summary
blackbox --summary-only

# Show tool usage statistics
blackbox --tools

# Show cache efficiency analytics
blackbox --cache

# Show response time analysis
blackbox --response-times

# Show all enhanced analytics
blackbox --full

# Limit items shown in tables
blackbox --limit 5

uvx usage

# Analyze local ~/.claude directory (default)
uvx airpilot-blackbox

# Analyze Docker containers
uvx airpilot-blackbox --docker

# Export results to JSON
uvx airpilot-blackbox --output results.json

# Show only summary
uvx airpilot-blackbox --summary-only

# Show tool usage statistics
uvx airpilot-blackbox --tools

# Show cache efficiency analytics
uvx airpilot-blackbox --cache

# Show response time analysis
uvx airpilot-blackbox --response-times

# Show all enhanced analytics
uvx airpilot-blackbox --full

# Limit items shown in tables
uvx airpilot-blackbox --limit 5

Features

  • Zero Installation: Just clone and run with uv
  • Comprehensive Stats: Token usage, costs, sessions, daily trends
  • Docker Support: Analyze usage from devcontainers (auto-analyzes all containers)
  • Session Deduplication: Automatically detects and merges duplicate sessions across sources
  • Rich Terminal UI: Beautiful tables and formatting
  • Cost Tracking: Automatic calculation based on current Claude API pricing
  • Cache Analytics: Track cache efficiency, ROI, and savings
  • Response Time Analysis: Monitor performance by model and percentiles
  • Enhanced Tool Analytics: Cost per tool, usage patterns, and combinations

Example Output

uv run blackbox
╭────────────────────────╮
│ AirPilot Blackbox      │
│ Analyse AirPilot usage │
╰────────────────────────╯

Found 232 JSONL files across 1 source(s)
  Parsing usage logs...


Overall Usage Statistics
 Total Messages                20,132
 Input Tokens                 155,998
 Output Tokens              1,834,052
 Cache Creation Tokens     73,508,335
 Cache Read Tokens      1,532,465,059
 Total Tokens           1,607,963,444

 Total Cost                   $982.98

Model Usage Breakdown
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Model                     Messages    Input     Output          Cache     Cost ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ claude-sonnet-4-20250514    18,298  151,274  1,763,274  1,510,144,603  $708.47 │
│ claude-opus-4-20250514       1,194    4,724     70,778     95,828,791  $274.51 │
│ <synthetic>                    640        0          0              0  $0.0000 │
└──────────────────────────┴──────────┴─────────┴───────────┴───────────────┴─────────┘

Daily Usage
┏━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Date        Messages  Sessions       Tokens     Cost ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩
│ 2025-06-23       335         3   23,717,050   $51.39 │
│ 2025-06-22     1,256        30   78,414,970  $202.86 │
│ 2025-06-21     1,014         2   90,414,152  $217.63 │
│ 2025-06-20       380         4   21,862,784   $69.93 │
│ 2025-06-19     1,048         7   79,102,093  $233.74 │
│ 2025-06-18        30         1    1,663,801    $6.13 │
│ 2025-06-17       153         5    6,541,711   $24.51 │
│ 2025-06-16     1,774        19  130,643,490  $275.64 │
│ 2025-06-15       315         2   26,584,711   $66.19 │
│ 2025-06-14     2,440        25  190,579,840  $411.25 │
└────────────┴──────────┴──────────┴─────────────┴─────────┘

Session Breakdown
┏━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Session ID   Messages  Duration  Models                 Cost ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ 76966e72...       422     3h 9m  opus, sonnet, +1     $88.22 │
│ 81eab4b0...       464    5h 20m  opus, <synthetic>    $87.72 │
│ 126eb98b...       320    3h 21m  opus, <synthetic>    $71.68 │
│ 6ddd6588...       176    4h 55m  opus, <synthetic>    $57.34 │
│ 50a9c408...       962   22h 41m  sonnet, <synthetic>  $42.44 │
│ 63dc55b9...       838    5h 48m  sonnet, <synthetic>  $39.39 │
│ 71c64fb4...     1,169    3h 53m  sonnet               $38.31 │
│ 12606cef...     1,069    7h 15m  sonnet, <synthetic>  $37.30 │
│ e42f0435...       918     8h 7m  sonnet, <synthetic>  $35.40 │
│ 7a39bcd8...       791    6h 52m  sonnet, <synthetic>  $31.71 │
└─────────────┴──────────┴──────────┴─────────────────────┴────────┘

Requirements

  • Python 3.8+
  • uv (install with curl -LsSf https://astral.sh/uv/install.sh | sh)
  • Docker (optional, for container support)

License

MIT

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

airpilot_blackbox-0.1.1.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

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

airpilot_blackbox-0.1.1-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file airpilot_blackbox-0.1.1.tar.gz.

File metadata

  • Download URL: airpilot_blackbox-0.1.1.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for airpilot_blackbox-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eeb452aea0896369228cd04d773cf8277c2f33f021086e5251f279cabdab69dc
MD5 ac688656ac45862daf0e8d31317ff864
BLAKE2b-256 d1452d95fe72e6f3eff6d75f9ef63f533361b0ecec32b7b62a062117dd20b003

See more details on using hashes here.

File details

Details for the file airpilot_blackbox-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for airpilot_blackbox-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed060fa82e2ca5e2bbf2a4980ed74845c6154975426f161ec592f62c4cb85841
MD5 1c4e97127ac363ab55df48def532ebad
BLAKE2b-256 f96205ff236125a9d767f3ed27a603da88a7f9272779adef559f038dc237d3fe

See more details on using hashes here.

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