mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-07-23 07:54:27 +00:00
Keep model pricing automatic instead of hand-coding new models. The bundler now layers three sources in priority order: LiteLLM (broad list prices), hand-curated MANUAL_ENTRIES overrides, then a separate last-resort fallback file gap-filled from models.dev first-party makers (official direct prices) and OpenRouter (resale backstop). New models such as MiniMax-M3 ($0.6/$2.4) now price correctly with no per-model code. The fallback is written to its own pricing-fallback.json and consulted only case-insensitively as the final step in getModelCosts, so a reseller variant name can never shadow a canonical or aliased match. Fixes surfaced while building and verifying this: - Alias precedence: LiteLLM ships snowflake/claude-4-opus ($5), which the bundler strips to a bare claude-4-opus key that shadowed the curated alias to claude-opus-4 ($15 official). An explicit alias for a bare name now wins over a coincidental stripped reseller key; the prefixed gateway price is still returned for the fully-qualified id. - Zero-stub guard: LiteLLM [0,0] price stubs (e.g. GigaChat-2-Max) are excluded from the case-insensitive index so a case-mismatched query stays null and keeps firing the unknown-model warning instead of silently reporting $0. - Negative-sentinel guard: OpenRouter returns -1 for variable/BYOK-priced models. The bundler now rejects any non-positive rate pair (and strips the sentinel from cache fields) so a negative per-token cost can never ship and subtract from spend totals. Bundler hardening: bareKey strips @pin and date suffixes to match the runtime canonical form, seen-set dedupes on both full and bare key shapes, and it logs MANUAL_ENTRIES now covered upstream plus models.dev allowlist drift. Extracted buildCosts so the cache-cost heuristics live in one place. Added a data-hygiene test that fails CI if a rebundle reintroduces negative, free, or unreachable fallback entries. |
||
|---|---|---|
| .. | ||
| fixtures/security | ||
| providers | ||
| security | ||
| antigravity-statusline.test.ts | ||
| bash-commands.test.ts | ||
| blob-to-text.test.ts | ||
| classifier.test.ts | ||
| cli-date.test.ts | ||
| cli-deepseek-v4-pricing.test.ts | ||
| cli-export-date-range.test.ts | ||
| cli-json-daily.test.ts | ||
| cli-model-savings.test.ts | ||
| cli-plan.test.ts | ||
| cli-status-menubar.test.ts | ||
| compare-stats.test.ts | ||
| content-utils.test.ts | ||
| currency-rounding.test.ts | ||
| daily-cache.test.ts | ||
| dashboard.test.ts | ||
| date-range-filter.test.ts | ||
| day-aggregator-savings.test.ts | ||
| day-aggregator.test.ts | ||
| export.test.ts | ||
| fetch-utils.test.ts | ||
| fs-utils.test.ts | ||
| local-model-savings.test.ts | ||
| mcp-coverage.test.ts | ||
| mcp-redact.test.ts | ||
| mcp-server.test.ts | ||
| mcp-tables.test.ts | ||
| menubar-installer.test.ts | ||
| menubar-json.test.ts | ||
| menubar-savings.test.ts | ||
| minimax.test.ts | ||
| model-efficiency.test.ts | ||
| models-hoist.test.ts | ||
| models-report.test.ts | ||
| models.test.ts | ||
| optimize-fs.test.ts | ||
| optimize.test.ts | ||
| parser-claude-cwd.test.ts | ||
| parser-compact-entry.test.ts | ||
| parser-filter.test.ts | ||
| parser-gemini-cache.test.ts | ||
| parser-large-json-scanner.test.ts | ||
| parser-large-session.test.ts | ||
| parser-local-savings.test.ts | ||
| parser-mcp-inventory.test.ts | ||
| parser-skip-line.test.ts | ||
| plan-usage.test.ts | ||
| plans.test.ts | ||
| pricing-fallback-data.test.ts | ||
| provider-registry.test.ts | ||
| provider-turn-grouping.test.ts | ||
| session-cache.test.ts | ||
| usage-aggregator.test.ts | ||