Local token reports

llm-tokei

Turn local agent sessions into clear token, cache, and cost reports.

$ cargo install llm-tokei
Terminal table generated by llm-tokei with token totals and cost columns
Why

One report for many agents.

Usage is scattered across IDE chats, terminal sessions, databases, model names, and pricing tables. llm-tokei makes it one local report.

Default view source x model, sorted by total
Time windows 24h, 7d, month, or exact dates
Scriptable output tables for people, JSON for scripts
Session dumps Codex and Copilot JSONL
Sources

Reads the usual local files.

Agent Default location Artifact
Codex CLI $CODEX_HOME/sessions session JSONL
OpenCode $OPENCODE_DATA_DIR/opencode.db read-only SQLite
Claude Code $CLAUDE_HOME/projects project logs
Copilot Chat editor workspaceStorage chat sessions
Copilot CLI ~/.copilot/session-state event logs
Counts

The useful columns.

Input

prompt and cache tokens

Output

assistant tokens

Reasoning

reasoning tokens when available

Cost

mixed, official, and provider splits

Sessions

distinct local histories

Commands

Start here.

Month by provider

llm-tokei --cost-per provider --cost official --month -h

Project last day

llm-tokei --24h --group-by project,source,model

Expensive sessions

llm-tokei --7d --group-by session,source,model --sort cost --limit 10

Automation JSON

llm-tokei --7d --format json --group-by source,model,project
Local

History stays on your machine.

llm-tokei reads local artifacts and opens OpenCode data read-only. No provider history API required.