Generate usage statistics from your OpenAI Codex CLI data.
- Message Statistics: Total messages, daily/monthly breakdowns, top 10 busiest days
- Token Usage: Input, output, cached, and reasoning tokens per month
- Session Tracking: Number of sessions per month
- Copilot Pro Comparison: Compare your usage against the 1,500 messages/month limit
Choose either:
- Python: Python 3.6+ (no external dependencies)
- Go: Go 1.18+ (no external dependencies)
python3 generate-stats.py# Build once
go build -o codex-usage-stats
# Run
./codex-usage-statsOr run directly:
go run main.goOutput is written to ~/.codex/usage-statistics.md.
The script reads from:
| File/Directory | Description |
|---|---|
~/.codex/history.jsonl |
User message history with timestamps |
~/.codex/sessions/YYYY/MM/DD/*.jsonl |
Session files with token usage data |
- Summary - Total messages, active days, date range, averages
- Token Usage Summary - Total tokens broken down by type
- Monthly Breakdown - Messages and sessions per month
- Monthly Token Usage - Token consumption per month
- Top 10 Busiest Days - Highest activity days
- Daily Breakdown - All active days grouped by month
- Usage Pattern Analysis - Copilot Pro quota comparison
## Token Usage Summary
| Metric | Tokens |
|--------|--------|
| **Total Tokens** | 4,369,677,393 (4369.7M) |
| **Input Tokens** | 4,345,071,360 (4345.1M) |
| **Output Tokens** | 24,334,033 (24.3M) |
| **Cached Input** | 4,197,451,520 (4197.5M) |
| **Reasoning Output** | 16,294,128 (16.3M) |
| Type | Description |
|---|---|
| Input Tokens | Tokens sent to the model (prompts, context) |
| Cached Input | Input tokens served from cache (faster, cheaper) |
| Output Tokens | Tokens generated by the model |
| Reasoning Output | Tokens used for chain-of-thought reasoning |
MIT