Skip to content

Repository files navigation

konsole-claude-counter

A unified, lightweight usage and counter statusline engine for Claude Code, Gemini CLI, ChatGPT, Codex, and GitHub Copilot.

This utility is completely platform-agnostic (compatible with Linux Debian/Arch, macOS, and Windows) and session-agnostic (automatically parsing active directories). It serves four distinct functions:

  1. Live statusLine Mode (Claude Code): Hooks directly into Claude Code's native statusLine command interface to show real-time context window usage, branch git changes, session cost, and 5h/7d rate-limits in your terminal.
  2. Interactive Live Hooks (Gemini CLI): Integrates with Gemini CLI's SessionStart and AfterAgent hook architecture. It outputs a beautiful 3-line real-time statusline directly to stderr for perfect inline rendering in the terminal (displaying the active folder, git branch status, colour-coded context usage, session cost, and rolling 24h/7d cumulative turn quotas) while passing a compliant JSON payload.
  3. Standalone Executive Report: A command-line dashboard (cognitive-report) that recursively aggregates logs across all five providers (Claude Code, Gemini CLI, ChatGPT, Codex, and GitHub Copilot) using standard log and extension folders to produce an executive cognitive allocation report.

Visual Preview

VS Code Extension Dashboard

The interactive webview dashboard inside VS Code shows live aggregated usage across all providers:

VS Code Extension Dashboard

VS Code Status Bar

The live status bar item shows total estimated cost at a glance, refreshing every minute:

VS Code Status Bar

Standalone Dashboard (Unified Report)

The executive dashboard aggregates your cognitive usage statistics across all projects:

Cognitive Report Dashboard

Real-Time statusLine Integration (Claude Code & Gemini CLI)

The live statusline renders directly beneath your active CLI prompts:

Claude Code (Charcoal Theme)

Claude Code statusLine

Real-Time Logs Integration (GitHub Copilot, ChatGPT, & Codex)

Copilot and ChatGPT/Codex log integrations are automatically traced and displayed in the Standalone Dashboard:

Visual Studio / VS Code (GitHub Copilot Logs)

GitHub Copilot VS Code Logs

ChatGPT & Codex (Local Session Histories)

ChatGPT Session History


VS Code / Visual Studio Extension

The vscode-extension/ directory contains a fully compiled TypeScript extension providing:

  • Status Bar Item: Live aggregated token count and estimated cost (⚡ AI: $1.23), refreshing every 60 seconds. Clicking it opens the dashboard.
  • Sidebar Tree View: Activity bar panel breaking down usage per provider (Claude Code, Gemini CLI, ChatGPT, Codex, GitHub Copilot) with per-provider cost and token counts.
  • Webview Dashboard (AI Usage: Show Dashboard command or Ctrl+Shift+P → AI Usage): Full interactive breakdown using the Navy #0d1b3e / Gold #c8a82c brand palette.

Installation (VS Code Extension)

# Build from source (requires Node.js 18+):
cd vscode-extension
npm install
npm run compile
npx @vscode/vsce package --no-dependencies

# Install the packaged extension:
code --install-extension vscode-extension/generativeai-usage-counter-1.0.0.vsix

The extension reads the same log directories as the Python engine — no additional configuration required.


Features

  • Unified Resource Tracking: Parses and de-duplicates transaction turns for Claude Code (JSONL project logs), Gemini CLI (JSON/JSONL logs), ChatGPT JSON session history (~/.openai/), Codex JSON session history (~/.codex/), and GitHub Copilot telemetry logs.
  • Executive Cognitive Reports: Detailed summary of active sessions, total token volumes (input, output, cache-write, cache-read), and estimated costs for each platform.
  • Project Allocation Analysis: Breakdowns of your resource consumption sorted by filesystem directory and AI tool.
  • Interactive Terminal Statuslines (Claude & Gemini):
    • High-resolution progress bars showing context window usage with adaptive green/yellow/red colour-coding.
    • Rate-limit and rolling turn-limit indicators (with countdown timers for Claude, and rolling 24h/7d historical limit indicators for Gemini).
    • Git repository branch name overlays with staged (+) and modified (~) indicators.
  • Purely Local & Safe: Operates entirely offline with standard logs. No data is transmitted externally.

Requirements

  • Python 3.6+ (built-in libraries only — no external packages required)
  • Claude Code (v2.1.90 or later for the full JSON payload schema)
  • Gemini CLI (for Gemini session directories, tracking, and settings)

