codexusage
See how much your OpenAI Codex sessions cost - broken down by day, month, or session - right from your terminal.
Inspired by @ccusage/codex, codexusage is a ground-up Rust rewrite built for users who need a significantly faster and lighter alternative to scan large session histories.
Install
Quick start
# Daily usage summary
# Monthly report as JSON
# Last 7 days only
# Custom session directory
Examples
Filter by date range:
Skip network and use cached pricing:
JSON output for scripts and dashboards:
Watch mode
Monitor today's usage live in your terminal. The screen refreshes automatically and shows a rolling burn rate so you can see how fast tokens are being consumed:
Custom refresh interval (default 5 seconds):
Opt in to per-model burn-rate columns inside the watch table:
Sample output:
Current Day Codex Usage Watch
Date: 2026-03-11 Window: 60 minutes
+-----------+------------+----------------+
| Metric | Today | Burn Rate (/h) |
+-----------+------------+----------------+
| Input | 450K | 56K |
| Cache | 120K | 15K |
| Output | 30K | 4K |
| Reasoning | 12K | 2K |
| Total | 612K | 77K |
| Cost | $0.85 | $0.11 |
| Updated | 2026-03-11 | 14:32:23 |
+-----------+------------+----------------+
Watch mode does not support --json, --since, --until, or --last-days.
Use --per-model-burn-rate to append one burn-rate column per active model, with aggregate Burn Rate (/h) kept as the rightmost column.
When the terminal is too narrow to fit every per-model column in one table, watch mode automatically
stacks multiple table blocks vertically, repeating the Metric column in each block while keeping
Today in the first block and aggregate Burn Rate (/h) in the final block.
Options
Commands:
daily- group usage by daymonthly- group usage by monthsession- group usage by sessionwatch- live current-day monitor with burn rate
Flags:
--json- emit structured JSON instead of a table--since/--until- inclusive date filters--last-days N/-L N- show the last N calendar days (daily only)--timezone- IANA timezone for grouping--offline- use cached pricing, never hit the network--refresh-pricing- force a pricing refresh--session-dir- override session directory (repeatable)--threads N- scanner worker count--number-format full- show full token counts instead of K/M/B/Twatch --per-model-burn-rate- show per-model burn-rate columns in the live watch table
--last-days cannot be combined with --since or --until.
By default, codexusage scans CODEX_HOME/sessions (or ~/.codex/sessions when CODEX_HOME is not set).
Sample output
Daily Codex Usage Report
+------------+--------------+-------+-------+--------+-----------+-------+-------+
| Date | Model | Input | Cache | Output | Reasoning | Total | Cost |
+------------+--------------+-------+-------+--------+-----------+-------+-------+
| 2026-03-01 | TOTAL | 120K | 30K | 8K | 4K | 158K | $0.20 |
| | gpt-5 | 120K | 30K | 8K | 4K | 158K | $0.20 |
+------------+--------------+-------+-------+--------+-----------+-------+-------+
| 2026-03-02 | TOTAL | 90K | 20K | 6K | 2K | 118K | $0.03 |
| | gpt-5-mini | 90K | 20K | 6K | 2K | 118K | $0.03 |
| | GRAND TOTAL | 210K | 50K | 14K | 6K | 276K | $0.23 |
+------------+--------------+-------+-------+--------+-----------+-------+-------+
Pricing
Pricing data is cached locally and refreshed automatically when stale. Use --offline to skip network access entirely, or --refresh-pricing to force an update.
Live pricing refreshes use the system CA store through reqwest's Rustls backend. Minimal containers or stripped-down CI images may need a CA bundle such as ca-certificates installed for refreshes to succeed.
Performance
codexusage was built because @ccusage/codex became unusably slow on large session directories. The table below shows a side-by-side comparison on the same dataset.
Test environment: 4.4 GB across 7726 session files, Intel i7-1185G7 (8 logical CPUs).
| Tool | Wall time | Peak RSS |
|---|---|---|
codexusage |
1.82 s | 193 MB |
@ccusage/codex |
5 min 36 s | 11,547 MB |
Notes:
@ccusage/codexwas already cached by Bun; the one-time download is not counted.- Results reflect this specific machine and dataset, not a universal guarantee.
Development
Build from source:
Source builds require a working C toolchain and cmake because the reqwest TLS stack pulls in aws-lc-rs.
Quality commands: