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.2.tar.gz (16.2 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.2-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kiro_usage-0.1.2.tar.gz
Algorithm Hash digest
SHA256 20c3b08204b5406f9e353df99744accbc4831814e7079eebd7f7a3537e5b0090
MD5 04ae5e6be95f1160ac3c6f674cd1745a
BLAKE2b-256 d3c17fd1b3e031077d114f17f4e4cdbe63ed43a8db9d8b30e04872c186749b8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiro_usage-0.1.2.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.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for kiro_usage-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 839f9aad764196851f2f9533ecbe7298ff37fd12c66513339b05f11ba9520673
MD5 9420e9f85090a7a3d7c5aca30594140c
BLAKE2b-256 2a63e47000ba41507f028af5c8a2df87cf780cf10d564fedaf7adfcfeefa37d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiro_usage-0.1.2-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