Skip to content

fix(cursor): alias every Cursor model variant so non-Auto sessions price (#159)#290

Merged
iamtoruk merged 1 commit intomainfrom
fix/cursor-model-aliases
May 10, 2026
Merged

fix(cursor): alias every Cursor model variant so non-Auto sessions price (#159)#290
iamtoruk merged 1 commit intomainfrom
fix/cursor-model-aliases

Conversation

@iamtoruk
Copy link
Copy Markdown
Member

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 model composer-1. Any session on those models rendered $0.

What was missing in BUILTIN_ALIASES

Cursor name Was aliased? Now →
claude-4.6-sonnet yes (v0.9.4) claude-sonnet-4-6
claude-4.5-sonnet (plain) no claude-sonnet-4-5
claude-4.5-sonnet-thinking yes claude-sonnet-4-5
claude-4-sonnet-thinking yes claude-sonnet-4-5
claude-4.7-opus no claude-opus-4-7
claude-4.6-opus no claude-opus-4-6
claude-4.5-opus (plain) no claude-opus-4-5
claude-4.5-opus-high-thinking yes claude-opus-4-5
claude-4-opus yes claude-opus-4-5
claude-4.6-haiku no claude-haiku-4-5
claude-4.5-haiku no claude-haiku-4-5
composer-1 no claude-sonnet-4-5 (Cursor's CURSOR_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 -preview entry).

Tests

16 new regression tests under describe('Cursor model variants resolve to pricing'). Each Cursor model variant — every entry in src/providers/cursor.ts:modelDisplayNames plus the new plain forms — asserts:

expect(getModelCosts(input)).not.toBeNull()
expect(costs.inputCostPerToken).toBeGreaterThan(0)
expect(costs.outputCostPerToken).toBeGreaterThan(0)

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

@iamtoruk iamtoruk force-pushed the fix/cursor-model-aliases branch from c1d9e5d to f1d5571 Compare May 10, 2026 05:51
…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.
@iamtoruk iamtoruk force-pushed the fix/cursor-model-aliases branch from f1d5571 to c1f4b05 Compare May 10, 2026 10:21
@iamtoruk iamtoruk merged commit cdf7169 into main May 10, 2026
3 checks passed
@iamtoruk iamtoruk deleted the fix/cursor-model-aliases branch May 10, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant