AI Agent Hub
AI エージェント / プラグイン情報メディア
← 一覧へ
ccusage
CLAUDE

ccusage

ccusage

Claude Code のローカル JSONL ログから使用量とコストを集計する CLI / TUI。日次 / セッション別 / モデル別の表示に対応し、サブスク利用状況を即可視化。

原文: A CLI tool for analyzing Claude Code/Codex CLI usage from local JSONL files.
#CLI#monitoring#日本人作者
REPO STATS

リポジトリ統計

⭐ Stars
13.9k
🍴 Forks
538
⚠️ Open Issues
186
🌿 Language
TypeScript
📄 License
NOASSERTION
🕒 最終更新
2026.05.07 (今日)
📅 公開日
2025.05.30
🌿 Branch
main
README

ドキュメント

— AI による自動翻訳 (2026.05.07 更新)

ccusage logo

ccusage

Socket Badge npm バージョン NPM ダウンロード インストール サイズ DeepWiki Awesome Claude Code で言及

ryoppippi%2Fccusage | Trendshift

Claude Code のトークン使用量と料金をローカル JSONL ファイルから分析 — 非常に高速で情報豊富です!

ccusageファミリー

📊 ccusage - Claude Code 使用状況アナライザー

ローカル JSONL ファイルから Claude Code の使用状況を分析するメイン CLI ツールです。毎日、毎月、セッションベースの使用状況を美しいテーブルで追跡できます。

🤖 @ccusage/codex - OpenAI Codex 使用状況アナライザー

OpenAI Codex の使用状況を分析するコンパニオンツールです。ccusage と同じ強力な機能を備えており、Codex ユーザー向けにカスタマイズされており、GPT-5 サポートと 1M トークンコンテキストウィンドウを備えています。

🚀 @ccusage/opencode - OpenCode 使用状況アナライザー

OpenCode の使用状況を分析するコンパニオンツールです。OpenCode セッションからのトークン使用状況とコストを ccusage と同じレポート機能で追跡できます。

🥧 @ccusage/pi - Pi-agent 使用状況アナライザー

pi-agent セッションの使用状況を分析するコンパニオンツールです。pi-agent セッションからのトークン使用状況とコストを毎日、毎月、セッションベースのレポートで追跡できます。

@ccusage/amp - Amp 使用状況アナライザー

Amp セッションの使用状況を分析するコンパニオンツールです。Amp CLI セッションからのトークン使用状況、コスト、クレジットを毎日、毎月、セッションベースのレポートで追跡できます。

🔌 @ccusage/mcp - MCP サーバー統合

ccusage データを Claude Desktop および他の MCP 互換ツールに公開する Model Context Protocol サーバーです。AI ワークフロー内でリアルタイムの使用状況追跡を有効にできます。

インストール

クイックスタート(推奨)

ccusageの非常に小さいバンドルサイズのおかげで(install size)、インストールなしで直接実行できます。

# Recommended - always include @latest to ensure you get the newest version
npx ccusage@latest
bunx ccusage

# Alternative package runners
pnpm dlx ccusage
pnpx ccusage

# Using deno (with security flags)
deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest

💡 重要:最新のバージョンと最新の機能・バグ修正を実行していることを確認するため、npxで@latestサフィックスを使用することを強く推奨します(例:npx ccusage@latest)。

関連ツール

npx @ccusage/codex@latest       # OpenAI Codex usage tracking
npx @ccusage/opencode@latest    # OpenCode usage tracking
npx @ccusage/pi@latest          # Pi-agent usage tracking
npx @ccusage/amp@latest         # Amp usage tracking
npx @ccusage/mcp@latest         # MCP Server

使用方法

# Basic usage
npx ccusage          # Show daily report (default)
npx ccusage daily    # Daily token usage and costs
npx ccusage monthly  # Monthly aggregated report
npx ccusage session  # Usage by conversation session
npx ccusage blocks   # 5-hour billing windows
npx ccusage statusline  # Compact status line for hooks (Beta)

# Filters and options
npx ccusage daily --since 20250525 --until 20250530
npx ccusage daily --json  # JSON output
npx ccusage daily --breakdown  # Per-model cost breakdown
npx ccusage daily --timezone UTC  # Use UTC timezone
npx ccusage daily --locale ja-JP  # Use Japanese locale for date/time formatting

# Project analysis
npx ccusage daily --instances  # Group by project/instance
npx ccusage daily --project myproject  # Filter to specific project
npx ccusage daily --instances --project myproject --json  # Combined usage

# Compact mode for screenshots/sharing
npx ccusage --compact  # Force compact table mode
npx ccusage monthly --compact  # Compact monthly report

