Commits

ai-usage, day 2: the three functional lanes and repo ready to go public

Codex, MiniMax and z.ai end to end with real data, adaptive layout, normalized JSON, --watch mode, and a secrets audit before publishing.

Yesterday was the day to build: eight commits, and the widget went from being a spec to having the three provider lanes working with real data. I ended the day with the repository ready to open to the public.

Purging legacy code

The repository had dragged along the seed code for Claude, Gemini and Antigravity from the original project, plus the i18n machinery that the new widget does not use. A clean cut: no unused functions, no aliases or re-exports. The list now consists of Codex, MiniMax and z.ai, and the lineage with fuelcheck is documented in the README and the architecture note — not in dead code.

The three lanes, end to end

First visible row: the Codex translator converts its response into canonical windows (short-term and weekly), and the renderer displays it with a traffic-light indicator, usage, countdown and dots. The test exercises the exact chain against the renderer, the spec’s main integration seam, and was verified using the machine’s real credentials.

MiniMax and z.ai entered through the same seam. MiniMax delivers the remaining percentage for each model: it is normalized into consumption and collapsed into the worst-consumption window, along with the nearest reset. z.ai encodes windows as unit/number pairs and the key without the Bearer prefix; reset timestamps arrive with millisecond precision and are stored as UTC instants. With that, all three widget lanes now speak the same language.

Layout, JSON and configuration

The horizontal three-provider line is around 96 characters: it does not fit in a narrow panel. The layout now switches to vertical when the full line does not fit the terminal’s actual width — to make it fit, not proportionally — and a flag lets you force either variant. The JSON also changed in philosophy: previously, it returned the raw payloads from each API and a script had to learn three schemas; now there is a domain model with ok, windows and error, and, along the way, two leaks were closed (error messages that dragged response data along, and a reset in the year 10000 that broke serialization). As for the configuration: only providers declared in ~/.config/ai-usage/config.json are queried, with the explicitly written key taking priority over the auto-detected one.

Watch mode and the fallen reviewers

--watch keeps the widget pinned in a tmux pane with a configurable interval, and exits cleanly with Ctrl-C: it waits for the current query to finish so it does not interrupt a credential renewal halfway through writing. I added the gray traffic-light test (error, no quota and unlimited, code 90), and here came the anecdote of the day: both subagent reviewers fell instantly with usage_limit_reached. The tool that monitors quotas was knocked over by a quota. I handled the review myself, directly, and it was worth it: the review led to renaming the test, which was called "ErrorAndNoQuota" but also covered the unlimited row.

Before opening it to the public

I ended the day with a secrets audit across the tree and the 28 commits: the credentials live outside the repo, and the only token-shaped literal is a fake test JWT. There was, however, an inappropriate artifact: an 11 MB compiled binary committed at the root, which I removed from version control and added to the .gitignore. The binary remains accessible in old commits; if you want a completely clean history, it would need to be rewritten with git filter-repo before making the repo public.