Skip to content
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5713,5 +5713,7 @@
"99451a5d2d40440f": "Zurückgezogen von {by}.",
"3ee30a50b70fffab": "Zurückgezogen von {by}: {reason}",
"201490988858b511": "zurückgezogen von {by}",
"46d614fa7b4bf1e5": "Workflow-Ausführungen"
"46d614fa7b4bf1e5": "Workflow-Ausführungen",
"c7566c908e14be09": "Ausgaben",
"ae693772acb75c75": "Ausgaben in diesem Abrechnungszeitraum im Verhältnis zu deinem {provider}-Ausgabenlimit."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5715,5 +5715,7 @@
"99451a5d2d40440f": "Withdrawn by {by}.",
"3ee30a50b70fffab": "Withdrawn by {by}: {reason}",
"201490988858b511": "withdrawn by {by}",
"46d614fa7b4bf1e5": "Workflow runs"
"46d614fa7b4bf1e5": "Workflow runs",
"c7566c908e14be09": "Spend",
"ae693772acb75c75": "Spending this billing cycle against your {provider} spend limit."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5707,5 +5707,7 @@
"99451a5d2d40440f": "Retirada por {by}.",
"3ee30a50b70fffab": "Retirada por {by}: {reason}",
"201490988858b511": "retirada por {by}",
"46d614fa7b4bf1e5": "Ejecuciones de flujos de trabajo"
"46d614fa7b4bf1e5": "Ejecuciones de flujos de trabajo",
"c7566c908e14be09": "Gasto",
"ae693772acb75c75": "Gasto de este ciclo de facturación respecto a tu límite de gasto de {provider}."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5707,5 +5707,7 @@
"99451a5d2d40440f": "Retirée par {by}.",
"3ee30a50b70fffab": "Retirée par {by} : {reason}",
"201490988858b511": "retirée par {by}",
"46d614fa7b4bf1e5": "Exécutions de workflow"
"46d614fa7b4bf1e5": "Exécutions de workflow",
"c7566c908e14be09": "Dépenses",
"ae693772acb75c75": "Dépenses de ce cycle de facturation par rapport à votre limite de dépenses {provider}."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -5684,5 +5684,7 @@
"99451a5d2d40440f": "{by} が取り下げました。",
"3ee30a50b70fffab": "{by} が取り下げました: {reason}",
"201490988858b511": "{by} が取り下げ",
"46d614fa7b4bf1e5": "ワークフローの実行"
"46d614fa7b4bf1e5": "ワークフローの実行",
"c7566c908e14be09": "支出",
"ae693772acb75c75": "この請求期間の支出と{provider}の支出上限。"
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -5691,5 +5691,7 @@
"99451a5d2d40440f": "{by}에서 철회했습니다.",
"3ee30a50b70fffab": "{by}에서 철회했습니다: {reason}",
"201490988858b511": "{by}에서 철회함",
"46d614fa7b4bf1e5": "워크플로 실행"
"46d614fa7b4bf1e5": "워크플로 실행",
"c7566c908e14be09": "지출",
"ae693772acb75c75": "이번 청구 주기의 지출과 {provider} 지출 한도."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -5707,5 +5707,7 @@
"99451a5d2d40440f": "Retirada por {by}.",
"3ee30a50b70fffab": "Retirada por {by}: {reason}",
"201490988858b511": "retirada por {by}",
"46d614fa7b4bf1e5": "Execuções de workflow"
"46d614fa7b4bf1e5": "Execuções de workflow",
"c7566c908e14be09": "Gastos",
"ae693772acb75c75": "Gastos neste ciclo de cobrança em relação ao seu limite de gastos do {provider}."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5787,5 +5787,7 @@
"99451a5d2d40440f": "Отозван: {by}.",
"3ee30a50b70fffab": "Отозван ({by}): {reason}",
"201490988858b511": "отозван: {by}",
"46d614fa7b4bf1e5": "Запуски воркфлоу"
"46d614fa7b4bf1e5": "Запуски воркфлоу",
"c7566c908e14be09": "Расходы",
"ae693772acb75c75": "Расходы за текущий расчётный период относительно лимита расходов {provider}."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -5713,5 +5713,7 @@
"99451a5d2d40440f": "Återkallad av {by}.",
"3ee30a50b70fffab": "Återkallad av {by}: {reason}",
"201490988858b511": "återkallad av {by}",
"46d614fa7b4bf1e5": "Arbetsflödeskörningar"
"46d614fa7b4bf1e5": "Arbetsflödeskörningar",
"c7566c908e14be09": "Utgifter",
"ae693772acb75c75": "Utgifter under denna faktureringsperiod i förhållande till din utgiftsgräns i {provider}."
}
4 changes: 3 additions & 1 deletion apps/mobile/src/i18n/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -5694,5 +5694,7 @@
"99451a5d2d40440f": "已由 {by} 撤回。",
"3ee30a50b70fffab": "已由 {by} 撤回:{reason}",
"201490988858b511": "已由 {by} 撤回",
"46d614fa7b4bf1e5": "工作流运行"
"46d614fa7b4bf1e5": "工作流运行",
"c7566c908e14be09": "支出",
"ae693772acb75c75": "本计费周期的支出与 {provider} 支出限额。"
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -13023,5 +13023,7 @@
"v": "v"
},
" weitere unter Verknüpfte Elemente"
]
],
"c7566c908e14be09": "Ausgaben",
"ae693772acb75c75": "Ausgaben in diesem Abrechnungszeitraum im Verhältnis zu deinem {provider}-Ausgabenlimit."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13031,5 +13031,7 @@
"v": "v"
},
" more in Linked items"
]
],
"c7566c908e14be09": "Spend",
"ae693772acb75c75": "Spending this billing cycle against your {provider} spend limit."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -13018,5 +13018,7 @@
"v": "v"
},
" más en Elementos vinculados"
]
],
"c7566c908e14be09": "Gasto",
"ae693772acb75c75": "Gasto de este ciclo de facturación respecto a tu límite de gasto de {provider}."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -13023,5 +13023,7 @@
"v": "v"
},
" de plus dans Éléments associés"
]
],
"c7566c908e14be09": "Dépenses",
"ae693772acb75c75": "Dépenses de ce cycle de facturation par rapport à votre limite de dépenses {provider}."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -12959,5 +12959,7 @@
"v": "v"
},
" 件をリンクされた項目で表示"
]
],
"c7566c908e14be09": "支出",
"ae693772acb75c75": "この請求期間の支出と{provider}の支出上限。"
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -12956,5 +12956,7 @@
"v": "v"
},
"개 더 보기"
]
],
"c7566c908e14be09": "지출",
"ae693772acb75c75": "이번 청구 주기의 지출과 {provider} 지출 한도."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -13023,5 +13023,7 @@
"v": "v"
},
" mais em Itens vinculados"
]
],
"c7566c908e14be09": "Gastos",
"ae693772acb75c75": "Gastos neste ciclo de cobrança em relação ao seu limite de gastos do {provider}."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -13022,5 +13022,7 @@
"v": "v"
},
" в разделе «Привязанные элементы»"
]
],
"c7566c908e14be09": "Расходы",
"ae693772acb75c75": "Расходы за текущий расчётный период относительно лимита расходов {provider}."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -13030,5 +13030,7 @@
"v": "v"
},
" till i Länkade objekt"
]
],
"c7566c908e14be09": "Utgifter",
"ae693772acb75c75": "Utgifter under denna faktureringsperiod i förhållande till din utgiftsgräns i {provider}."
}
4 changes: 3 additions & 1 deletion apps/web/src/i18n/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -13037,5 +13037,7 @@
"v": "v"
},
" 项"
]
],
"c7566c908e14be09": "支出",
"ae693772acb75c75": "本计费周期的支出与 {provider} 支出限额。"
}
2 changes: 1 addition & 1 deletion docs/user/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Usage aggregates history across Codex, Claude Code, Grok Build, OpenCode, Antigr
- **Reset credits**: Click an account segment/row to inspect plan details and redeem banked Codex/Claude reset credits via **Use reset** (Claude resets unavailable on macOS Keychain logins).
- **Provider notes**:
- **OpenCode**: OpenCode 2 servers with usage reporting show Go allowances and Console budgets for the connected workspace. Local servers can also report Go usage from a Go API key (`OPENCODE_API_KEY`).
- **Cursor**: Reports monthly Auto + API quotas via `CURSOR_AUTH_TOKEN` or default-endpoint sign-in/`CURSOR_API_KEY`.
- **Cursor**: Reports monthly Auto + API quotas via `CURSOR_AUTH_TOKEN` or default-endpoint sign-in/`CURSOR_API_KEY`. Enterprise accounts can show a Spend bar against the reported spend limit; accounts without reported limits link to the Cursor usage dashboard.
- **Grok**: Reports billing-period quotas for `grok login` (not `XAI_API_KEY`).
- **Muse Code**: Reports session/weekly limits after running in a thread (not persisted across restarts).
- Pure API-key accounts generally do not report subscription limits.
Expand Down
147 changes: 143 additions & 4 deletions packages/provider-cursor/src/server/usageLimits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { cursorUsageResponseToLimits, readCursorUsageLimits } from "./usageLimit
describe("Cursor usage limits", () => {
const checkedAt = "2026-09-16T00:00:00.000Z";

it("uses the advertised percentages and billing-cycle reset", () => {
it("uses the advertised percentages and reset, or Spend when no allowance is included", () => {
const limits = cursorUsageResponseToLimits(
{
billingCycleEnd: "1789876386000",
Expand Down Expand Up @@ -40,6 +40,68 @@ describe("Cursor usage limits", () => {
},
]),
);
const withSpendLimit = cursorUsageResponseToLimits(
{
billingCycleEnd: "1789876386000",
planUsage: { totalPercentUsed: 72.4, autoPercentUsed: 69.5, apiPercentUsed: 100 },
spendLimitUsage: { individualLimit: 5000, individualUsed: 100 },
},
checkedAt,
);
expect(withSpendLimit.windows).toEqual(limits.windows);
const zeroPercents = { totalPercentUsed: 0, autoPercentUsed: 0, apiPercentUsed: 0 };
const zeroPlanWindows = [
{ id: "apiPercentUsed", kind: "monthly", label: "Other Models", usedPercent: 0 },
{ id: "autoPercentUsed", kind: "monthly", label: "Cursor Models", usedPercent: 0 },
{ id: "totalPercentUsed", kind: "monthly", label: "Overall", usedPercent: 0 },
];
const windowIds = (response: Parameters<typeof cursorUsageResponseToLimits>[0]) =>
cursorUsageResponseToLimits(response, checkedAt).windows.map((window) => window.id);
// Usage already counted against a pooled plan keeps the plan bars.
expect(
windowIds({
planUsage: { totalPercentUsed: 6, autoPercentUsed: 6, apiPercentUsed: 0 },
spendLimitUsage: { pooledLimit: "3000000", overallLimit: 50000, overallUsed: 3211 },
}),
).toEqual(["apiPercentUsed", "autoPercentUsed", "totalPercentUsed"]);
// Fresh-cycle Pro: an included allowance, or no pool marker, keeps the plan bars.
for (const response of [
{
planUsage: { ...zeroPercents, limit: "2000" },
spendLimitUsage: { individualLimit: 5000, individualUsed: 0, pooledLimit: "3000000" },
},
{ planUsage: zeroPercents, spendLimitUsage: { individualLimit: 5000 } },
]) {
expect(cursorUsageResponseToLimits(response, checkedAt).windows).toEqual(zeroPlanWindows);
}
expect(
windowIds({
planUsage: { ...zeroPercents, limit: "0" },
spendLimitUsage: { pooledLimit: "3000000", overallLimit: 50000, overallUsed: 3211 },
}),
).toEqual(["spendLimit"]);
// Without includePooledUsage, Cursor reports start = end = now instead of the cycle.
expect(
cursorUsageResponseToLimits(
{
billingCycleStart: "1793491200000",
billingCycleEnd: "1793491200000",
spendLimitUsage: { individualLimit: "2000", individualUsed: "500" },
},
checkedAt,
).windows,
).toEqual([{ id: "spendLimit", kind: "monthly", label: "Spend", usedPercent: 25 }]);
// Limit and used come from the same pair; protobuf JSON omits a zero used.
for (const [spendLimitUsage, usedPercent] of [
[{ overallLimit: 50000, individualUsed: 3211 }, 0],
[{ overallLimit: 0, individualLimit: "2000", individualUsed: "500" }, 25],
] as const) {
expect(
cursorUsageResponseToLimits({ spendLimitUsage }, checkedAt).windows.map(
(window) => window.usedPercent,
),
).toEqual([usedPercent]);
}
});

it("reports the billing-cycle length so pace can be computed", () => {
Expand All @@ -54,7 +116,7 @@ describe("Cursor usage limits", () => {
});

it("omits the cycle length when the start is missing or invalid", () => {
for (const billingCycleStart of [undefined, "", "0", "not-a-number", "1796637847072"]) {
for (const billingCycleStart of [undefined, "", "0", "not-a-number"]) {
expect(
cursorUsageResponseToLimits(
{
Expand Down Expand Up @@ -91,9 +153,33 @@ describe("Cursor usage limits", () => {
});

it("does not invent unused allowance for absent buckets", () => {
expect(cursorUsageResponseToLimits({ planUsage: {} }, checkedAt).unavailable?.reason).toBe(
"unsupported",
const linkOnly = {
checkedAt,
windows: [],
unavailable: {
reason: "unsupported",
message:
"Cursor doesn't report a personal spend limit for this account. Open Cursor's dashboard with the same account to see its usage.",
},
externalUsage: { label: "Cursor usage", url: "https://cursor.com/dashboard?tab=usage" },
};
expect(cursorUsageResponseToLimits({ planUsage: {} }, checkedAt)).toEqual(linkOnly);
// Real Enterprise (token-based contract) response: no planUsage at all.
expect(cursorUsageResponseToLimits({ billingCycleEnd: "1793495876373" }, checkedAt)).toEqual(
linkOnly,
);
// Enterprise seat with only the team pool: zeroed percentages and no personal limit.
expect(
cursorUsageResponseToLimits(
{
billingCycleStart: "1793491200000",
billingCycleEnd: "1796083200000",
planUsage: { totalPercentUsed: 0, autoPercentUsed: 0, apiPercentUsed: 0 },
spendLimitUsage: { pooledLimit: "3000000" },
},
checkedAt,
),
).toEqual(linkOnly);
expect(
cursorUsageResponseToLimits({ planUsage: { totalPercentUsed: 0 } }, checkedAt).windows,
).toEqual([{ id: "totalPercentUsed", kind: "monthly", label: "Overall", usedPercent: 0 }]);
Expand All @@ -102,6 +188,59 @@ describe("Cursor usage limits", () => {
).toEqual([{ id: "totalPercentUsed", kind: "monthly", label: "Overall", usedPercent: 100 }]);
});

it.effect(
"requests pooled usage and shows Enterprise spend against the personal spend limit",
() =>
Effect.gen(function* () {
const limits = yield* readCursorUsageLimits(
{ apiEndpoint: "" },
{ CURSOR_AUTH_TOKEN: "token" },
).pipe(
Effect.provideService(
HttpClient.HttpClient,
HttpClient.make((request) => {
expect(
request.body._tag === "Uint8Array" && new TextDecoder().decode(request.body.body),
).toBe('{"includePooledUsage":true}');
return Effect.succeed(
HttpClientResponse.fromWeb(
request,
Response.json({
billingCycleStart: "1793491200000",
billingCycleEnd: "1796083200000",
displayThreshold: 50,
planUsage: { totalPercentUsed: 0, autoPercentUsed: 0, apiPercentUsed: 0 },
spendLimitUsage: {
limitType: "team",
overallLimit: 50000,
overallUsed: 3211,
overallRemaining: 46789,
pooledLimit: "3000000",
pooledUsed: 0,
pooledRemaining: "3000000",
},
displayMessage: "You've used 6% of your included usage",
}),
),
);
}),
),
);
expect(limits).toEqual({
checkedAt: expect.any(String),
windows: [
{
id: "spendLimit",
kind: "monthly",
label: "Spend",
usedPercent: 6.422,
resetsAt: "2026-12-01T00:00:00.000Z",
},
],
});
}),
);

it.effect("requires explicit credentials and accepts an auth token", () =>
Effect.gen(function* () {
for (const token of [undefined, "explicit-token"]) {
Expand Down
Loading
Loading