Skip to main content

CLI Consumption

CLI Consumption turns local AI coding CLI metadata into one private, self-contained view of models, tokens, tools, conversations, turns, context pressure, and workflow health. It can consolidate trusted offline copies from several machines or send metadata-only snapshots to a central collector.

It never stores prompts, responses, tool arguments, credentials, or raw provider events. Local token counters are usage metadata, not billing records. Read the privacy boundary before sharing a database or report.

Synthetic CLI Consumption dashboard

The preview and self-contained demo dashboard contain only deterministic synthetic records. Rebuild the HTML with:

uv run python docs/demo/generate.py

The generator never reads provider directories and creates its temporary SQLite database outside the repository. The demo HTML, image, documentation, tests, and other repository assets are excluded from Python distribution artifacts.

Installation

CLI Consumption requires Python 3.11 or newer. Run it directly from PyPI with uv:

uv tool run cli-consumption providers

The default package covers local collection, SQLite storage, exports, and the local HTTP server. Install only the optional runtime capabilities you use:

  • cli-consumption[sync] for the sync client;
  • cli-consumption[postgres] for PostgreSQL;
  • cli-consumption[snapshots] for signed, compressed offline snapshot files;
  • cli-consumption[mcp] for read-only local usage tools over MCP stdio.
  • cli-consumption[otlp] for OTLP/HTTP metrics.

Extras can be combined, for example cli-consumption[postgres] on a central collector.

Quick start

See your local usage in the terminal with one command. quick detects supported CLIs, collects their metadata into cli-consumption.sqlite in the current directory (or --database), and prints the daily report:

uv tool run cli-consumption quick

Running cli-consumption without a command still prints help; quick is the explicit first-run command. It collects like collect --provider all: a large Claude Code, Codex, or other supported store that exceeds an aggregate collection limit switches automatically to bounded batches. A provider that still fails is reported without stopping the others. Rerunning it is safe: collection is idempotent and refreshes the same database. Afterwards, report reads that database without collecting:

uv tool run cli-consumption report daily
uv tool run cli-consumption report monthly --by model --since 2026-09-01
uv tool run cli-consumption report session --provider claude --json
uv tool run cli-consumption report blocks --timezone Europe/Paris
uv tool run cli-consumption report insights
uv tool run cli-consumption report git --project service

Tables show input, cache-read, cache-write, output, reasoning, and total tokens, the cache rate, and conversation, turn, and call counts. Token values that a provider does not record display as n/a, never as zero, and conversation-aggregate or context-snapshot counters are flagged. An estimated cost at public API list prices, from a versioned price table bundled with the package, prices each call of providers with additive token counters; it is an estimate, not an invoice, and unknown models display as n/a. --pricing PATH merges a local price override. Token counters are local usage metadata, not billing data. See terminal reports for every option and the JSON contract.

From a checkout, detect supported local CLIs, collect their metadata, and create an offline dashboard:

uv sync --all-extras
uv run cli-consumption collect --provider all
uv run cli-consumption export --output reports

Open reports/dashboard.html locally. It makes no network requests. Detailed CSV tables are generated only when --csv is passed.

Dashboard development lives in the locked npm workspace under packages/. It builds provider-neutral ESM analytics, shared React presentation primitives, and deterministic React/Tailwind browser assets that Python embeds in the wheel. The React runtime is the only offline renderer; collection and offline reporting do not require Node.js.

The authenticated persistent dashboard lives in apps/web/. It reads the same minimized reporting contract through a server-side Next.js BFF: the browser never receives a collector credential or a database connection string. Its Export offline action downloads the exact visible selection as a self-contained detailed or share-safe HTML file. For a production setup, required environment variables, reverse-proxy constraints, and startup commands are documented in the deployment guide.

To collect one provider or select another database:

uv run cli-consumption collect --provider codex --database usage.sqlite

When a Claude Code, Codex, Copilot, Amp, Continue, Gemini, Pi, or Qwen store exceeds aggregate collection limits, the command automatically writes bounded, restart-safe batches to the same database; sync and snapshot create batch the same way. Individual file and line safety limits remain enforced: in batches, only the conversation holding an oversized file is skipped and counted. Pass --no-incremental to fail instead, or --incremental to force batches.

When collecting into a local SQLite file, unchanged eligible transcripts reuse normalized metadata from the file cache. Use collect --full to force parsing.

Local collection honors supported provider directory overrides, such as CODEX_HOME and CLAUDE_CONFIG_DIR. Use --source [LABEL=]PATH for trusted offline copies and repeated --project NAME=PATH_PREFIX mappings for stable project labels. See the usage and operations guide for signed offline transfers, multi-machine collection, reporting, PostgreSQL, retention, synchronization, readiness, and automation.

Supported CLIs

The current registry supports Aider, Amazon Q Developer CLI, Amp, Antigravity, Claude Code, Cline, Codex, Continue, Crush, Cursor CLI, Gemini CLI, GitHub Copilot CLI, Goose, Grok Build, Kilo Code, Kimi Code CLI, Mistral Vibe CLI, OpenCode, OpenHands CLI, Pi, Plandex, and Qwen Code.

