# pi-tokens

Real-time token usage tracking for Pi. Per-message, per-tool, and session totals.

## Install

```bash
pi install npm:@artale/pi-tokens
```

## Commands

```
/tokens              — session summary (input, output, total, rate)
/tokens tools        — breakdown by tool (which tools eat the most tokens)
/tokens messages     — per-message breakdown (last 20)
/tokens reset        — reset all counters
```

## Tools

- `tokens_usage` — session summary
- `tokens_tools` — per-tool breakdown

## What it tracks

- Input tokens per message
- Output tokens per message
- Tool result sizes (estimated)
- Token rate (tokens/minute)
- Top tools by token consumption

## Why

Context windows aren't infinite. Know what's eating yours. If `bash` is consuming 60% of your tokens, maybe you need pi-lean to truncate its output.

## License

MIT
