Skip to main content

Fast Claude Code + Codex usage and cost, from your local logs.

Project description

aiburn

Fast, local usage & cost reporting for Claude Code and Codex — in one table. See how fast you're burning money on your coding agents.

A deliberately small alternative to ccusage, scoped to just the two agents I use. It reads your local session logs, prices them offline, and prints per-day / per-month / per-session cost. A single static binary with sub-millisecond startup; it streams the logs and aggregates incrementally, so memory stays flat even as they grow to tens of GB.

$ aiburn
aiburn · Claude Code + Codex usage

Date            Input     Output          Cache     Claude    Codex      Total
──────────  ─────────  ─────────  ─────────────  ─────────  ───────  ─────────
2026-07-16     11,326    348,040     46,373,051     $72.79        –     $72.79
2026-07-17      2,665    139,378     26,644,318     $33.02        –     $33.02
2026-07-20      2,690     98,911      8,214,564      $8.03        –      $8.03
──────────  ─────────  ─────────  ─────────────  ─────────  ───────  ─────────
TOTAL       2,982,331  1,534,324    256,344,781    $249.52   $64.81    $314.33

Claude      $249.52   177,853,108 tokens
Codex        $64.81    83,008,328 tokens
Total       $314.33

Scanned 1166 files in 413ms

Run it

Once published to PyPI (see Releasing), no install is needed — uv fetches the right prebuilt binary and runs it:

uvx aiburn                 # ephemeral run (macOS / Linux, any arch)
uvx aiburn monthly

To keep it around as a permanent command:

uv tool install aiburn     # then just `aiburn`

From source

With a Rust toolchain:

cargo install --git https://github.com/handason/aiburn

Usage

aiburn [command] [options]

Commands:
  daily      Per-day usage and cost (default)
  monthly    Per-month usage and cost
  session    Per-session usage and cost

Options:
  --since <YYYY-MM-DD>   Only include usage on/after this date
  --until <YYYY-MM-DD>   Only include usage on/before this date
  --claude               Only Claude Code
  --codex                Only Codex
  --all                  Show every session (session view; default: top 25)
  --json                 Emit JSON instead of a table
  -h, --help             Show this help
  -v, --version          Show version

What it reads

  • Claude Code~/.claude/projects/**/*.jsonl (and ~/.config/claude, $CLAUDE_CONFIG_DIR). Assistant message.usage records, deduplicated per (message id, request id) keeping the final streamed token counts.
  • Codex~/.codex/sessions/** and ~/.codex/archived_sessions/** (or $CODEX_HOME). Per-turn token_count deltas, with the model taken from the surrounding turn_context.

How cost is computed

Pricing is a small curated table in src/pricing.rs, taken from LiteLLM / models.dev (July 2026). Costs are always recomputed from tokens — the logged costUSD is ignored so both agents are priced consistently.

  • Claude cache creation is split into 5-minute (1.25× input) and 1-hour (2× input) tiers; cache reads are 0.1× input.
  • Codex input_tokens includes cached tokens, so the cached portion is billed at the cache-read rate and the remainder at the input rate. output_tokens already includes reasoning tokens.

Claude totals match ccusage to within ~0.3%. Codex is approximate (~1–2%): Codex logs carry no authoritative cost, and standard pricing is assumed.

To add or correct a model, edit the table() in src/pricing.rs.

Why it's fast (and light)

  • Streaming reader — files are read one line at a time with a reused buffer, so a 150 MB session file costs one line of memory, not 150 MB.
  • Incremental aggregation — each usage record is folded into the running totals (src/agg.rs) as it is parsed and then dropped. Peak memory scales with the number of groups (days / months / sessions), not the number of events, so it stays flat as Codex logs grow into the tens of GB.
  • Field-scanning parser — a tiny hand-rolled JSON scanner (src/json.rs) reads only the few fields it needs and skips everything else (the large content blocks) without allocating.
  • Parallel — files are parsed across all cores with rayon.
  • No heavyweight depsrayon + libc only; dates via libc::localtime_r.

Measured on ~1.5 GB of logs / ~2.9 B tokens (~1,166 files): cold ~1.2 s, warm ~0.25 s, ~80 MB peak RSS, sub-millisecond process startup, ~470 KB binary.

Releasing

Publishing is what makes uvx aiburn work everywhere. Wheels (each carrying the compiled binary for one platform) are built and pushed to PyPI by .github/workflows/release.yml on every v* tag, for macOS arm64/x86_64 and Linux x86_64/aarch64.

First-time setup:

  1. Push this repo to github.com/<you>/aiburn and update the URL in pyproject.toml.
  2. On PyPI, add a trusted publisher for the project: owner <you>, repo aiburn, workflow release.yml, environment pypi. (No API token needed.)

Cut a release:

# bump version in Cargo.toml, then:
git tag v0.1.0 && git push --tags

The workflow builds all wheels and publishes them; uvx aiburn picks up the new version automatically.

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

aiburn-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (297.6 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

aiburn-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (282.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

aiburn-0.1.0-py3-none-macosx_11_0_arm64.whl (258.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

aiburn-0.1.0-py3-none-macosx_10_12_x86_64.whl (274.1 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file aiburn-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aiburn-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d66700c3370c55cef682280448dce49e574dd480a4f874e69d42e97d8a8843f
MD5 d0ed095153e1b5bec81b0a5754da383b
BLAKE2b-256 ac109d232fe5ca188497aca2b9af6410e1431e3cf75cb1a8e6722c1e0e51e321

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiburn-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on handasontam/aiburn

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

File details

Details for the file aiburn-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for aiburn-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 41159a7751417bdb4891c1090dcfe72282df68746d5de8f4f46c8726e8921655
MD5 fac9b4ad820990a52021aadaf6977b65
BLAKE2b-256 2b92e6e1b1b4174914df190c0cb4937f1d84a47f71c15b42117f21b42e22e077

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiburn-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on handasontam/aiburn

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

File details

Details for the file aiburn-0.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: aiburn-0.1.0-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 258.0 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for aiburn-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35254537ecbd6befe9179f3e3b27c33bd295facdba80f457a66fb34a8a643997
MD5 8953e581f639d8df638c9e3dcc8e2219
BLAKE2b-256 4f6ec2abbdf6a8a4b09b5fc1f40d0f115f3030cc26ff2e814bb00614652b3651

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiburn-0.1.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on handasontam/aiburn

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

File details

Details for the file aiburn-0.1.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aiburn-0.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 81ad50803e5db5cd2c7759f2af0b82136fb28e2e10fd39a77dcad3f72c889b51
MD5 132ffa51a6257a27b850b8c4c61dd787
BLAKE2b-256 3f3eb27955a6783dacb5d3eefe9ad739d29636237b4fcedba3bb334ec05d6bde

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiburn-0.1.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on handasontam/aiburn

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