# clui

A ratatui TUI that renders Claude Code and Codex (OpenAI) usage limits as 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
```

## Install

```sh
cargo install clui
```

Or from a checkout:

```sh
cargo install --path .
```

## Usage

```sh
clui
```

Keys: `q`/`Esc` quit, `r` refresh now.

The color palette adapts to the terminal background: clui asks the terminal
for its background color (OSC 11) at startup and every couple of seconds
while running, so toggling the terminal between dark and light mode is
picked up live. Terminals that don't answer the query get the dark palette.

Note for tmux: tmux answers the query itself, with the colors it learned
from the outer terminal when the client attached. If the outer terminal's
theme changes later, tmux won't know about it unless the terminal (or the
app embedding it) sends tmux an unsolicited OSC 11 color report.

Successful fetches are cached in `~/.cache/clui/cache.json`, so a fresh
launch paints immediately and quick restarts don't spend extra API requests
(Anthropic rate-limits its usage endpoint aggressively). When a refresh
fails while data is on screen, the retry is noted dimly next to the
provider title rather than as an error.