Installation & Setup

1. Prerequisite Installations

To ensure both CLI frameworks are installed globally, execute:

# Install Claude Code
npm install -g @anthropic/code

# Install Gemini CLI
npm install -g @google/gemini-cli

2. Install the Tracker Statusline & Corporate Theme

Clone this repository and run the automated installer:

git clone git@github.com:neilmanfredit/GenerativeAI-usage-Counter.git
cd GenerativeAI-usage-Counter

# On Linux and macOS:
./install.sh

# On Windows (or as a cross-platform alternative):
python install.py

This installer automatically detects which tools are available and configures them natively:

  • For Claude Code: Copies the statusline.py statistics engine into ~/.claude/ (along with an OS-appropriate command wrapper) and registers it securely inside ~/.claude/settings.json after making a safety backup.
  • For Gemini CLI: Copies statusline.py into ~/.gemini/ and registers real-time SessionStart and AfterAgent status hooks inside ~/.gemini/settings.json after making a safety backup.
  • CLI Command Shortcut: Places a convenient executable cognitive-report (or cognitive-report.bat on Windows) in ~/.local/bin/ so you can generate your corporate resource dashboard instantly from any directory.

Usage Instructions

Standalone Dashboard (Unified Report)

Run the unified command from any directory:

cognitive-report

Outputs an executive, board-ready corporate report summarizing cognitive allocation and estimated costs across all 5 AI providers with a project-by-project breakdown.

Integration with ChatGPT & Visual Studio Code (Copilot)

ChatGPT & Codex Session Logs

The statistics engine scans for JSON-formatted session history files inside:

  • ChatGPT: ~/.openai/
  • Codex: ~/.codex/

Any local tools or clients that export session histories into these folders are automatically tracked, displaying their token transmission, completion details, and estimated OpenAI API equivalent costs in the dashboard.

GitHub Copilot in VS Code & Visual Studio

The paths resolution module automatically scans the standard directories where the VS Code and Visual Studio Copilot extensions write their telemetry and transaction logs:

  • Windows: %LOCALAPPDATA%\GitHub Copilot (VS Code), %APPDATA%\Microsoft\VisualStudio (Visual Studio), and %APPDATA%\Code\logs
  • macOS: ~/Library/Logs/GitHub Copilot/ and ~/Library/Application Support/Code/logs
  • Linux: ~/.config/github-copilot/ and ~/.config/Code/logs

Simply use Copilot normally in VS Code or Visual Studio, and run cognitive-report to see your Copilot token volume integrated alongside your Claude Code and Gemini CLI resource metrics.

Real-Time statusLine (Claude Code)

The statusline loads automatically every time you launch Claude Code:

claude

Configuration (Terminal statusLines)

You can customise both the Claude Code and Gemini CLI statusline displays by setting these environment variables in your shell configuration profile (e.g., ~/.bashrc, ~/.zshrc, or Windows System Environment Variables):

Variable Default Description
CC_BAR_WIDTH 10 Character width of progress bars
CC_SHOW_GIT 1 Show/hide the Git repository status
CC_SHOW_RATE_LIMITS 1 Show/hide the subscriber rate/turn limit line
CC_SHOW_COST 1 Show/hide the running turn cost on line 2
GEMINI_DAILY_TURN_QUOTA 200 Turn count quota used for Gemini's 24h limit indicator
GEMINI_WEEKLY_TURN_QUOTA 1000 Turn count quota used for Gemini's 7d limit indicator
CLAUDE_DAILY_TURN_QUOTA 100 Turn count quota used for Claude's 24h static fallback indicator
CLAUDE_WEEKLY_TURN_QUOTA 500 Turn count quota used for Claude's 7d static fallback indicator

Set CC_ variables to 0 to disable those respective features.


Uninstallation

To cleanly remove all statusline wrappers, custom backend engines, CLI shortcuts, and settings/theme customisations, run:

# On Linux and macOS:
./uninstall.sh

# On Windows (or as a cross-platform alternative):
python uninstall.py

License

CC BY-NC-SA 4.0 — see LICENSE.

About

Lightweight, unified, platform-agnostic usage and cost tracking statusline engine for Claude Code and Gemini CLI, featuring board-ready executive cognitive allocation dashboards.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages