codeburn/mac/Sources/CodeBurnMenubar/Data
Resham Joshi a3da2ded2a
feat(codex): compute Codex credit usage (#408, #495) (#510)
* feat(codex): compute Codex credit usage (#408, #495)

Codex/ChatGPT subscription users consume credits, a unit separate from API
dollars: usage is billed as credits-per-million-tokens at per-model rates that
differ from the API USD pricing CodeBurn uses for cost. So the reported dollar
cost does not match what credits actually consume.

Add a credit engine sourced from the official Codex credit rates
(developers.openai.com/codex/pricing): GPT-5.5 125/12.5/750, GPT-5.4
62.5/6.25/375, GPT-5.4 mini 18.75/1.875/113 credits per 1M input/cached/output
tokens. Surface per-model credit usage in `codeburn models` JSON output
(credits field; null for non-Codex or unknown models). models-report already
folds reasoning into output and keeps non-cached input + cached-read separately,
which is exactly what the credit rates expect, so the figure is exact.

Engine + computation are unit-tested. UI display surfaces (the models table,
the TUI dashboard, the menubar "credits" view) are intentionally left for a
follow-up so the display choice can be decided.

* feat(menubar): opt-in Codex credits display metric (#408, #495)

Surface Codex credit usage in the menubar as a selectable metric, without
changing the default. Cost ($) stays the default in both the menubar and the
CLI; credits only appear when explicitly chosen.

- TS: buildMenubarPayloadForRange computes the period's Codex credits (via the
  tested aggregateModels, so reasoning/cached are handled) and exposes
  current.codexCredits in the menubar JSON.
- Swift: new DisplayMetric.credits, a "Credits (Codex)" option in the metric
  picker, decodes codexCredits, and renders it in the menu-bar title. Default
  metric remains .cost.
2026-06-18 17:03:46 +02:00
..
CapacityEstimator.swift feat(mac): native Swift menubar app + one-command install 2026-04-17 16:55:56 -07:00
ClaudeCredentialStore.swift fix(menubar): read Claude keychain via security CLI on silent refresh (#490) (#491) 2026-06-14 10:31:56 +02:00
ClaudeSubscriptionService.swift Menubar and CLI hardening from multi-agent audit (#257) 2026-05-06 22:15:11 -07:00
CLIClaudeConfig.swift feat(menubar): configure CLAUDE_CONFIG_DIRS via Settings (#434) (#436) 2026-06-06 02:30:46 +02:00
CodexCredentialStore.swift fix(menubar): treat the CLI credential store as the source of truth 2026-05-31 05:01:19 -07:00
CodexSubscriptionService.swift fix(menubar): treat the CLI credential store as the source of truth 2026-05-31 05:01:19 -07:00
CodexUsage.swift Live quota bar inside AgentTab + Claude OAuth refresh gate (#255) 2026-05-06 19:57:17 -07:00
DataClient.swift fix(menubar): await terminationHandler instead of blocking a queue thread; cap CLI spawns (#462) 2026-06-09 21:27:32 +02:00
MenubarPayload.swift feat(codex): compute Codex credit usage (#408, #495) (#510) 2026-06-18 17:03:46 +02:00
MenubarStatusCache.swift feat(menubar): drop launchd fetcher; GUI writes its own badge backstop 2026-05-30 13:35:07 -07:00
QuotaSummary.swift Live quota bar inside AgentTab + Claude OAuth refresh gate (#255) 2026-05-06 19:57:17 -07:00
SubscriptionRefreshCadence.swift Live quota bar inside AgentTab + Claude OAuth refresh gate (#255) 2026-05-06 19:57:17 -07:00
SubscriptionSnapshotStore.swift Live quota bar inside AgentTab + Claude OAuth refresh gate (#255) 2026-05-06 19:57:17 -07:00
SubscriptionUsage.swift feat(mac): native Swift menubar app + one-command install 2026-04-17 16:55:56 -07:00
UpdateChecker.swift fix(menubar): re-check CLI version on every update cycle 2026-05-27 06:35:00 -07:00