codeburn/mac/Sources/CodeBurnMenubar/Views
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
..
ActivitySection.swift Fix per-provider data loss, history regression, and decode fragility (#362) 2026-05-20 04:16:48 -07:00
AgentTabStrip.swift feat: add devin provider (#444) 2026-06-09 21:58:31 +02:00
FindingsSection.swift Fix timezone handling: menubar UTC bugs, --timezone flag, DST-safe dates 2026-04-30 17:33:02 -07:00
HeatmapSection.swift Add contribution heatmap insight (#437) 2026-06-06 02:49:08 +02:00
HeroSection.swift feat(menubar): make the daily budget alert respect the display metric (#497) (#505) 2026-06-18 13:07:28 +02:00
MenuBarContent.swift feat(menubar): show CLI update banner when a newer version is available 2026-05-27 06:27:49 -07:00
ModelsSection.swift Only show the Saved column when local-model savings exist 2026-06-06 22:26:29 +02:00
PeriodSegmentedControl.swift Add multi-day calendar selection with custom popover UI (#393) 2026-05-24 09:49:59 -07:00
SectionCaption.swift feat(mac): native Swift menubar app + one-command install 2026-04-17 16:55:56 -07:00
SettingsView.swift feat(codex): compute Codex credit usage (#408, #495) (#510) 2026-06-18 17:03:46 +02:00
SparklineView.swift feat(mac): native Swift menubar app + one-command install 2026-04-17 16:55:56 -07:00
ToolingSection.swift Add tooling breakdowns to CLI and menubar (#373) 2026-05-21 14:38:14 -07:00