modelUsage is a Rust CLI for local token/cost reports from Claude Code, Codex, GitHub Copilot CLI, and OpenCode.
modelUsage v0.1.7
Daily Token Usage Report
┌────────────┬─────────────────────────────────┬────────┬─────────┬─────────────┬────────────┬──────────────┬────────────┐
│ Date ┆ Models ┆ Input ┆ Output ┆ Cache Write ┆ Cache Read ┆ Total Tokens ┆ Cost (USD) │
╞════════════╪═════════════════════════════════╪════════╪═════════╪═════════════╪════════════╪══════════════╪════════════╡
│ 2026-02-03 ┆ haiku-4-5, opus-4-5 ┆ 384 ┆ 254 ┆ 265,854 ┆ 3,350,740 ┆ 3,617,232 ┆ $2.07 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┤
│ 2026-02-04 ┆ haiku-4-5, sonnet-4-6 ┆ 1,248 ┆ 912 ┆ 120,440 ┆ 1,852,103 ┆ 1,974,703 ┆ $1.08 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┤
│ Total ┆ ┆ 1,632 ┆ 1,166 ┆ 386,294 ┆ 5,202,843 ┆ 5,590,935 ┆ $3.15 │
└────────────┴─────────────────────────────────┴────────┴─────────┴─────────────┴────────────┴──────────────┴────────────┘
Total: 2 days, 5,590,935 tokens, $3.15
modelUsage v0.1.7
Daily Token Usage Report
┌────────────┬───────────────┬────────────┬───────────┬───────────┬─────────────┬──────────────┬────────────┐
│ Date ┆ Models ┆ Input ┆ Output ┆ Reasoning ┆ Cache Read ┆ Total Tokens ┆ Cost (USD) │
╞════════════╪═══════════════╪════════════╪═══════════╪═══════════╪═════════════╪══════════════╪════════════╡
│ 2026-02-03 ┆ gpt-5.2 ┆ 601,961 ┆ 151,564 ┆ 134,331 ┆ 4,275,328 ┆ 5,028,853 ┆ $11.41 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┤
│ 2026-02-10 ┆ gpt-5.3-codex ┆ 2,344,719 ┆ 458,072 ┆ 88,263 ┆ 112,996,096 ┆ 115,798,887 ┆ $30.29 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┤
│ 2026-03-03 ┆ gpt-5.3-codex ┆ 11,671,017 ┆ 495,864 ┆ 115,215 ┆ 137,844,096 ┆ 150,010,977 ┆ $51.49 │
├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌━┼╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌╌╌━━┼╌╌╌╌╌╌╌╌╌╌━━┤
│ Total ┆ ┆ 14,617,697 ┆ 1,105,500 ┆ 337,809 ┆ 255,115,520 ┆ 270,838,717 ┆ $93.19 │
└────────────┴───────────────┴────────────┴───────────┴───────────┴─────────────┴──────────────┴────────────┘
Total: 3 days, 270,838,717 tokens, $93.19
Run in this repository:
cd /home/ashyearl/workspace/rust/modelUsage
cargo run -- --claudeInstall to ~/.cargo/bin:
cargo install --path /home/ashyearl/workspace/rust/modelUsage --forceDownload prebuilt archives from GitHub Releases:
modelUsage-linux-x86_64.tar.gzmodelUsage-linux-aarch64.tar.gzmodelUsage-macos-aarch64.tar.gzmodelUsage-windows-x86_64.tar.gzmodelUsage-windows-aarch64.tar.gz
Linux/macOS example:
tar -xzf modelUsage-linux-x86_64.tar.gz
install -m 755 modelUsage ~/.local/bin/modelUsagemodelUsage # latest 30 days, Claude + Codex + Copilot + OpenCode
modelUsage --claude # Claude only
modelUsage --codex # Codex only
modelUsage --copilot # Copilot CLI only
modelUsage --opencode # OpenCode only
modelUsage --project # project summary (grouped by cwd only)
modelUsage --daily --project # date -> project
modelUsage --project --daily # project -> date
modelUsage --all # full history
modelUsage --tz Asia/Shanghai # aggregate by IANA timezone
modelUsage --tz UTC+8 # aggregate by UTC offset shortcut
modelUsage --json # JSON output
modelUsage --refresh # rebuild stats cache
modelUsage --update # download and replace current binaryTimezone accepts:
- IANA names, e.g.
Asia/Shanghai - offset shortcuts, e.g.
UTC+8,utc+8,+08:00,-3:30 local(default)- Codex source roots include both
~/.codex/sessionsand~/.codex/archived_sessionswhen present. - Copilot CLI settled usage is read from
~/.copilot/session-state/*/events.jsonl(requires Copilot CLI v0.0.422+). - Copilot cache write and in-progress session usage can be cross-filled from OTel JSONL. By default
modelUsagechecksCOPILOT_OTEL_FILE_EXPORTER_PATH, then falls back to~/.copilot/otel.jsonl. - OpenCode usage is read from its session database at
~/.local/share/opencode/opencode.db(viaopencode db path); the db is opened read-only so a running OpenCode is never blocked. Cost is computed locally frompricing/official-pricing.json, so plan-profile models without a token price (e.g.glm-5.2) showN/A. - GPT text/code pricing covers GPT-6 Sol, GPT-6.1 Sol, GPT-6 Luna, GPT-5 variants, and GPT-4.x/legacy models listed in PRICING.md. Model versions remain distinct. Codex costs use the current bundled Standard rates, including published long-context multipliers for requests with more than 272,000 input tokens. Other sources still use short-context rates. Service-tier, regional, and tool-call surcharges are not included, and unverified model prices remain
N/A. - Codex cache writes are included when the log supplies
cache_write_input_tokens(orcache_write_tokens). In Codex-only tables,Inputexcludes cache reads and writes;Cache Writeappears when nonzero, andTotal Tokenscounts each token once. JSONusage.inputretains the raw input count including cache reads and writes.Reasoningis already included inOutputand is not billed again. Older Codex statistics caches are rebuilt automatically after this accounting update. - Claude compact calls are included. When a
compact_boundarylacks exact API usage,modelUsageestimates it frompreTokens/postTokens, the nearby model, and the recorded 5-minute or 1-hour cache lifetime, then emits a warning. - Claude advisor tool calls are included. Their tokens are not part of the message's top-level
usage; eachadvisor_messageentry inusage.iterationsis counted as its own row under the advisor's model (which can differ from the main model). Advisor calls interrupted before completion leave no usage in the log and cannot be counted.
Recommended Copilot CLI startup for the best available Copilot accounting:
COPILOT_OTEL_FILE_EXPORTER_PATH=$HOME/.copilot/otel.jsonl copilot- Some Copilot builds currently write
input/output/cache_readinto OTel but do not emitgen_ai.usage.cache_creation.input_tokens, soCache Writecan still remain0even when OTel is enabled.
- Auto-check runs only on interactive terminals after the main report.
- Checks are throttled to once per 24 hours.
--jsonand non-TTY runs skip update checks.- On Windows,
--updatecurrently requires manual binary replacement after download. - When Claude data is present, a warning describes upstream local-log omissions and whether compact usage was estimated.
- Linux x86_64
- Linux arm64
- macOS arm64
- Windows x86_64
- Windows arm64
- Chinese README: README-zh.md
- Pricing rules: PRICING.md
- Pricing rules (Chinese): PRICING-zh.md
- Implementation details: docs/IMPLEMENTATION.md
- Current version:
0.1.37 - Source of truth:
Cargo.toml - Tag format:
vX.Y.Z