A persistent usage bar for Codex CLI that shows rate-limit windows, current session context, reset countdowns, last-turn tokens, and plan information from local Codex session logs.
From the creator of claude-usage-bar: the same compact usage-bar idea, rebuilt around Codex CLI's local ~/.codex/sessions/**/*.jsonl data.
Codex does not currently expose Claude Code's documented statusLine command hook, so this project ships as a local command, a Codex skill, and a Windows Terminal bottom-pane wrapper.
Plain text preview (no color)
Normal | Codex | 5h: ██░░░░░░ 12% reset 3h 42m | 7d: ░░░░░░░░ 2% reset 6d 1h | ctx: █████░░░ 60% | last: 155k tok | plan: plus
Warning | Codex | 5h: ██████░░ 84% reset 0h 41m | 7d: ████░░░░ 55% reset 1d 6h | ctx: ██████░░ 74% | last: 181k tok | plan: plus
Critical | Codex | 5h: ███████░ 95% reset 0h 12m | 7d: ███████░ 92% reset 3d 2h | ctx: ███████░ 88% | last: 210k tok | plan: plus
| Field | Meaning | Color thresholds |
|---|---|---|
| 5h, 7d, 30d | Codex rate-limit windows exposed by Codex logs; shown according to WINDOWS / --windows |
green < 80% · yellow 80-90% · red >= 90% |
| reset | Countdown from each limit's resets_at timestamp |
hours/minutes if < 24h · days and hours if >= 24h |
| ctx | Approximate context-window usage for the selected/current Codex session from last_token_usage.total_tokens / model_context_window |
green < 70% · yellow 70-80% · red > 80% |
| last | Last recorded turn token count | informational |
| plan | Plan type reported by Codex rate-limit metadata | informational |
Note: This tool reads local Codex session logs only. It does not call OpenAI APIs and does not read
auth.json.By default,
WINDOWS=autoshows only the rate-limit windows from the latest Codex usage event. This avoids stale windows from older sessions or previous plan states. UseWINDOWS=5h,7dto force specific labels, orWINDOWS=allto show every non-expired window detected in local logs. Rate-limit windows are account-level/shared, whilectxis session-specific when the Windows wrapper provides session metadata.
- Codex CLI with local session logs
- Python 3.8+
- Windows Terminal for the optional bottom-pane wrapper on Windows
- No external Python dependencies
Windows PowerShell:
.\install.ps1macOS/Linux:
bash install.shThen start a new Codex session and ask for $codex-usage-bar or for your Codex usage/status bar.
Windows PowerShell:
.\codex-usage-bar.ps1 --plain
.\codex-usage-bar.ps1 --watch 5
.\codex-usage-bar.ps1 --jsonmacOS/Linux:
./codex-usage-bar.sh --plain
./codex-usage-bar.sh --watch 5
./codex-usage-bar.sh --jsonDirect Python:
python skills/codex-usage-bar/scripts/codex_usage_bar.py --plainInstall permanent PowerShell functions and the codex wrapper:
.\install-powershell-profile.ps1Open a new PowerShell tab, then run Codex normally:
codexAvailable commands:
codex Codex with the bottom usage pane
codexraw Original Codex CLI without the wrapper
codexusage One-shot or --watch usage command
The bottom pane follows the same response-driven update model as claude-usage-bar: it does not visibly refresh on a timer. It polls local Codex session logs quietly and redraws only when a new token_count usage event appears, which happens after Codex records a response. Each pane locks onto the Codex session file created for that wrapper instance, so ctx reflects that session instead of whichever Codex window produced the latest global event.
Edit usage-bar.conf before installing, or ~/.codex/usage-bar.conf after installing:
LANG=it
COLOR=auto
BAR_WIDTH=8
WINDOWS=autoSupported languages: en, it.
Supported windows: auto/current, all/available, or a comma-separated list such as 5h,7d, 7d, 30d, 300m, 5h.
You can also tune the Windows pane with environment variables:
$env:CODEX_USAGE_BAR_POLL_INTERVAL = "1"
$env:CODEX_USAGE_BAR_LANG = "it"Codex writes session events to JSONL files under ~/.codex/sessions. codex-usage-bar scans event_msg entries whose payload type is token_count, extracts rate-limit metadata and token usage, then formats a compact terminal line. Without session arguments it uses the latest token event. With --session-file, or with --session-start plus --session-cwd, context usage is scoped to that session while rate limits remain shared/global.
Relevant fields:
{
"type": "event_msg",
"payload": {
"type": "token_count",
"info": {
"last_token_usage": {
"total_tokens": 155000
},
"model_context_window": 256000,
"rate_limits": {
"plan_type": "plus",
"primary": {
"used_percent": 12,
"resets_at": 1783800000
},
"secondary": {
"used_percent": 2,
"resets_at": 1784300000
}
}
}
}
}codex-usage-bar/
├── README.md this file
├── preview.svg GitHub preview image
├── usage-bar.conf language/color config
├── install.sh Codex skill installer for macOS/Linux
├── install.ps1 Codex skill installer for Windows
├── install-powershell-profile.ps1 Windows wrapper installer
├── codex-usage-bar.sh local command for macOS/Linux
├── codex-usage-bar.ps1 local command for Windows
├── codex-with-usage.ps1 Windows Terminal pane wrapper
├── bin/
│ ├── codex.cmd PATH shim for wrapped Codex
│ └── codexraw.cmd PATH shim for raw Codex
└── skills/codex-usage-bar/
├── SKILL.md Codex skill instructions
└── scripts/codex_usage_bar.py parser and renderer
| Platform | Status | Notes |
|---|---|---|
| Windows PowerShell | supported | full command, skill, and bottom-pane wrapper |
| macOS | supported | command and skill installer |
| Linux | supported | command and skill installer |
Python standard library only. No API keys, no external packages, no network calls.
MIT
Una barra di utilizzo persistente per Codex CLI che mostra finestre di rate limit, contesto della sessione, countdown al reset, token dell'ultimo turno e piano, leggendo solo i log locali di Codex.
Dallo stesso autore di claude-usage-bar: la stessa idea di barra compatta, ricostruita sui dati locali di Codex in ~/.codex/sessions/**/*.jsonl.
Windows PowerShell:
.\install.ps1macOS/Linux:
bash install.shPoi avvia una nuova sessione Codex e chiedi $codex-usage-bar oppure la tua barra di utilizzo Codex.
Per installare il wrapper Windows con pannello inferiore:
.\install-powershell-profile.ps1Apri una nuova tab PowerShell e usa:
codex- Legge solo i JSONL sotto
~/.codex/sessions. - Di default
WINDOWS=automostra solo le finestre dell'ultimo evento Codex corrente; usaWINDOWS=5h,7dper forzarle oWINDOWS=allper mostrare tutte quelle non scadute rilevate nei log. - Nel wrapper Windows il contesto
ctxviene agganciato al file sessione della finestra Codex corrente; i limiti7d/5hrestano invece condivisi a livello account. - Non chiama API OpenAI.
- Non legge
auth.json. - Se Codex aggiungera un hook nativo tipo status line, lo script potra essere collegato direttamente a quell'hook.