Provider formats are internal and can change without notice. Exact source locations, token semantics, extraction limits, synthetic qualification fixtures, provenance, and known gaps live in the provider support ledger. Inspect the local registry without exposing paths or content:

uv run cli-consumption providers --json

Essential limits

  • Provider files are untrusted. Collection enforces discovery, file, line, SQLite row, structured-field, and total normalized-record limits; direct provider-file symlinks are refused. Incremental collection resets only aggregate per-batch limits and keeps a separate hard batch-count ceiling.
  • collect --strict and sync --strict refuse a batch when any provider skipped malformed records. Collection distinguishes provider_limit_exceeded, provider_format_incompatible, invalid_snapshot, and the unexpected-failure fallback provider_collection_failed; machine-readable results use these fixed codes without paths, payloads, response bodies, tokens, or exception text.
  • Dashboards are self-contained and network-free. Share-safe mode pseudonymizes labels, groups tools, rounds timestamps, and hides small cohorts, but still exposes aggregate work patterns.
  • CSV and normalized databases remain detailed private operational data. Never treat a technically completed turn as a measure of quality or productivity.
  • Central collection requires TLS, token rotation, backups, limits, monitoring, and a reverse proxy. The application does not replace those operator controls.

See Privacy for the exact data boundary and Architecture for ingestion, idempotency, migrations, report limits, and collector behavior.

Commands

Command Purpose
quick Collect detected providers, then print the daily usage report.
collect Collect local or copied provider data into SQL.
report Print usage tables, usage insights, quota or activity blocks, and git correlations from SQL.
statusline Print a one-line Claude Code status line from SQL and stdin.
mcp Serve local SQLite usage aggregates over MCP stdio.
snapshot Create or ingest signed, compressed offline snapshot files.
sync Collect and send metadata-only snapshots to a central API.
upload-db Upload validated snapshots reconstructed from a local collect database.
serve Run the scoped central ingestion, reporting, and export API.
budget check Check local token and estimated cost budgets.
export Write the HTML dashboard and optional CSV tables.
providers List provider names and compatibility status.
retry-links Inspect aggregate retry evidence in qualified local Copilot CLI journals.
retention Preview or apply deletion outside a retention window.

Run uv run cli-consumption COMMAND --help for every option. The usage guide contains copy-ready examples.

To run the API and bundled persistent dashboard together, install Node.js 20.9 or newer and use uv tool run cli-consumption serve --front. The command asks for a dashboard password when CLI_CONSUMPTION_DASHBOARD_PASSWORD is not set; it does not require a repository checkout or npm install.

Documentation

Development

uv sync --all-extras --all-groups
uv run pre-commit install
uv run pre-commit run --all-files
uv run ruff format --check .
uv run ruff check .
uv run ty check
uv run pytest --cov --cov-report=term-missing
uv build
npm ci
npm run verify
npm audit --audit-level=high
npm run build:web
npm run test:e2e

npm run screenshots renders both dashboards from the synthetic demo in light and dark themes, at desktop and phone widths (390 and 320 px), into .agent-tmp/screens/latest (override with SCREENSHOT_DIR) for design review, and records any sideways page scroll in overflow.tsv. It never reads a local database. npm run check:contrast prints the WCAG contrast of every colour pair the dashboards paint, in both themes, and fails below 4.5:1 for text or 3:1 for control borders and data marks.

Development uses short-lived branches and squash-merged pull requests into protected main. Read CONTRIBUTING.md and AGENTS.md before changing the project.

License

Licensed under the Apache License 2.0.

Metadata

Release files for cli-consumption 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cli-consumption 0.6.1
File Size Uploaded Provenance Actions
cli_consumption-0.6.1.tar.gz 3.7 MB With provenance Details for cli_consumption-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cli-consumption 0.6.1
File Interpreter ABI Platform Actions
cli_consumption-0.6.1-py3-none-any.whl Python 3 none any Details for cli_consumption-0.6.1-py3-none-any.whl

Total release size: 7.5 MB

Release files / cli_consumption-0.6.1.tar.gz

Download URL cli_consumption-0.6.1.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
ca9e3cee348bbe32e79ae6f2baacb63dc0105b4a234cdb08f31837b317a06102
BLAKE2b-256 checksum
How to use checksums
7464f8adaed36cbac5aad13e679bd2f9b54f4ca29eff4f71f29f36a082e0d255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Release files / cli_consumption-0.6.1-py3-none-any.whl

Download URL cli_consumption-0.6.1-py3-none-any.whl
Size 3.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f0514386c4aaa4499b52b7f50074b74676f486b1287b51fcde8add7e812ccae1
BLAKE2b-256 checksum
How to use checksums
f8b00d43916a98ee812c97bc53b3949a4af38d64571a6bb3dffb134012a06691
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

Security for cli-consumption 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cli_consumption-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page