clui
A ratatui TUI that renders Claude Code and Codex (OpenAI) usage limits the same way fulcrum's "Usage Limits" monitoring tab does: a grid of cards, each with a circular progress gauge, the limit name, and a human-friendly reset time.
Claude Code · Usage Limits
╭──────────────────────────────╮╭────────────────────────────────────╮
│ ⢀⣀⣤⣤⣤⣄⣀ ││ ⢀⣀⣤⣤⣤⣄⣀ │
│ ⣤⣾⣿⠿⠛⠛⠛⠻⢿⣿⣦⡄ ││ ⣤⣾⣿⠿⠛⠛⠛⠻⢿⣿⣦⡄ │
│ ⣼⣿⠃ ⢻⣿⡄ 5-Hour ││ ⣼⣿⠃ ⢻⣿⡄ 7-Day Rolling │
│ ⣿⣿ 10% ⢸⣿⡇ Block ││ ⣿⣿ 10% ⢸⣿⡇ Resets Mon 02:00 │
│ ⢹⣿⣆ ⢀⣾⣿⠁ Resets in ││ ⢹⣿⣆ ⢀⣾⣿⠁ · 41% through │
│ ⠉⠻⢿⣿⣶⣶⣶⣾⣿⠿⠋⁁ 3h 54m ││ ⠉⠻⢿⣿⣶⣶⣶⣾⣿⠿⠋⁁ week │
╰──────────────────────────────╯╰────────────────────────────────────╯
Codex · Plus
╭──────────────────────────────╮╭────────────────────────────────────╮
│ ⣼⣿⠃ ⢻⣿⡄ Session ││ ⣼⣿⠃ ⢻⣿⡄ Weekly │
│ ⣿⣿ 1% ⢸⣿⡇ Resets in ││ ⣿⣿ 0% ⢸⣿⡇ Resets Jun 17 │
│ ⢹⣿⣆ ⢀⣾⣿⠁ 4h 59m ││ ⢹⣿⣆ ⢀⣾⣿⠁ 22:21 │
╰──────────────────────────────╯╰────────────────────────────────────╯
q quit r refresh · updated 22:21:30
Data sources
Claude Code
Same as fulcrum (server/routes/monitoring.ts):
- Reads the OAuth token from
~/.claude/.credentials.json(claudeAiOauth.accessToken, must start withsk-ant-oat), falling back to the GNOME keyring viasecret-tool. - Calls
GET https://api.anthropic.com/api/oauth/usagewith theanthropic-beta: oauth-2025-04-20header. - Renders up to four limit blocks: 5-Hour Block, 7-Day Rolling, Opus Weekly, Sonnet Weekly (the model-specific cards only appear when the API reports them, as in fulcrum).
Codex
Same as CodexBar's OAuth fetcher:
- Reads credentials from
$CODEX_HOME/auth.json(default~/.codex/auth.json): a top-levelOPENAI_API_KEYif present, otherwisetokens.access_tokenplustokens.account_id. - Calls
GET https://chatgpt.com/backend-api/wham/usagewithAuthorization: Bearer …andChatGPT-Account-Id: …headers. - Refreshes tokens via
POST https://auth.openai.com/oauth/token(CodexBar's client id) whenlast_refreshis older than 8 days or the API returns 401/403, writing the new tokens back toauth.json. - Normalizes the two rate-limit windows by size — smaller is Session
(5h), larger is Weekly — and shows the plan from
plan_type(pro→ "Pro 20x",pro_lite→ "Pro 5x", else title-cased).
Install
Or from a checkout:
Usage
clui [OPTIONS]
-t, --theme <NAME> Color theme to start with (default: default)
--themes-file <PATH> Custom themes JSON (default: ~/.config/clui/themes.json)
--list-themes Print available themes and exit
Keys: q/Esc quit, r refresh now, t/T next/previous theme.
Themes
Built-in themes: default, dracula, gruvbox, nord, solarized, mono.
Pick one at startup with --theme nord and cycle at runtime with t (the
footer shows the active theme).
Custom themes live in ~/.config/clui/themes.json (or wherever
--themes-file points): a JSON object mapping theme names to color
overrides. Unset fields inherit from base (default: default), and a
custom theme named after a built-in replaces it. Colors are ratatui color
names ("cyan", "darkgray"), hex ("#ff5555"), or 256-color indexes
(237).
Fields: gauge_low (< 70% used), gauge_mid (70–89%), gauge_high (≥ 90%),
ring_bg (unfilled ring), accent (key hints), dim (secondary text),
error, border.