Skip to content

Commit cf40ec1

Browse files
unhappychoiceclaude
andcommitted
feat(fetcher): add shared llm_pricing helper
The codex_* and claude_* families both need OpenAI / Anthropic per-token pricing to translate raw token counts into a USD figure. Until now both hardcoded a Price table in their own `common.rs`, which drifts as soon as either vendor changes rates (verified: the hardcoded Claude Opus tier was still at the Opus 4.1 $15/$75 line, while Anthropic dropped Opus 4.5 onward to $5/$25 — splashboard was over-charging Opus 4.7 sessions by ~3x). Replaces the per-family tables with one shared snapshot: - `data/llm_pricing.json` — initial seed, extracted from LiteLLM's `model_prices_and_context_window_backup.json` filtered to OpenAI / Anthropic chat models (117 rows, ~14 KB). Cross-checked against Anthropic's `docs.claude.com/.../pricing` table; matches exactly. - `src/fetcher/llm_pricing.rs` — runtime helper. Fetches `raw.githubusercontent.com/unhappychoice/splashboard/main/data/llm_pricing.json` on every call (the fetcher's own 5-minute disk cache absorbs the redundancy), falls back to a tiny `embedded_floor` covering the current headline models when offline. A follow-up commit wires `chore: sync llm pricing daily via Actions` so the snapshot stays current without human work. Safety stays `Safe` — host is hardcoded, no token leaves the process. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 1b5d7b2 commit cf40ec1

3 files changed

Lines changed: 933 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)