Repository navigation
Codex usage on Clawdmeter: a proposal, from a fork that has run it for months #258
Replies: 1 comment 2 replies
|
@nathanjohnpayne I've been using Codex quite a bit and the resets especially are something that makes a lot of sense to want to track. I like the idea that you showed off with the Codex screen using the white colors which are a good way to indicate data coming from the GPT app I think. Should we start perhaps with a simple Codex screen as a test run i.e. just the screen here without the Mascot, maybe replacing the "Weekly" label with "Codex". I put a lot of work recently into the mascot feeling life like and ensuring the continuity of it on the device so changes to it are bit more sensitive now.
Answer to nr2 if I understand correctly currently I have an add account folder picked to select additional CLAUDE_CONFIG_DIR's but I would say in this case lets look for the default codex dir, and additionally enable people to manually add more codex dirs via the folder selector if they have more than one account, the folder selector would just detect which type of account. I would also put something on the accounts section indicating we additionally are trialing support for Codex accounts Answer to nr3 that sounds like a good way to go about it query the same endpoint, no refreshing of the token. Answer to nr4 the busy bar thing is interesting, I don't know how it's implemented but it could be interesting to think of ways to create adapters or something to send data to additional devices or different device types... different topic tho I agree. I am working on some custom hardware stuff with PCBWay so it'd be interesting to see how you hooked up your busybar to the app. |


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
In The future of the Clawdmeter project you asked whether supporting other vendors like OpenAI would be a mistake, given that you want to keep the scope small. I've been running that experiment in a fork, Petmeter, which shows Claude and Codex usage on one device. I'd like to offer to bring the useful part upstream, and I'd like your read on the shape before anyone writes Rust. This was drafted with Claude's help; the proposal and the offer are mine.
What I'm proposing
Codex as another account, not another page. The desktop app already handles several Claude accounts, and
PlanSelectorshows the one whose meter moved most recently. A Codex account would join that list. Whichever account you're actually using is the one on the screen, so the device stays one screen of meters and you never have to operate it. That's my answer to the "glance, don't operate" question in #204.It fits the payload almost as it is. Codex Pro currently meters a single weekly window and has no 5-hour limit, which is exactly the
acct:"week"shape that #248 added. A plan that does have a 5-hour window fits the normalproshape. The new wire format would be one key naming the provider (something likepv:"codex"), so the firmware can label the screen and older firmware ignores it. The top-level fields keep their meanings. (Petmeter nests a second provider underx, which upstream already uses for "end the alert", so that part of the fork wouldn't come across.)Off unless you have Codex. If
~/.codex/auth.jsonisn't there, nothing changes: no new polling, no new settings, no new UI.What the fork learned that a port should keep
The Codex usage data has a few traps, and each of these rules exists because breaking it once put a wrong number on my device:
GET chatgpt.com/backend-api/wham/usageis what the Codex CLI itself and CodexBar use. Healthy calls take 3–4 s, and during a bad spell 6 of 8 calls went past 10 s. A short timeout doesn't fail fast; it quietly hands every poll to the fallback.rate_limitsinto its session logs, which is useful during a brief outage. A 16-hour-old record once showed 69% of a weekly window that had since reset, while the real number was 10%. A blank panel is recoverable; a confidently wrong one isn't. The fork drops records whose window has reset or that are more than an hour old. That matches your "a failed poll is never a zero" rule.primary/secondaryare positional, not semantic.What I'd leave out, at least at first
notifysetting that could drive them, but that's a separate question.thpalette work makes a provider-specific default plausible later, but it isn't needed to show the numbers.A second display: BUSY Bar
The fork also mirrors usage to a BUSY Bar, a 72×16 LED matrix for the desk with a local HTTP API (no cloud round trip). It rotates through each quota with its label and countdown, and Clawd on the Claude cards. It's a mirror, not a second device link: the payload goes to the ESP32 first and is then copied to the bar, and a slow or unplugged bar never holds up or blocks the main device. The fork's BUSY Bar README has every screen and the device quirks.
It's separate from the Codex question, and I'd keep it out of the Codex PRs either way.
Questions for you
api/oauth/usageendpoint, so this would be a second dependency of the same kind.If the answer is yes, I'd split the work into two PRs: first the core change that lets an account be something other than a Claude config dir, with no behaviour change, then the Codex source on top. Both would follow the PR template, including the agent review and hardware testing.
Here's the Codex screen as the fork draws it today, for reference only. The upstream version would use the existing meter layout:
All reactions