機能

  • 📊 日次レポート: トークン使用量とコストを日ごとに集計して表示
  • 📅 月次レポート: トークン使用量とコストを月ごとに集計して表示
  • 💬 セッションレポート: 会話セッション別にグループ化された使用量を表示
  • 5 時間ブロックレポート: Claude の課金期間内での使用量を追跡し、アクティブなブロックを監視
  • 🚀 ステータスライン統合: Claude Code ステータスバーフック用のコンパクトな使用量表示(ベータ版)
  • 🤖 モデル追跡: 使用している Claude モデル(Opus、Sonnet など)を確認
  • 📊 モデル別内訳: --breakdown フラグでモデル別のコスト内訳を表示
  • 📅 日付フィルタリング: --since--until を使用して日付範囲でレポートをフィルタリング
  • 📁 カスタムパス: カスタム Claude データディレクトリロケーションに対応
  • 🎨 美しい出力: カラフルなテーブル形式の表示と自動的なレスポンシブレイアウト
  • 📱 スマートテーブル: 狭いターミナル(100 文字未満)での自動コンパクトモード表示で必須列を表示
  • 📸 コンパクトモード: --compact フラグでコンパクトテーブルレイアウトを強制、スクリーンショットと共有に最適です
  • 📋 モデル表示の強化: モデル名を読みやすさのために�条書きで表示
  • 📄 JSON 出力: --json で構造化された JSON 形式でデータをエクスポート
  • 💰 コスト追跡: 各日・月・セッションのコストを USD で表示
  • 🔄 キャッシュトークンサポート: キャッシュ作成とキャッシュ読み取りトークンを個別に追跡・表示
  • 🌐 オフラインモード: --offline でネットワーク接続なしにプリキャッシュされた価格データを使用(Claude モデルのみ)
  • 🔌 MCP 統合: 他のツールとの統合のための組み込み Model Context Protocol サーバー
  • 🏗️ マルチインスタンスサポート: --instances フラグでプロジェクト別に使用量をグループ化し、特定プロジェクトでフィルタリング
  • 🌍 タイムゾーンサポート: --timezone オプションで日付グループ化用のタイムゾーンを設定
  • 🌐 ロケールサポート: --locale オプションで日付・時刻形式をカスタマイズ(例: en-US、ja-JP、de-DE)
  • ⚙️ 設定ファイル: JSON 設定ファイルでデフォルトを設定、IDE オートコンプリートと検証機能完備
  • 🚀 超小容量バンドル: 他の CLI ツールとは異なり、バンドルサイズに極端に配慮しており、ミニファイ化なしでも信じられないほど小さいです!

ドキュメント

完全なドキュメントは ccusage.com で利用可能です。

開発セットアップ

Nix の使用(貢献者向け推奨)

ccusage に貢献開発者向けに、Nix フレークベースの開発環境を提供しています。

# Clone the repository
git clone https://github.com/ryoppippi/ccusage.git
cd ccusage

# Allow direnv (automatically loads Nix environment)
direnv allow

# Or manually enter the development shell
nix develop

これにより、すべての貢献者と CI システム全体で一貫したツーリングバージョンを確保します。開発環境は flake.nix で定義され、プロジェクトディレクトリに入ると direnv を介して自動的にアクティベートされます。

スポンサー

特集スポンサー

ccusage: Claude Code コストスコアカード(ウイルスのように広がった) をチェックしてください。

ccusage: Claude Code コストスコアカード(ウイルスのように広がった)

スター履歴

— GitHub から取得した原文(一部省略の場合あり)

ccusage logo

ccusage

Socket Badge npm version NPM Downloads install size DeepWiki Mentioned in Awesome Claude Code

ryoppippi%2Fccusage | Trendshift

Analyze your Claude Code token usage and costs from local JSONL files — incredibly fast and informative!

ccusage Family

📊 ccusage - Claude Code Usage Analyzer

The main CLI tool for analyzing Claude Code usage from local JSONL files. Track daily, monthly, and session-based usage with beautiful tables.

🤖 @ccusage/codex - OpenAI Codex Usage Analyzer

Companion tool for analyzing OpenAI Codex usage. Same powerful features as ccusage but tailored for Codex users, including GPT-5 support and 1M token context windows.

🚀 @ccusage/opencode - OpenCode Usage Analyzer

Companion tool for analyzing OpenCode usage. Track token usage and costs from OpenCode sessions with the same reporting capabilities as ccusage.

🥧 @ccusage/pi - Pi-agent Usage Analyzer

Companion tool for analyzing pi-agent session usage. Track token usage and costs from your pi-agent sessions with daily, monthly, and session-based reports.

@ccusage/amp - Amp Usage Analyzer

Companion tool for analyzing Amp session usage. Track token usage, costs, and credits from your Amp CLI sessions with daily, monthly, and session-based reports.

🔌 @ccusage/mcp - MCP Server Integration

