diff --git a/CHANGELOG.md b/CHANGELOG.md index 69d36c94..a51624bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ - **`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; `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 v29 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`, 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 /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. - **A menubar app for Windows.** `windows/` is a Tauri 2 tray app — Rust binary, React popover — that puts today's spend in the notification area and mirrors the macOS menubar screen for screen: agent tabs, period switcher, Trend, Forecast, Pulse, Stats and Plan insights, activity and model breakdowns, optimize findings, CSV/JSON export, launch at login, currency, and theme. Windows has no menubar title, so the number lives in a second tray icon rendered from the system font at the panel's native icon size (Settings can turn it off; the tooltip always carries it). It reads everything through the CLI like the macOS and GNOME clients do, and gates on **codeburn 0.9.9 or newer** — the first release accepting `status --format menubar-json --no-optimize` — showing a setup screen with the install command until it finds one. Refresh follows popover visibility the way the macOS app does: 60 s with optimize findings while open, 2 minutes for today's total while closed, and immediately on open when what you are looking at has gone stale. The Claude quota view never spends Claude's single-use refresh token; on a 401 it re-reads Claude Code's own credential file for a token it has already rotated, matching the macOS client. Ships as an unsigned `.msi` from the `windows-v*` tag, which `codeburn menubar` now installs for you. The same crate still builds and runs a tray on Linux, but that stays experimental and unreleased — `gnome/` is the supported Linux surface. @@ -23,7 +26,7 @@ - **The desktop app's cold start paints as soon as the selected period is readable, instead of after the whole history.** The resident `codeburn serve` child now does for its JSON clients what the TUI got in #1107: on a cold cache it answers the first `status --format menubar-json` from the files whose mtime allows them to hold data the requested period can show (the same floor and 48h clock-skew margin), then indexes the rest behind the answer. The payload says so in-band through a new optional `hydration: { complete, indexedFiles, totalFiles }` block, and the desktop app and web dashboard render `indexing history · N/M files · totals below cover what is indexed so far` until it reports `complete: true`. On a 21k-file corpus the app's first payload lands in 7.3s instead of 31.3s, fully indexed at 36.2s. Only the resident serve process ever emits `hydration`, and only it may answer partially — its clients poll, so they converge. Every one-shot output is unchanged and always a full parse: `--format json`/`csv`/`markdown`, `report`, `sessions`, `models`, MCP, the Swift menubar and GNOME clients, and the desktop app's own spawn fallback, none of which have a second poll to converge with. Absence of `hydration` therefore always means complete, which is also what an older CLI's payload means. It is not `stale` (#1100) and never sets it: a first paint is fresh but partial, where a stale payload is complete but old. Nothing is stamped complete until the fill has actually parsed everything, so a process killed mid-fill comes back cold and finishes the job. (#1110) - **The discovery sweep issues its metadata syscalls concurrently.** Every dated command re-walks and re-stats every provider tree before it can decide what is already cached, and that sweep was strictly serial: one `readdir`, one `stat`, one `state.json` read at a time, per provider, one provider after another. On a 21k-file / 9-provider corpus it owned most of a warm run's wall clock while the machine sat idle waiting on the kernel. Provider discovery now runs across providers at once, and the four walks that dominate it (claude, codex, kimicode, grok) plus the Claude project-dir walk and both fingerprint passes fan out through a shared bounded-concurrency helper. Order is unchanged everywhere — each level is re-concatenated in registry/`readdir` order before anything reconciles against the cache — so what is discovered, in what sequence, is byte-identical to the serial walk. Two smaller cuts ride along: the Claude walk reads directory entries with their types so a plain file no longer costs a wasted `subagents/` probe, and the Codex result cache (a single file that can reach hundreds of MB) now shares one in-flight load between concurrent readers instead of letting each one re-read and re-parse it. Warm `codeburn today` on that corpus: 5.30s to 2.99s; a cold parse 34.7s to 31.1s. (#1104) - **A kill mid-way through a non-Claude provider phase no longer restarts that whole phase.** `scanProjectDirs` (Claude) has long taken a throttled `saveProgress` callback so a killed cold parse resumes from a warm cache; `parseProviderSources` (every other provider — codex, cursor, gemini, and the rest) did not, and only persisted at the whole-provider boundary. On a large single-provider corpus (a multi-GB codex history is the common case) an app-timeout SIGKILL, crash, or force-quit during that phase discarded everything parsed since the last provider finished, forcing the entire phase to re-parse from zero on the next run. `parseProviderSources` now takes the same callback, invoked once per source right after that source's cache entry lands (mirroring `scanProjectDirs`' placement, outside the per-file try/catch), on the same file-count/wall-clock throttle. A file only ever gets a fingerprint once it has fully parsed, so a mid-file kill can never leave a half-parsed file's entry looking complete on resume. -- **Routed model ids price as the model they wrap, and an unknown vendor prefix no longer prices by blind stripping.** Token-plan and gateway spellings of the same model (`omniroute:`, `cp/`, `cline-pass/`, `cline-free/`, `cmd/`, `antigravity/`) are peeled and the remaining id is priced, so a Cline Pass or OmniRoute session shows a `~` estimate instead of $0. In exchange, `provider/model` is no longer treated as authority on its own: the leading segment is stripped only when it is a namespace the bundled pricing catalog itself uses (`anthropic/`, `openai/`, `google/`, `x-ai/`, `qwen/`, `moonshotai/`, `nousresearch/`, `xiaomi/`, `z-ai/`, and every other vendor prefix in the LiteLLM snapshot), one of the routing wrappers above, or one of the client-side spellings `kimi/`, `mimo/`, `zhipu/`, `litellm_proxy/` and `openai_like/`. Anything else stays unpriced and is reported as unpriced rather than inheriting the price of a same-named cloud row, and local-runner prefixes (`ollama/`, `lmstudio/`, `hosted_vllm/`, `local/`) are excluded on purpose so an unlisted local tag can never invent cloud spend. A user price override for the bare id wins over the catalog row a routed spelling would otherwise hit. +- **Routed model ids price as the model they wrap, and an unknown vendor prefix no longer prices by blind stripping.** Token-plan and gateway spellings of the same model (`omniroute:`, `cp/`, `cline-pass/`, `cline-free/`, `cmd/`, `antigravity/`, `orcarouter/`) are peeled and the remaining id is priced, so a Cline Pass or OmniRoute session shows a `~` estimate instead of $0. In exchange, `provider/model` is no longer treated as authority on its own: the leading segment is stripped only when it is a namespace the bundled pricing catalog itself uses (`anthropic/`, `openai/`, `google/`, `x-ai/`, `qwen/`, `moonshotai/`, `nousresearch/`, `xiaomi/`, `z-ai/`, and every other vendor prefix in the LiteLLM snapshot), one of the routing wrappers above, or one of the client-side spellings `kimi/`, `mimo/`, `zhipu/`, `litellm_proxy/` and `openai_like/`. Anything else stays unpriced and is reported as unpriced rather than inheriting the price of a same-named cloud row, and local-runner prefixes (`ollama/`, `lmstudio/`, `hosted_vllm/`, `local/`) are excluded on purpose so an unlisted local tag can never invent cloud spend. A user price override for the bare id wins over the catalog row a routed spelling would otherwise hit. - **SQLite providers now survive read-only database parents.** A read-only SQLite open is not read-only on disk: on a WAL database SQLite must create `-shm` and `-wal` in the database's own directory, so a source on read-only media, under restrictive permissions, or inside a Flatpak/snap confinement failed with `attempt to write a readonly database` (or `unable to open database file` when a `-wal` was present without its `-shm`), and both discovery sites swallowed it — the provider read as "not installed" rather than as an error. That covers cursor, cursor-agent, opencode, goose, warp, kilo-code, zerostack and the copilot agent-traces database. The direct open stays the fast path and is byte-identical when it succeeds. When it fails for want of sidecars: a database with no WAL frames to lose is opened in place with `immutable=1`, which costs nothing and cannot go stale; a database with a non-empty `-wal` is copied with its `-wal` into the CodeBurn cache and read there, so its un-checkpointed rows are never silently dropped. The copy costs one database's worth of disk and is taken once per change — it is keyed by the main-plus-WAL fingerprint, published under a fingerprint-stamped name so a refresh never overwrites a copy another process is reading, and superseded copies are evicted once a day has passed without a read, keeping at most one predecessor. If the cache itself cannot be written, the database is skipped with a notice naming it and the reason rather than in silence. The original provider database is never opened writable or modified. - **Grok Build now reads the CLI's own completed-turn usage instead of estimating it.** Usage comes from the `turn_completed.usage` records Grok CLI already writes into `updates.jsonl` (`inputTokens`, `outputTokens`, `cachedReadTokens`, `cacheCreationTokens`, `reasoningTokens`), deduplicated by `prompt_id` and emitted as one session-level call from the top-level totals. The previous parser reconstructed an estimate from the running `_meta.totalTokens` context counter, so **existing Grok totals will change materially on upgrade** - on one real 568-session corpus cache-read went from 150K to 96.3M tokens, total tokens from 20.0M to 113.9M, and cost from $36.98 to $56.79. Cache read and cache creation are subsets of input and reasoning is a subset of output, so reasoning is clamped to the record's reported output and split back out to match this repo's exclusive-reasoning contract. `modelUsage` only selects a priced attribution id; multi-model rate attribution stays out of scope, so one session is priced at one model's rate. `costUsdTicks` is ignored because its scale is undocumented. Sessions with no usable record - older CLI versions - keep the old context-curve heuristic and stay flagged estimated. **In a session that has at least one `turn_completed` record, turns without one are not counted at all** (their tokens are dropped rather than estimated), and the session is marked estimated instead of claiming full provider coverage. Cached Grok sessions re-parse once. The daily cache re-derives once on first run after upgrade: this is a global re-derivation of every day and every provider, since the daily cache has no per-provider invalidation, but it reads the warm session cache rather than re-parsing transcripts, so it costs seconds (~3s on the corpus above), and the superseded cache file is retained on disk as the baseline for days no source can still re-derive. (#998) - **Codex rollouts parse across worker threads too, and the workload gate now takes bytes or files.** Codex is the bigger half of a real cold parse — a 4 GB rollout corpus against 1.8 GB of Claude sessions — and it was still decoding one file at a time. A whole-file rollout decode now runs on the same pool, against an empty dedup set, and comes back with the calls, the dedup keys it claimed, and the codex-cache entry it would have written; the parent installs all three in the serial loop's order, so `codex-results.json` and every payload come out byte-identical to a serial run. Cross-file state stays where it was: a forked rollout replaying its parent's token_count history collides on the parent's keys and is re-parsed in-process, and no worker ever touches the cache module's per-directory state. Files the Codex cache can serve exactly or resume into from a byte offset never reach a worker — they read a few KB and the resume state belongs to the parent. The workload gate is now pending BYTES alone (200 MB), not file count: 250 pending files holding under a megabyte between them spawned threads that made the run ~5% slower, while a few hundred huge rollouts were being turned away. The count takes `max(pendingFiles / 50, pendingBytes / 200 MB)`, and the per-thread memory budget is derived per parse as `clamp(256 MB, 2 × average pending file + 128 MB, 1 GB)` rather than a flat 256 MB — a 260 MB rollout peaks near 430 MB in its worker and scales linearly with the pool, so the flat figure over-subscribed exactly the workload this adds. The decision is per provider, and at most one pool is alive at a time. diff --git a/README.md b/README.md index 78ac72f1..31df76cf 100644 --- a/README.md +++ b/README.md @@ -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. +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 diff --git a/scripts/upgrade-path/run.mjs b/scripts/upgrade-path/run.mjs index c7af2816..74721d3d 100644 --- a/scripts/upgrade-path/run.mjs +++ b/scripts/upgrade-path/run.mjs @@ -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.v28.json' +const NEW_DAILY_CACHE = 'daily-cache.v29.json' const HOME = join(WORK, 'user home') const PAYLOADS = join(WORK, 'payloads') diff --git a/src/daily-cache.ts b/src/daily-cache.ts index 5111e6b1..1644baf5 100644 --- a/src/daily-cache.ts +++ b/src/daily-cache.ts @@ -172,7 +172,9 @@ import type { DateRange, ProjectSummary } from './types.js' // Exclusive providers (Grok and the rest) were under-counted by reasoningTokens // in finalized daily rows; inclusive {claude,codex,copilot} were correct there // but optimize added reasoning again. Re-derive so report matches the live parse. -export const DAILY_CACHE_VERSION = 28 +// v29: #1118 OrcaRouter route pricing (fusion aliases + peel; auto stays unpriced). +// v28 on main already shipped #1115. +export const DAILY_CACHE_VERSION = 29 const MIN_SUPPORTED_VERSION = 28 /// Providers whose per-day CALL COUNT means something different at diff --git a/src/models.ts b/src/models.ts index 652a1924..775d680e 100644 --- a/src/models.ts +++ b/src/models.ts @@ -290,8 +290,9 @@ export async function loadPricing(): Promise { // 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, so only the -// post-strip forms need to be listed here. +// getCanonicalName strips a KNOWN vendor/router prefix first unless the +// full cleaned id itself is an alias (orcarouter/fusion). Post-strip forms +// still cover every other entry here. const BUILTIN_ALIASES: Record = { 'anthropic--claude-4.6-opus': 'claude-opus-4-6', 'anthropic--claude-4.6-sonnet': 'claude-sonnet-4-6', @@ -344,6 +345,14 @@ const BUILTIN_ALIASES: Record = { '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 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', 'kimi-auto': 'kimi-k2-thinking', 'kimi-code': 'kimi-k2-thinking', 'kimi-for-coding': 'kimi-k2-thinking', @@ -774,12 +783,21 @@ function resolveAlias(model: string): string { return model } function getCanonicalName(model: string): string { - return stripKnownFirstNamespace( - model - .replace(/@.*$/, '') - .replace(/-\d{8}$/, '') - .replace(/\[[^\]]*\]$/, ''), - ) + const cleaned = model + .replace(/@.*$/, '') + .replace(/-\d{8}$/, '') + .replace(/\[[^\]]*\]$/, '') + // 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 + } + const lowercase = cleaned.toLowerCase() + if (lowercase !== cleaned && Object.hasOwn(BUILTIN_ALIASES, lowercase)) { + return cleaned + } + return stripKnownFirstNamespace(cleaned) } /// Alias-resolved identity for report merge. Display names stay cosmetic — @@ -801,7 +819,7 @@ export function resolveCanonicalModelId(model: string): string { // `nousresearch/`, …) is never dropped by a stale list. const EXTRA_NAMESPACES = [ // Routing wrappers (see ROUTER_PREFIXES); no catalog lists them. - 'cp', 'cline-pass', 'cline-free', 'cmd', 'antigravity', + 'cp', 'cline-pass', 'cline-free', 'cmd', 'antigravity', 'orcarouter', // LiteLLM route prefixes that never appear as a key prefix. 'litellm_proxy', 'openai_like', // Vendor spellings the catalog indexes under another name: `zhipu` is `z-ai`, @@ -840,6 +858,12 @@ function stripKnownFirstNamespace(model: string): string { // Routing wrappers (OmniRoute, Cline Pass, cmd/, …) are not model ids. // Peel them so any plan/gateway spelling of the same model shares one price. +// OrcaRouter is a gateway that routes to many vendors. Its catalog exposes +// route ids (`orcarouter/auto`, `orcarouter/fusion`, …) and plain vendor ids +// (`deepseek/deepseek-v4-pro`); a route id can also spell a nested upstream +// (`orcarouter/deepseek/deepseek-v4-pro`), and the completion response's +// `model` field reports the upstream id that actually ran. Peeling the prefix +// lets every routed spelling price at the upstream row. const ROUTER_PREFIXES = [ /^omniroute:/i, /^cp\//i, @@ -847,6 +871,7 @@ const ROUTER_PREFIXES = [ /^cline-free\//i, /^cmd\//i, /^antigravity\//i, + /^orcarouter\//i, // `xiaomi/` is NOT peeled: it is the vendor namespace LiteLLM prices under, // and BUILTIN_ALIASES maps the bare MiMo ids INTO it. Peeling would pull the // opposite way. It stays a known namespace via the catalog-derived set. diff --git a/tests/models.test.ts b/tests/models.test.ts index 5580ea0a..d1bef7e8 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -138,7 +138,7 @@ describe('getModelCosts', () => { const known = ['anthropic', 'x-ai', 'xai', 'qwen', 'moonshotai', 'nousresearch', 'kimi', 'litellm_proxy', 'openai_like', 'zhipu', 'mimo', 'xiaomi', - 'cp', 'cline-pass', 'cline-free', 'cmd', 'antigravity'] + 'cp', 'cline-pass', 'cline-free', 'cmd', 'antigravity', 'orcarouter'] for (const ns of known) { expect(getModelCosts(`${ns}/zzz-namespace-probe`), ns).not.toBeNull() } @@ -159,10 +159,13 @@ describe('getModelCosts', () => { 'omniroute:cline-free/zzz-router-probe', 'omniroute:antigravity/zzz-router-probe', 'omniroute:cmd/zzz-router-probe', + 'omniroute:orcarouter/zzz-router-probe', ] for (const id of routed) expect(getModelCosts(id), id).not.toBeNull() expect(getModelCosts('omniroute:nosuchvendor/zzz-router-probe')).toBeNull() + // A nested unknown vendor inside a known routing wrapper must fail closed. + expect(getModelCosts('omniroute:orcarouter/nosuchvendor/zzz-router-probe')).toBeNull() }) it('lets a user price override for a bare id win over the routed catalog row', () => { @@ -170,6 +173,34 @@ describe('getModelCosts', () => { expect(getModelCosts('cp/cline-pass/glm-5.3')!.inputCostPerToken).toBe(99 / 1_000_000) expect(getModelCosts('omniroute:cp/cline-pass/glm-5.3')!.outputCostPerToken).toBe(99 / 1_000_000) }) + + 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 (live 2026-08). + expect(getModelCosts('orcarouter/fusion')!.inputCostPerToken).toBe( + getModelCosts('openai/gpt-oss-120b')!.inputCostPerToken, + ) + expect(getModelCosts('orcarouter/fusion-flash')!.inputCostPerToken).toBe( + getModelCosts('openai/gpt-oss-120b')!.inputCostPerToken, + ) + expect(getModelCosts('orcarouter/fusion-mini')!.inputCostPerToken).toBe( + getModelCosts('openai/gpt-oss-120b')!.inputCostPerToken, + ) + + // Fully-qualified upstream ids peel to the exact LiteLLM row. + expect(getModelCosts('orcarouter/deepseek/deepseek-v4-pro')!.inputCostPerToken).toBe( + getModelCosts('deepseek/deepseek-v4-pro')!.inputCostPerToken, + ) + expect(getModelCosts('orcarouter/deepseek/deepseek-v4-flash')!.outputCostPerToken).toBe( + getModelCosts('deepseek/deepseek-v4-flash')!.outputCostPerToken, + ) + + // A route id for an unknown upstream stays unpriced (fail closed). + expect(getModelCosts('orcarouter/nosuchvendor/zzz-router-probe')).toBeNull() + }) }) describe('resolveCanonicalModelId', () => { @@ -185,6 +216,13 @@ 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')).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')) + expect(resolveCanonicalModelId('orcarouter/deepseek/deepseek-v4-pro')).toBe( + resolveCanonicalModelId('deepseek/deepseek-v4-pro'), + ) }) }) @@ -247,6 +285,13 @@ describe('getShortModelName', () => { expect(getShortModelName('z-ai/glm-5.3')).toBe('GLM-5.3') expect(getShortModelName('xiaomi/glm-5.3')).toBe('GLM-5.3') expect(getShortModelName('cp/cline-pass/glm-5.3')).toBe('GLM-5.3') + // 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')).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')) // Grok Build prices via the grok-build-0.1 sibling. expect(getShortModelName('grok-build')).toBe('Grok Build') expect(getShortModelName('grok-build-0.1')).toBe('Grok Build')