fix(models): leave orcarouter/auto unpriced and bump daily cache to v28

Sonnet was a guess against a Qwen/Llama flash route. Fusion aliases keep
the 2026-08 live completion-model provenance. Warm days re-derive.
This commit is contained in:
Aditya Vikram Singh 2026-08-23 20:54:21 +05:30
parent dcab9a451c
commit aa1e38016f
6 changed files with 20 additions and 25 deletions

View file

@ -11,7 +11,7 @@
- **`CODEBURN_CACHE_SCOPE=all` forces a full session-cache read.** A ranged query reads only the month shards that can contribute a turn to it, which is a real behaviour change on a warm cache; this is the escape hatch for the case where a number looks wrong and you want to know whether the scoped read is why. Set it and every load ignores its scope and reads every shard, one-shot runs and the resident `codeburn serve` alike. It is a read policy, not an input to any cache fingerprint: setting or unsetting it re-parses nothing and invalidates nothing.
### Added (OrcaRouter)
- **OrcaRouter sessions now price and label like the model they route to.** OrcaRouter is a gateway that exposes route ids (`orcarouter/auto`, `orcarouter/fusion`, …) plus plain upstream ids (`deepseek/deepseek-v4-pro`), and reports the upstream id that actually ran in the completion response's `model` field. The `orcarouter/` prefix is now a routing wrapper like `cmd/` / `antigravity/`, so a routed spelling prices at its upstream LiteLLM row instead of $0; the smart route `orcarouter/auto` aliases to a fast Sonnet rate and the fusion routes alias to their current `openai/gpt-oss-120b` target, so display and report identity match those routed models; and an unknown vendor nested inside the route still fails closed.
- **OrcaRouter sessions now price and label like the model they route to.** OrcaRouter is a gateway that exposes route ids (`orcarouter/auto`, `orcarouter/fusion`, …) plus plain upstream ids (`deepseek/deepseek-v4-pro`), and reports the upstream id that actually ran in the completion response's `model` field. The `orcarouter/` prefix is now a routing wrapper like `cmd/` / `antigravity/`, so a routed spelling prices at its upstream LiteLLM row instead of $0; `orcarouter/auto` stays unpriced (the smart route lands on a Qwen/Llama flash model — a Sonnet alias would overprice it) and the fusion routes alias to their current `openai/gpt-oss-120b` target (live completion `model` field, 2026-08); and an unknown vendor nested inside the route still fails closed. Daily cache v28 so warm days re-derive the new prices.
### Added (Windows)
- **`codeburn menubar` installs and launches the tray app on Windows.** The same command that installs the macOS menubar now does the Windows one, through the same pinned-release path: it resolves `windows-v<cliVersion>`, falls back to a scan of the newest `windows-v*` release carrying both assets when that tag has none, downloads the `.msi` with the same retry and backoff, and verifies its sha256 before anything executes it — a mismatch aborts without ever handing the file to the installer. It then runs `msiexec` out of `%SystemRoot%\System32` (never a bare name, so nothing dropped next to the CLI can impersonate it) with `/i <msi> /passive /norestart`, treats exit 3010 as installed-pending-restart and 1602 as a cancelled install rather than failures, and launches the exe named by the product's Uninstall registry key. An already-installed matching version skips the download and just launches; `--force` reinstalls.

View file

