Skip to main content

Track token usage and costs across Kiro CLI sessions

Project description

kiro-usage

Track token usage and costs across Kiro AI coding sessions — in real time.

PyPI version Python License: MIT Platform

A lightweight terminal dashboard that monitors your Kiro CLI token consumption and cost estimates — including cache-read/cache-write breakdown — and persists data across /clear and restarts via a background archiver.

Why? Kiro does not expose running token totals in the UI. This tool fills that gap: see exactly how many tokens and dollars each session costs, live, as you work.


Features

  • Real-time dashboard — live-refreshing terminal UI (powered by Rich)
  • Session archiving — background service snapshots sessions every 10 s; data survives /clear and Kiro restarts
  • Cache breakdown — separates CacheWrite (new tokens), CacheRead (context resent), and Output tokens
  • Cost estimates — cache-aware pricing (5-min write rate vs. 1-hour read rate)
  • Multiple time windows — today / last 7 days / last 30 days / all time
  • JSON output — pipe-friendly --json flag for scripting
  • IDE tracking — tracks usage across Kiro IDE sessions as well as CLI sessions
  • macOS + Linux — service registration via launchd (macOS) or systemd (Linux)

Install

Requires uv (recommended) or pip with Python ≥ 3.9.

# install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# install kiro-usage and register the background archiver
uv tool install kiro-usage && kiro-usage install

Or with pip:

pip install kiro-usage
kiro-usage install

Usage

kiro-usage              # today's usage, live refresh
kiro-usage week         # last 7 days
kiro-usage month        # last 30 days
kiro-usage all          # all time

kiro-usage --json       # JSON output (machine-readable)
kiro-usage --no-live    # print once and exit (good for scripts/CI)

Service Management

kiro-usage install      # register background archiver (launchd / systemd)
kiro-usage uninstall    # remove background archiver
kiro-usage status       # check archiver status

The background archiver watches the Kiro CLI SQLite database for changes and snapshots sessions to ~/.kiro_sessions/ every 10 seconds. This ensures session data is preserved even after /clear or a Kiro restart.


How It Works

Kiro CLI / Kiro IDE
  SQLite database (~/.kiro/...)
        │
        │  file mtime poll (every 10 s)
        ▼
  kiro-usage-archiver  ──►  ~/.kiro_sessions/*.json
  (launchd / systemd)

  kiro-usage viewer    ◄──  ~/.kiro_sessions/*.json
  (on-demand, live-refresh)

Token Metrics

Metric Description
CacheWrite New tokens sent this turn (estimated, chars ÷ 4)
CacheRead Prior context resent to the API (estimated)
Output Tokens streamed back from the model (from chunks, accurate)
Cost Cache-aware estimate — write tokens at 5-min rate, read tokens at 1-hour rate

FAQ

Q: Does this work with Claude / Anthropic models? Yes — Kiro uses Claude models under the hood. kiro-usage tracks whatever tokens Kiro sends and receives.

Q: Does it need an API key? No. It reads Kiro's local SQLite database directly — no network calls, no extra credentials.

Q: Is data sent anywhere? No. Everything stays local in ~/.kiro_sessions/.

Q: Why do costs look like estimates? Kiro doesn't expose the exact prompt/completion split, so input tokens are approximated from character count (÷ 4). Output tokens come from streaming chunks and are accurate.

Q: Does it work without systemd / launchd? Yes. Run kiro-usage-archiver manually in a terminal, or just use kiro-usage without the background service (you'll only see current-session data without persistence across /clear).


Uninstall

kiro-usage uninstall
uv tool uninstall kiro-usage

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiro_usage-0.1.3.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiro_usage-0.1.3-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file kiro_usage-0.1.3.tar.gz.

File metadata

  • Download URL: kiro_usage-0.1.3.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kiro_usage-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ecd024dacec2eb5caa5ceedb64059b3ab6bff6cfd1ae653ec1ab58d1c0081298
MD5 6c31761eedbc3434954bbef785e199dc
BLAKE2b-256 2cda78a4e46dcb0ecad5984eda7fc1e4012247120d9d1dc1ba1d2ed8cb8a9d2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiro_usage-0.1.3.tar.gz:

Publisher: publish.yml on weswes0/kiro-usage-tracker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kiro_usage-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: kiro_usage-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kiro_usage-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0a70e64848df5e22ae32478f838975d0cbf7d66602d021925a98b016b3eef1c2
MD5 e63ea1fae3c6a2c3aa30e0638f1ad3ce
BLAKE2b-256 6a8fbf18c3ad84fa7126d6fb4beb868dd5f036a6695624a0bd600679ccf4b895

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiro_usage-0.1.3-py3-none-any.whl:

Publisher: publish.yml on weswes0/kiro-usage-tracker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page