Budgets

Part of team status — the budgets table that follows the seats: what is left and used, its source, and how fresh it is.

When the file names an account, or a reading is stored in the state, a budgets: table follows the seats. One row per account and window: what is left and used, when it resets, which seat the figure came from, how long since it changed, the source it was counted from, and whether it is fresh, unconfirmed, stale, refusing, or unknown. A row's account is the seat's own: its account: when the file names one, its vendor when it doesn't, so one vendor's two accounts are two rows. A figure inside its reserve says so on that row, including when it is still fresh. When the counted figure did not come from the first source the account names, the row names the source it did come from and marks it: status line (fallback). An old figure with no known reset reads unknown while it could still matter — inside its reserve, or within the reserve again outside it. Further out — more than the reserve again — it is still shown, its when column saying last seen 40m ago: the room the figure last held. A named account with no reading is unknown. The table is left out when there is nothing to show. status records no reading; the watch is what records one.

An openai account can take its figure from a check instead of the status line. Copy examples/checks/codex-quota onto PATH and name it as that account's check, with check listed before status_line in sources. The script prints the primary window from the newest local rollout that has a quota figure, opening ten files at most, and a second line when that event's secondary window is a different length. For example weekly 39% used resets 114h4m at 1791091200. team passes only PATH and HOME, so CODEX_HOME never reaches the script. With a custom Codex home, install a two-line wrapper that sets it and execs this script, and name the wrapper as the check:

#!/bin/sh
CODEX_HOME=/path/to/codex exec /path/to/codex-quota