fix(cursor): alias every Cursor model variant so non-Auto sessions price (#159)#290
Merged
fix(cursor): alias every Cursor model variant so non-Auto sessions price (#159)#290
Conversation
c1d9e5d to
f1d5571
Compare
…159) Cursor emits model names in a `claude-<dot-version>-<tier>` shape (`claude-4.6-sonnet`, `claude-4.5-opus`, `claude-4.5-opus-high-thinking`, etc.) plus its own `composer-1` house model. None of these match the canonical LiteLLM pricing keys (`claude-sonnet-4-6`, `claude-opus-4-5`). The alias map in `src/models.ts` filled some of these in v0.9.4 but missed: - plain no-suffix forms: `claude-4.5-opus`, `claude-4.5-sonnet`, `claude-4.6-opus` - haiku tier: `claude-4.5-haiku`, `claude-4.6-haiku` - forward-looking: `claude-4.7-opus` - Cursor's house model: `composer-1` The dashboard rendered $0 for sessions that used any unaliased model — visible in the screenshots posted in #159 even after the v0.9.4 fix that added the `-thinking` variants. This PR fills the gaps and adds 16 regression tests under `Cursor model variants resolve to pricing` that assert every model name in `src/providers/cursor.ts:modelDisplayNames` plus the additional plain forms resolves to a non-null pricing entry with `inputCostPerToken > 0` and `outputCostPerToken > 0`. So a future LiteLLM snapshot bump or a typo in the alias map will fail the test before users see $0. Direct hits in the snapshot (no alias needed): `gpt-5`, `gpt-5.2`, `grok-code-fast-1`, `gemini-3-pro` (already aliased). These are covered in the test suite as well so a snapshot that drops them would also be caught. Tests: 45 files, 617 passing locally (16 new). Closes #159.
f1d5571 to
c1f4b05
Compare
This was referenced May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of three PRs addressing #196 / #159. Independent of #289 and #208's per-project breakdown PR.
The bug
Cursor users in #159 reported costs showing only for Auto mode; sessions on specific models stayed at $0. The v0.9.4 alias fix landed
claude-4.6-sonnet,claude-4.5-sonnet-thinking, etc. but missed the plain no-suffix forms, the haiku tier, the forward-looking 4.7 variant, and Cursor's house modelcomposer-1. Any session on those models rendered $0.What was missing in
BUILTIN_ALIASESclaude-4.6-sonnetclaude-sonnet-4-6claude-4.5-sonnet(plain)claude-sonnet-4-5claude-4.5-sonnet-thinkingclaude-sonnet-4-5claude-4-sonnet-thinkingclaude-sonnet-4-5claude-4.7-opusclaude-opus-4-7claude-4.6-opusclaude-opus-4-6claude-4.5-opus(plain)claude-opus-4-5claude-4.5-opus-high-thinkingclaude-opus-4-5claude-4-opusclaude-opus-4-5claude-4.6-haikuclaude-haiku-4-5claude-4.5-haikuclaude-haiku-4-5composer-1claude-sonnet-4-5(Cursor'sCURSOR_COST_MODEL)Direct hits in LiteLLM snapshot (no alias needed):
gpt-5,gpt-5.2,grok-code-fast-1,gemini-3-pro(already aliased to the-previewentry).Tests
16 new regression tests under
describe('Cursor model variants resolve to pricing'). Each Cursor model variant — every entry insrc/providers/cursor.ts:modelDisplayNamesplus the new plain forms — asserts:So a future LiteLLM snapshot bump or a typo in the alias map will fail before users see $0.
Full suite: 45 files / 617 tests, all pass.
Out of scope