Model Context Protocol server that exposes ccusage data to Claude Desktop and other MCP-compatible tools. Enable real-time usage tracking directly in your AI workflows.

Installation

Quick Start (Recommended)

Thanks to ccusage's incredibly small bundle size (install size), you can run it directly without installation:

# Recommended - always include @latest to ensure you get the newest version
npx ccusage@latest
bunx ccusage

# Alternative package runners
pnpm dlx ccusage
pnpx ccusage

# Using deno (with security flags)
deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest

💡 Important: We strongly recommend using @latest suffix with npx (e.g., npx ccusage@latest) to ensure you're running the most recent version with the latest features and bug fixes.

Related Tools

npx @ccusage/codex@latest       # OpenAI Codex usage tracking
npx @ccusage/opencode@latest    # OpenCode usage tracking
npx @ccusage/pi@latest          # Pi-agent usage tracking
npx @ccusage/amp@latest         # Amp usage tracking
npx @ccusage/mcp@latest         # MCP Server

Usage

# Basic usage
npx ccusage          # Show daily report (default)
npx ccusage daily    # Daily token usage and costs
npx ccusage monthly  # Monthly aggregated report
npx ccusage session  # Usage by conversation session
npx ccusage blocks   # 5-hour billing windows
npx ccusage statusline  # Compact status line for hooks (Beta)

# Filters and options
npx ccusage daily --since 20250525 --until 20250530
npx ccusage daily --json  # JSON output
npx ccusage daily --breakdown  # Per-model cost breakdown
npx ccusage daily --timezone UTC  # Use UTC timezone
npx ccusage daily --locale ja-JP  # Use Japanese locale for date/time formatting

# Project analysis
npx ccusage daily --instances  # Group by project/instance
npx ccusage daily --project myproject  # Filter to specific project
npx ccusage daily --instances --project myproject --json  # Combined usage

# Compact mode for screenshots/sharing
npx ccusage --compact  # Force compact table mode
npx ccusage monthly --compact  # Compact monthly report

Features

  • 📊 Daily Report: View token usage and costs aggregated by date
  • 📅 Monthly Report: View token usage and costs aggregated by month
  • 💬 Session Report: View usage grouped by conversation sessions
  • 5-Hour Blocks Report: Track usage within Claude's billing windows with active block monitoring
  • 🚀 Statusline Integration: Compact usage display for Claude Code status bar hooks (Beta)
  • 🤖 Model Tracking: See which Claude models you're using (Opus, Sonnet, etc.)
  • 📊 Model Breakdown: View per-model cost breakdown with --breakdown flag
  • 📅 Date Filtering: Filter reports by date range using --since and --until
  • 📁 Custom Path: Support for custom Claude data directory locations
  • 🎨 Beautiful Output: Colorful table-formatted display with automatic responsive layout
  • 📱 Smart Tables: Automatic compact mode for narrow terminals (< 100 characters) with essential columns
  • 📸 Compact Mode: Use --compact flag to force compact table layout, perfect for screenshots and sharing
  • 📋 Enhanced Model Display: Model names shown as bulleted lists for better readability
  • 📄 JSON Output: Export data in structured JSON format with --json
  • 💰 Cost Tracking: Shows costs in USD for each day/month/session
  • 🔄 Cache Token Support: Tracks and displays cache creation and cache read tokens separately
  • 🌐 Offline Mode: Use pre-cached pricing data without network connectivity with --offline (Claude models only)
  • 🔌 MCP Integration: Built-in Model Context Protocol server for integration with other tools
  • 🏗️ Multi-Instance Support: Group usage by project with --instances flag and filter by specific projects
  • 🌍 Timezone Support: Configure timezone for date grouping with --timezone option
  • 🌐 Locale Support: Customize date/time formatting with --locale option (e.g., en-US, ja-JP, de-DE)
  • ⚙️ Configuration Files: Set defaults with JSON configuration files, complete with IDE autocomplete and validation
  • 🚀 Ultra-Small Bundle: Unlike other CLI tools, we pay extreme attention to bundle size - incredibly small even without minification!

Documentation

Full documentation is available at ccusage.com

Development Setup

Using Nix (Recommended for Contributors)

For contributors and developers working on ccusage, we provide a Nix flake-based development environment:

# Clone the repository
git clone https://github.com/ryoppippi/ccusage.git
cd ccusage

# Allow direnv (automatically loads Nix environment)
direnv allow

# Or manually enter the development shell
nix develop

This ensures consistent tooling versions across all contributors and CI systems. The development environment is defined in flake.nix and automatically activated via direnv when entering the project directory.

Sponsors

Featured Sponsor

Check out ccusage: The Claude Code cost scorecard that went viral

ccusage: The Claude Code cost scorecard that went viral

Star History

RELATED

同じカテゴリの他のツール