Unified AI usage metrics in a fast terminal UI.
Claude, OpenAI, OpenRouter, GitHub Copilot, and Codex, side by side.
Quick Start | Features | Providers | GNOME Extension | Screenshots | Contributing
- Interactive TUI built with Textual
- Unified dashboard across multiple providers
- Scriptable CLI with JSON output
- Cached requests to reduce API calls
- Normalized output format for automation
- Optional GNOME Shell extension in
extension/ - Multiple time windows (5h, 7d, 30d)
| Provider | Status | Auth Required |
|---|---|---|
| Claude Code | OAuth (unofficial) | CLAUDE_CODE_OAUTH_TOKEN or Claude CLI |
| OpenAI | Official API | OPENAI_ADMIN_KEY |
| OpenRouter | Official API | OPENROUTER_API_KEY |
| OpenAI Codex | OAuth (unofficial) | ~/.codex/auth.json or CODEX_ACCESS_TOKEN |
| GitHub Copilot | Device flow (internal API) | usage-tui login --provider copilot or GITHUB_TOKEN |
# From source
pip install -e .
# Or with pipx
pipx install .
# Run setup wizard
usage-tui setup# Claude Code (uses existing CLI auth)
claude setup-token
# GitHub Copilot (device flow)
usage-tui login --provider copilot
# OpenAI / OpenRouter (set env vars)
export OPENAI_ADMIN_KEY=sk-...
export OPENROUTER_API_KEY=sk-or-...usage-tui tuiKeyboard shortcuts:
r- Refresh data5- Switch to 5 hour window7- Switch to 7 day windowj- Toggle raw JSON viewq- Quit
# Show all providers
usage-tui show
# Show specific provider
usage-tui show --provider claude
usage-tui show --provider openai
# Change time window
usage-tui show --window 5h
usage-tui show --window 30d
# Output as JSON (for scripting)
usage-tui show --json
# Check configuration
usage-tui doctor
# Show required env vars
usage-tui envNotes:
- Default
usage-tui showprints both 5-hour and 7-day windows for Claude and Codex - Use
--windowto force a single window output
The optional GNOME Shell extension displays AI usage metrics directly in your top panel.
- GNOME Shell 45, 46, 47, or 48
usage-tuiCLI installed and configured
# Create the extension directory
mkdir -p ~/.local/share/gnome-shell/extensions/usage-tui@gnome.codexbar
# Copy extension files
cp extension/* ~/.local/share/gnome-shell/extensions/usage-tui@gnome.codexbar/After copying the files, GNOME Shell must be restarted to detect the new extension.
X11 Session:
# Press Alt+F2, type 'r', press Enter
# Or run:
busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Reloading…")'Wayland Session:
# Log out and log back in (GNOME Shell cannot be restarted on Wayland)After restarting GNOME Shell:
# Enable the extension
gnome-extensions enable usage-tui@gnome.codexbar
# Verify it's active
gnome-extensions info usage-tui@gnome.codexbarUse the included dev script for extension development:
cd extension
# Enable/disable extension
./dev.sh enable
./dev.sh disable
# Reload extension (disable + enable)
./dev.sh reload
# View extension logs
./dev.sh logs
# Start nested GNOME Shell for testing (Wayland)
./dev.sh startRun the interactive setup wizard:
usage-tui setupThis will prompt for API keys and save them to ~/.config/usage-tui/env.
The env file uses simple KEY=value format. Environment variables override file values.
# Install and authenticate Claude CLI
npm install -g @anthropics/claude
claude setup-token
# Optional: extract token (uses CLI credentials automatically)
usage-tui login --provider claude
# Or set explicitly
export CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-...Notes:
- Requires an OAuth token with the
user:profilescope - Uses an unofficial endpoint and may change
- Recommended: use Claude CLI credentials (unset
CLAUDE_CODE_OAUTH_TOKENunless you need to override)
export OPENAI_ADMIN_KEY=sk-...export OPENROUTER_API_KEY=sk-or-...# Install and authenticate Codex CLI
npm install -g @openai/codex
codex
# Or set explicitly
export CODEX_ACCESS_TOKEN=eyJ...
Recommended: use Codex CLI credentials unless you need to override# Device flow login (recommended)
usage-tui login --provider copilot
# Or set a token
export GITHUB_TOKEN=ghp_...
Recommended: use device flow login (avoids managing tokens)usage_tui/
__init__.py
cli.py # CLI entry point
tui.py # Textual TUI application
cache.py # Caching layer
config.py # Configuration management
providers/
__init__.py
base.py # Base provider interface
claude_oauth.py # Claude Code OAuth provider
openai_usage.py # OpenAI usage provider
codex.py # OpenAI Codex usage provider
copilot.py # GitHub Copilot usage provider
+---------------------------------------+
| usage-tui CLI |
| CLI layer | TUI layer | GNOME UI |
+----------------------+----------------+
| Provider cache and config |
+----------------------+----------------+
| Claude | OpenAI | OpenRouter | Copilot |
| Codex | adapters with normalized data |
+---------------------------------------+
All providers return data in this normalized format:
{
"provider": "claude | openai | copilot",
"window": "5h | 7d | 30d",
"metrics": {
"cost": 1.42,
"requests": 37,
"input_tokens": 120000,
"output_tokens": 54000,
"remaining": null,
"limit": null,
"reset_at": "ISO8601 | null"
},
"updated_at": "ISO8601",
"raw": {}
}Now:
- TUI dashboard
- Provider adapters for Claude, OpenAI, OpenRouter, Copilot, Codex
- JSON output for automation
Next:
- Waybar / i3blocks output mode
- Prometheus exporter
- Daily usage ledger
- Budget alerts
Later:
- Optional local web dashboard
- Team and org multi-account support
- Notifications (Slack or Discord)
We welcome contributions of all sizes. A few great ways to help:
- Add a provider adapter in
usage_tui/providers/ - Improve documentation and examples
- Add tests for provider parsing
- Add UI polish to the TUI
- Extend desktop integrations
Development setup:
# Install dev dependencies
pip install -e ".[dev]"
# Run linting
ruff check .
# Run type checking
mypy usage_tui
# Run tests
pytestManual smoke checks for UI and CLI changes:
usage-tui show
usage-tui tui| Provider | Limitation |
|---|---|
| Claude | OAuth usage endpoint is unofficial and may change |
| Copilot | Internal API, may lag or change |
| OpenAI | Requires organization admin API key |
| Codex | Uses ChatGPT backend OAuth, may change |
Apache-2.0. See LICENSE.
