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.
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, 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 --strictandsync --strictrefuse a batch when any provider skipped malformed records. Collection distinguishesprovider_limit_exceeded,provider_format_incompatible,invalid_snapshot, and the unexpected-failure fallbackprovider_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
- Usage and operations
- Production deployment
- Provider support and qualification
- Privacy boundary
- Architecture
- Roadmap
- Contributing
- Security policy
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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cli_consumption-0.6.0.tar.gz | 3.7 MB | With provenance | Details for cli_consumption-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cli_consumption-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for cli_consumption-0.6.0-py3-none-any.whl |
Total release size: 7.5 MB
Release files / cli_consumption-0.6.0.tar.gz
| Download URL | cli_consumption-0.6.0.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b4d25e3704a9800870f0552f72658b2b02010b83d313de6316e343f4a994b8d
|
|
BLAKE2b-256 checksum How to use checksums |
988be94b34bc45670192b141391dccd88ece6af3c787b117b77a827afa0729b8
|
| 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 logRelease files / cli_consumption-0.6.0-py3-none-any.whl
| Download URL | cli_consumption-0.6.0-py3-none-any.whl |
|---|---|
| Size | 3.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78c29947784c29ceea82523517375859b3df041feb9491854feed27f96f127a7
|
|
BLAKE2b-256 checksum How to use checksums |
d91d303527343889b5ce2db4d234d562dc998db339f235dad24b979c2cfe19b9
|
| 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 logSecurity for cli-consumption 0.6.0
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.
Attestation for cli_consumption-0.6.0.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 logA 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.