@ -532,7 +532,7 @@ Left/right arrow keys switch between Today, 7 Days, 30 Days, Month, 6 Months, an
### Pricing
Prices every API call using input, output, cache read, cache write, and web search token counts, with a fast mode multiplier for Claude. Prices are fetched from [LiteLLM](https://github.com/BerriAI/litellm) and cached locally for 24 hours at `~/.cache/codeburn/`. Hardcoded fallbacks for all Claude and GPT-5 models prevent fuzzy-matching mispricing. Routing-gateway model ids are priced as the model they wrap: [OrcaRouter](https://www.orcarouter.ai) route ids (`orcarouter/auto`, `orcarouter/fusion`, …) peel to the model the gateway routes to, and a nested upstream spelling (`orcarouter/deepseek/deepseek-v4-pro`) prices at that exact row, so a gateway-routed session reports real spend instead of $0.
Prices every API call using input, output, cache read, cache write, and web search token counts, with a fast mode multiplier for Claude. Prices are fetched from [LiteLLM](https://github.com/BerriAI/litellm) and cached locally for 24 hours at `~/.cache/codeburn/`. Hardcoded fallbacks for all Claude and GPT-5 models prevent fuzzy-matching mispricing. Routing-gateway model ids are priced as the model they wrap: [OrcaRouter](https://www.orcarouter.ai) fusion route ids peel to their current upstream (`openai/gpt-oss-120b`), `orcarouter/auto` stays unpriced until a live probe pins the rotating target, and a nested upstream spelling (`orcarouter/deepseek/deepseek-v4-pro`) prices at that exact row, so a gateway-routed session reports real spend instead of $0.
### Task Categories

View file

@ -33,7 +33,7 @@ const WORK = process.env['UPGRADE_PATH_WORK'] || join(tmpdir(), 'codeburn upgrad
const OLD_SESSION_CACHE = 'session-cache.v7.json'
const OLD_DAILY_CACHE = 'daily-cache.v17.json'
const NEW_SESSION_CACHE_DIR = 'session-cache.v9'
const NEW_DAILY_CACHE = 'daily-cache.v27.json'
const NEW_DAILY_CACHE = 'daily-cache.v28.json'
const HOME = join(WORK, 'user home')
const PAYLOADS = join(WORK, 'payloads')

View file

@ -168,7 +168,8 @@ import type { DateRange, ProjectSummary } from './types.js'
// v25: #1047 activity-id pricing. v24 on main already shipped #1090.
// v26: #946 copilot session-store accounting (see the top of this ladder).
// v27: #1093 claude-haiku-4.5 alias (see top).
export const DAILY_CACHE_VERSION = 27
// v28: #1118 OrcaRouter route pricing (fusion aliases + peel; auto stays unpriced).
export const DAILY_CACHE_VERSION = 28
const MIN_SUPPORTED_VERSION = 27
/// Providers whose per-day CALL COUNT means something different at

View file

@ -291,7 +291,7 @@ export async function loadPricing(): Promise<void> {
// Known model name variants that providers emit but LiteLLM/fallback don't index under.
// OMP emits 'anthropic--claude-4.6-opus' (double-dash, dot version, tier-last).
// getCanonicalName strips a KNOWN vendor/router prefix first unless the
// full cleaned id itself is an alias (orcarouter/auto). Post-strip forms
// full cleaned id itself is an alias (orcarouter/fusion). Post-strip forms
// still cover every other entry here.
const BUILTIN_ALIASES: Record<string, string> = {
'anthropic--claude-4.6-opus': 'claude-opus-4-6',
@ -345,15 +345,11 @@ const BUILTIN_ALIASES: Record<string, string> = {
'claude-4-7-opus-xhigh': 'claude-opus-4-7',
'claude-4-7-opus-xhigh-fast': 'claude-opus-4-7',
'qwen-auto': 'claude-sonnet-4-5',
// OrcaRouter's smart route. The route picks a model per request; at the time
// of writing it lands on a Qwen/Llama flash model, so a fast Sonnet rate is
// the honest estimate until the route's target stabilizes (mirrors the
// `*-auto` presets above). Display and report identity follow this target.
'orcarouter/auto': 'claude-sonnet-4-5',
// OrcaRouter's fusion routes currently serve openai/gpt-oss-120b (verified
// live 2026-08). If the gateway re-routes them, these drift like any other
// preset estimate; they keep a priced row instead of reporting $0. Display
// and report identity follow this target, not a branded route label.
// OrcaRouter fusion routes. Provenance: live OrcaRouter completion `model`
// field, 2026-08 (community #1058 / house #1118). Re-verify if the gateway
// rotates targets. `orcarouter/auto` is intentionally unaliased: the smart
// route currently lands on a Qwen/Llama flash model, so a Sonnet alias
// would overprice ~3–30×. Fail closed until a live probe pins that target.
'orcarouter/fusion': 'openai/gpt-oss-120b',
'orcarouter/fusion-flash': 'openai/gpt-oss-120b',
'orcarouter/fusion-mini': 'openai/gpt-oss-120b',
@ -791,8 +787,8 @@ function getCanonicalName(model: string): string {
.replace(/@.*$/, '')
.replace(/-\d{8}$/, '')
.replace(/\[[^\]]*\]$/, '')
// Full-id aliases (orcarouter/auto) must stay visible so resolveAlias can
// see them. Stripping first would leave a leaf (`auto`) with no mapping.
// Full-id aliases (orcarouter/fusion) must stay visible so resolveAlias can
// see them. Stripping first would leave a leaf (`fusion`) with no mapping.
// Nested wrappers without an alias still peel as before.
if (Object.hasOwn(userAliases, cleaned) || Object.hasOwn(BUILTIN_ALIASES, cleaned)) {
return cleaned

View file

@ -174,14 +174,12 @@ describe('getModelCosts', () => {
expect(getModelCosts('omniroute:cp/cline-pass/glm-5.3')!.outputCostPerToken).toBe(99 / 1_000_000)
})
it('prices OrcaRouter route ids at their upstream row and the smart route via alias', () => {
// `orcarouter/auto` is a smart route; the alias maps it to a Sonnet flash
// rate rather than leaving it unpriced at $0 (the CLI warns on $0 models).
expect(getModelCosts('orcarouter/auto')!.inputCostPerToken).toBe(
getModelCosts('claude-sonnet-4-5')!.inputCostPerToken,
)
it('prices OrcaRouter fusion and nested upstreams; auto stays fail-closed', () => {
// `orcarouter/auto` rotates onto a Qwen/Llama flash model. No live probe
// pins a rate, so it stays unpriced rather than inheriting Sonnet.
expect(getModelCosts('orcarouter/auto')).toBeNull()
// The fusion routes currently resolve to openai/gpt-oss-120b (verified live).
// The fusion routes currently resolve to openai/gpt-oss-120b (live 2026-08).
expect(getModelCosts('orcarouter/fusion')!.inputCostPerToken).toBe(
getModelCosts('openai/gpt-oss-120b')!.inputCostPerToken,
)
@ -218,7 +216,7 @@ describe('resolveCanonicalModelId', () => {
expect(resolveCanonicalModelId('claude-opus-4.6')).toBe('claude-opus-4-6')
expect(resolveCanonicalModelId('kimi-code')).toBe('kimi-k2-thinking')
expect(resolveCanonicalModelId('cline-pass/kimi-k3')).toBe('kimi-k3')
expect(resolveCanonicalModelId('orcarouter/auto')).toBe(resolveCanonicalModelId('claude-sonnet-4-5'))
expect(resolveCanonicalModelId('orcarouter/auto')).not.toBe(resolveCanonicalModelId('claude-sonnet-4-5'))
expect(resolveCanonicalModelId('orcarouter/fusion')).toBe(resolveCanonicalModelId('openai/gpt-oss-120b'))
expect(resolveCanonicalModelId('orcarouter/fusion-flash')).toBe(resolveCanonicalModelId('openai/gpt-oss-120b'))
expect(resolveCanonicalModelId('orcarouter/fusion-mini')).toBe(resolveCanonicalModelId('openai/gpt-oss-120b'))
@ -290,7 +288,7 @@ describe('getShortModelName', () => {
// OrcaRouter route ids peel to the upstream id, which keeps the upstream label.
expect(getShortModelName('orcarouter/deepseek/deepseek-v4-pro')).toBe('DeepSeek v4 Pro')
// Route ids display as the model they route to, not a branded gateway label.
expect(getShortModelName('orcarouter/auto')).toBe(getShortModelName('claude-sonnet-4-5'))
expect(getShortModelName('orcarouter/auto')).not.toBe(getShortModelName('claude-sonnet-4-5'))
expect(getShortModelName('orcarouter/fusion')).toBe(getShortModelName('openai/gpt-oss-120b'))
expect(getShortModelName('orcarouter/fusion-flash')).toBe(getShortModelName('openai/gpt-oss-120b'))
expect(getShortModelName('orcarouter/fusion-mini')).toBe(getShortModelName('openai/gpt-oss-120b'))