Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(usage): price Cursor cache savings by base model #13731

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 1 commit intomain fromfix/cursor-usage-cache-savingsmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 4 changed files with 41 additions and 3 deletions (loading 1).

x
0 of 4 viewed, 4 left
13 additions and 0 deletionsapps/server/src/usage/cursorUsageReader.tsModified
View file
@@ -17,6 +17,18 @@
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0;
​
+/**
+ * Maps Cursor's tiered names (`cursor-grok-4.6-high-fast`,
+ * `claude-fable-5-1-thinking-high`) to the base model's rate-table key.
+ * Grok resolves through xAI's first-party entry, which has no bare alias.
+ */
+export function cursorRateModel(model: string): string {
+ const base = model
+ .replace(/^cursor-/, "")
+ .replace(/(?:-thinking)?(?:-(?:none|minimal|low|medium|high|xhigh|max))?(?:-fast)?$/, "");
+ return base.startsWith("grok-") ? `xai/${base}` : base;
+}
+​
export interface CursorAccountUsageReadResult {
readonly accountKey: string | null;
readonly records: readonly UsageRecord[];
@@ -232,6 +244,7 @@
provider: "cursor",
timestampMs,
model: event.model,
+ rateModel: cursorRateModel(event.model),
sessionId,
totals,
reportedCostUsd,