codex-cost 0.1.0

Local web dashboard for inspecting Codex token usage from session logs.
Documentation
# codex-cost

`codex-cost` is a local web dashboard for inspecting Codex token usage from session logs on your machine.

It scans the local Codex data directory, summarizes token totals, and serves a browser dashboard with:

- all-time, today, and last-seven-days token totals
- project, model, thread, effort, and context-window distributions
- draggable timeline filtering
- hover tooltips with exact chart values
- a detailed usage event table

The first release is offline and read-only. It does not call OpenAI APIs.

## Install

From this repository:

```bash
cargo install --path .
```

After publishing to crates.io:

```bash
cargo install codex-cost
```

## Run

Use the default Codex home:

```bash
codex-cost
```

Or pass an explicit Codex data directory:

```bash
codex-cost --codex-home "$HOME/.codex" --listen 127.0.0.1:4317
```

On Windows PowerShell:

```powershell
codex-cost --codex-home "$env:USERPROFILE\.codex" --listen 127.0.0.1:4317
```

Open the printed local URL in a browser.

## Data Source

The dashboard reads:

- `~/.codex/sessions/**/*.jsonl`
- `~/.codex/archived_sessions/*.jsonl`

Token totals are computed from `last_token_usage.total_tokens` in Codex `token_count` events to avoid double-counting cumulative session totals.

## Development

```bash
cargo test
cargo fmt --check
cargo clippy -- -D warnings
node --test tests/number_format.test.cjs
```

## License

MIT