codeburn/src
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
..
data fix(pricing): restore Mythos 5 pricing dropped by gap-fill cleanup 2026-06-10 00:09:31 +02:00
mcp Merge PR #423 (local-model savings) onto main, re-homing payload savings into usage-aggregator 2026-06-06 22:14:13 +02:00
providers feat(kiro): add Kiro CLI session discovery and parsing 2026-06-18 12:42:58 +02:00
antigravity-statusline.ts refactor(cli): share persistent-codeburn resolver; tighten Antigravity hook ownership 2026-05-31 20:07:57 -07:00
bash-utils.ts Strip ANSI escapes from bash commands across all providers 2026-05-02 20:59:24 -07:00
classifier.ts File-aware retry detection with typed ToolCall (#379) 2026-05-22 01:21:42 -07:00
cli-date.ts Add multi-day calendar selection with custom popover UI (#393) 2026-05-24 09:49:59 -07:00
cli.ts Merge main into feat/multi-provider-plans, remove dead tautology 2026-05-16 10:42:03 -07:00
codex-cache.ts File-aware retry detection with typed ToolCall (#379) 2026-05-22 01:21:42 -07:00
codex-credits.ts feat(codex): compute Codex credit usage (#408, #495) (#510) 2026-06-18 17:03:46 +02:00
compare-stats.ts feat(compare): model comparison with planning rate fix 2026-04-19 08:34:49 -07:00
compare.tsx Quiet routine pricing warnings + menubar recovery from stuck-loading (#266) 2026-05-08 20:33:48 -07:00
config.ts feat: add devin provider (#444) 2026-06-09 21:58:31 +02:00
content-utils.ts fix(parser): tolerate string message content; isolate per-file parse failures (#441) (#450) 2026-06-06 04:01:12 +02:00
context-budget.ts fix(context-budget): use bounded readSessionFile helper 2026-04-17 08:32:19 +02:00
currency.ts fix(network): add timeouts to critical-path fetches (#445) (#448) 2026-06-06 03:25:36 +02:00
cursor-cache.ts fix(cursor): period-aligned lookback; add Vercel AI Gateway provider (#432) 2026-06-09 23:01:43 +02:00
daily-cache.ts fix(daily-cache): purge cached today/future entries on hydration 2026-06-18 12:07:35 +02:00
dashboard.tsx fix(cli): validate --provider and make non-TTY report deterministic (#501) 2026-06-18 12:39:22 +02:00
day-aggregator.ts feat(cli): track local-model cost savings against a paid baseline (#421) 2026-06-01 11:06:39 +03:00
export.ts feat(cli): track local-model cost savings against a paid baseline (#421) 2026-06-01 11:06:39 +03:00
fetch-utils.ts fix(network): add timeouts to critical-path fetches (#445) (#448) 2026-06-06 03:25:36 +02:00
format.ts Validator hardenings on the bug-hunt batch (#254) 2026-05-06 19:50:40 -07:00
fs-utils.ts Merge main into feat/multi-provider-plans, remove dead tautology 2026-05-16 10:42:03 -07:00
ink-win.ts Fix dashboard hang and ExperimentalWarning on Windows 2026-05-02 11:54:58 -07:00
main.ts fix(cli): validate --provider and make non-TTY report deterministic (#501) 2026-06-18 12:39:22 +02:00
menubar-installer.ts fix(menubar): support installer HTTP proxies (#475) 2026-06-11 14:13:10 +02:00
menubar-json.ts feat(codex): compute Codex credit usage (#408, #495) (#510) 2026-06-18 17:03:46 +02:00
model-efficiency.ts feat(report): add per-model efficiency metrics 2026-05-05 23:36:59 -07:00
models-report.ts feat(codex): compute Codex credit usage (#408, #495) (#510) 2026-06-18 17:03:46 +02:00
models.ts fix(pricing): restore Mythos 5 pricing dropped by gap-fill cleanup 2026-06-10 00:09:31 +02:00
optimize.ts Add JSON output for optimize and yield 2026-06-18 12:13:17 +02:00
parser.ts refactor(copilot): apply review fixes to OTel parsing PR #477 2026-06-18 11:56:04 +02:00
persistent-codeburn.ts refactor(cli): share persistent-codeburn resolver; tighten Antigravity hook ownership 2026-05-31 20:07:57 -07:00
plan-usage.ts Merge main into feat/multi-provider-plans, remove dead tautology 2026-05-16 10:42:03 -07:00
plans.ts Add claude-max-5x preset for $100/month tier 2026-04-24 15:47:59 +02:00
session-cache.ts fix(copilot): Implement durable sources for OTel DB parsing. 2026-06-17 21:42:40 +02:00
sqlite.ts Merge main into feat/multi-provider-plans, remove dead tautology 2026-05-16 10:42:03 -07:00
types.ts feat(report): Claude-scoped agent-type breakdown 2026-06-10 11:45:28 +02:00
usage-aggregator.ts feat(codex): compute Codex credit usage (#408, #495) (#510) 2026-06-18 17:03:46 +02:00
yield.ts Add JSON output for optimize and yield 2026-06-18 12:13:17 +02:00