Files
cburn/internal/config
teernisse 8984d5062d feat: add configuration system with pricing tables and plan detection
Implement the configuration layer that supports the entire cost
estimation pipeline:

- config/config.go: TOML-based config at ~/.config/cburn/config.toml
  (XDG-compliant) with sections for general preferences, Admin API
  credentials, budget tracking, appearance, and per-model pricing
  overrides. Supports Load/Save with sensible defaults (30-day
  window, subagents included, Flexoki Dark theme). Admin API key
  resolution checks ANTHROPIC_ADMIN_KEY env var first, falling back
  to the config file.

- config/pricing.go: Hardcoded pricing table for 8 Claude model
  variants (Opus 4/4.1/4.5/4.6, Sonnet 4/4.5/4.6, Haiku 3.5/4.5)
  with per-million-token rates across 5 billing dimensions: input,
  output, cache_write_5m, cache_write_1h, cache_read, plus long-
  context overrides (>200K tokens). NormalizeModelName strips date
  suffixes (e.g., "claude-opus-4-5-20251101" -> "claude-opus-4-5").
  CalculateCost and CalculateCacheSavings compute per-call USD costs
  by multiplying token counts against the pricing table.

- config/plan.go: DetectPlan reads ~/.claude/.claude.json to
  determine the billing plan type. Maps "stripe_subscription" to
  the Max plan ($200/mo ceiling), everything else to Pro ($100/mo).
  Used by the budget tab for plan-relative spend visualization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:01:11 -05:00
..