Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer und Auto nutzen dieses Kontingent.",
"d2becdc27390c92c": "Andere Modelle",
"3abbefc7732635ff": "Nutzungskontingent für Modelle von Drittanbietern wie Claude, GPT und Gemini.",
"c7566c908e14be09": "Ausgaben",
"ae693772acb75c75": "Ausgaben in diesem Abrechnungszeitraum im Verhältnis zu deinem {provider}-Ausgabenlimit.",
"7d72af75b2812d60": "{provider} auf {environment}",
"bb34eaf6ddc55a72": "Dieses Konto hat keine Abonnementlimits.",
"42a2622893a6bced": "Limits konnten nicht gelesen werden.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer, and Auto use this allowance.",
"d2becdc27390c92c": "Other Models",
"3abbefc7732635ff": "Usage allowance for third-party models such as Claude, GPT, and Gemini.",
"c7566c908e14be09": "Spend",
"ae693772acb75c75": "Spending this billing cycle against your {provider} spend limit.",
"7d72af75b2812d60": "{provider} on {environment}",
"bb34eaf6ddc55a72": "This account has no subscription limits.",
"42a2622893a6bced": "Could not read limits.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer y Auto usan esta asignación.",
"d2becdc27390c92c": "Otros modelos",
"3abbefc7732635ff": "Asignación de uso para modelos de terceros como Claude, GPT y Gemini.",
"c7566c908e14be09": "Gasto",
"ae693772acb75c75": "Gasto en este ciclo de facturación frente a tu límite de gasto de {provider}.",
"7d72af75b2812d60": "{provider} en {environment}",
"bb34eaf6ddc55a72": "Esta cuenta no tiene límites de suscripción.",
"42a2622893a6bced": "No se pudieron leer los límites.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer et Auto utilisent ce quota.",
"d2becdc27390c92c": "Autres modèles",
"3abbefc7732635ff": "Quota d’utilisation des modèles tiers comme Claude, GPT et Gemini.",
"c7566c908e14be09": "Dépenses",
"ae693772acb75c75": "Dépenses de ce cycle de facturation par rapport à votre limite de dépenses {provider}.",
"7d72af75b2812d60": "{provider} sur {environment}",
"bb34eaf6ddc55a72": "Ce compte n’a pas de limites d’abonnement.",
"42a2622893a6bced": "Impossible de lire les limites.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok、Composer、Auto はこの使用枠を使います。",
"d2becdc27390c92c": "その他のモデル",
"3abbefc7732635ff": "Claude、GPT、Gemini などのサードパーティモデル用の使用枠です。",
"c7566c908e14be09": "支出",
"ae693772acb75c75": "今回の請求期間の支出と {provider} の支出上限の比較です。",
"7d72af75b2812d60": "{environment} の {provider}",
"bb34eaf6ddc55a72": "このアカウントにはサブスクリプションの上限がありません。",
"42a2622893a6bced": "上限を読み取れませんでした。",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer, Auto가 이 사용량을 사용합니다.",
"d2becdc27390c92c": "기타 모델",
"3abbefc7732635ff": "Claude, GPT, Gemini 등 타사 모델의 사용 한도입니다.",
"c7566c908e14be09": "지출",
"ae693772acb75c75": "이번 결제 주기의 지출을 {provider} 지출 한도와 비교합니다.",
"7d72af75b2812d60": "{environment}의 {provider}",
"bb34eaf6ddc55a72": "이 계정에는 구독 한도가 없습니다.",
"42a2622893a6bced": "한도를 읽을 수 없습니다.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer e Auto usam esta cota.",
"d2becdc27390c92c": "Outros modelos",
"3abbefc7732635ff": "Cota de uso para modelos de terceiros, como Claude, GPT e Gemini.",
"c7566c908e14be09": "Gastos",
"ae693772acb75c75": "Gastos neste ciclo de cobrança em relação ao seu limite de gastos do {provider}.",
"7d72af75b2812d60": "{provider} em {environment}",
"bb34eaf6ddc55a72": "Esta conta não tem limites de assinatura.",
"42a2622893a6bced": "Não foi possível ler os limites.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer и Auto расходуют этот лимит.",
"d2becdc27390c92c": "Другие модели",
"3abbefc7732635ff": "Лимит использования сторонних моделей, таких как Claude, GPT и Gemini.",
"c7566c908e14be09": "Расходы",
"ae693772acb75c75": "Расходы за этот расчётный период относительно вашего лимита расходов в {provider}.",
"7d72af75b2812d60": "{provider} на {environment}",
"bb34eaf6ddc55a72": "У этого аккаунта нет лимитов подписки.",
"42a2622893a6bced": "Не удалось прочитать лимиты.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer och Auto använder den här kvoten.",
"d2becdc27390c92c": "Andra modeller",
"3abbefc7732635ff": "Användningskvot för tredjepartsmodeller som Claude, GPT och Gemini.",
"c7566c908e14be09": "Utgifter",
"ae693772acb75c75": "Utgifter under den här faktureringsperioden mot din utgiftsgräns i {provider}.",
"7d72af75b2812d60": "{provider} på {environment}",
"bb34eaf6ddc55a72": "Det här kontot har inga prenumerationsgränser.",
"42a2622893a6bced": "Kunde inte läsa gränser.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok、Composer 和 Auto 使用此额度。",
"d2becdc27390c92c": "其他模型",
"3abbefc7732635ff": "Claude、GPT 和 Gemini 等第三方模型的用量额度。",
"c7566c908e14be09": "支出",
"ae693772acb75c75": "本计费周期内的支出与你的 {provider} 支出上限对比。",
"7d72af75b2812d60": "{environment} 上的 {provider}",
"bb34eaf6ddc55a72": "此账户没有订阅限制。",
"42a2622893a6bced": "无法读取限额。",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer und Auto nutzen dieses Kontingent.",
"d2becdc27390c92c": "Andere Modelle",
"3abbefc7732635ff": "Nutzungskontingent für Modelle von Drittanbietern wie Claude, GPT und Gemini.",
"c7566c908e14be09": "Ausgaben",
"ae693772acb75c75": "Ausgaben in diesem Abrechnungszeitraum im Verhältnis zu deinem {provider}-Ausgabenlimit.",
"7d72af75b2812d60": "{provider} auf {environment}",
"bb34eaf6ddc55a72": "Dieses Konto hat keine Abonnementlimits.",
"42a2622893a6bced": "Limits konnten nicht gelesen werden.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer, and Auto use this allowance.",
"d2becdc27390c92c": "Other Models",
"3abbefc7732635ff": "Usage allowance for third-party models such as Claude, GPT, and Gemini.",
"c7566c908e14be09": "Spend",
"ae693772acb75c75": "Spending this billing cycle against your {provider} spend limit.",
"7d72af75b2812d60": "{provider} on {environment}",
"bb34eaf6ddc55a72": "This account has no subscription limits.",
"42a2622893a6bced": "Could not read limits.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer y Auto usan esta asignación.",
"d2becdc27390c92c": "Otros modelos",
"3abbefc7732635ff": "Asignación de uso para modelos de terceros como Claude, GPT y Gemini.",
"c7566c908e14be09": "Gasto",
"ae693772acb75c75": "Gasto en este ciclo de facturación frente a tu límite de gasto de {provider}.",
"7d72af75b2812d60": "{provider} en {environment}",
"bb34eaf6ddc55a72": "Esta cuenta no tiene límites de suscripción.",
"42a2622893a6bced": "No se pudieron leer los límites.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer et Auto utilisent ce quota.",
"d2becdc27390c92c": "Autres modèles",
"3abbefc7732635ff": "Quota d’utilisation des modèles tiers comme Claude, GPT et Gemini.",
"c7566c908e14be09": "Dépenses",
"ae693772acb75c75": "Dépenses de ce cycle de facturation par rapport à votre limite de dépenses {provider}.",
"7d72af75b2812d60": "{provider} sur {environment}",
"bb34eaf6ddc55a72": "Ce compte n’a pas de limites d’abonnement.",
"42a2622893a6bced": "Impossible de lire les limites.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok、Composer、Auto はこの使用枠を使います。",
"d2becdc27390c92c": "その他のモデル",
"3abbefc7732635ff": "Claude、GPT、Gemini などのサードパーティモデル用の使用枠です。",
"c7566c908e14be09": "支出",
"ae693772acb75c75": "今回の請求期間の支出と {provider} の支出上限の比較です。",
"7d72af75b2812d60": "{environment} の {provider}",
"bb34eaf6ddc55a72": "このアカウントにはサブスクリプションの上限がありません。",
"42a2622893a6bced": "上限を読み取れませんでした。",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer, Auto가 이 사용량을 사용합니다.",
"d2becdc27390c92c": "기타 모델",
"3abbefc7732635ff": "Claude, GPT, Gemini 등 타사 모델의 사용 한도입니다.",
"c7566c908e14be09": "지출",
"ae693772acb75c75": "이번 결제 주기의 지출을 {provider} 지출 한도와 비교합니다.",
"7d72af75b2812d60": "{environment}의 {provider}",
"bb34eaf6ddc55a72": "이 계정에는 구독 한도가 없습니다.",
"42a2622893a6bced": "한도를 읽을 수 없습니다.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer e Auto usam esta cota.",
"d2becdc27390c92c": "Outros modelos",
"3abbefc7732635ff": "Cota de uso para modelos de terceiros, como Claude, GPT e Gemini.",
"c7566c908e14be09": "Gastos",
"ae693772acb75c75": "Gastos neste ciclo de cobrança em relação ao seu limite de gastos do {provider}.",
"7d72af75b2812d60": "{provider} em {environment}",
"bb34eaf6ddc55a72": "Esta conta não tem limites de assinatura.",
"42a2622893a6bced": "Não foi possível ler os limites.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer и Auto расходуют этот лимит.",
"d2becdc27390c92c": "Другие модели",
"3abbefc7732635ff": "Лимит использования сторонних моделей, таких как Claude, GPT и Gemini.",
"c7566c908e14be09": "Расходы",
"ae693772acb75c75": "Расходы за этот расчётный период относительно вашего лимита расходов в {provider}.",
"7d72af75b2812d60": "{provider} на {environment}",
"bb34eaf6ddc55a72": "У этого аккаунта нет лимитов подписки.",
"42a2622893a6bced": "Не удалось прочитать лимиты.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok, Composer och Auto använder den här kvoten.",
"d2becdc27390c92c": "Andra modeller",
"3abbefc7732635ff": "Användningskvot för tredjepartsmodeller som Claude, GPT och Gemini.",
"c7566c908e14be09": "Utgifter",
"ae693772acb75c75": "Utgifter under den här faktureringsperioden mot din utgiftsgräns i {provider}.",
"7d72af75b2812d60": "{provider} på {environment}",
"bb34eaf6ddc55a72": "Det här kontot har inga prenumerationsgränser.",
"42a2622893a6bced": "Kunde inte läsa gränser.",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/i18n/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,8 @@
"23eed587f1bef1a6": "Grok、Composer 和 Auto 使用此额度。",
"d2becdc27390c92c": "其他模型",
"3abbefc7732635ff": "Claude、GPT 和 Gemini 等第三方模型的用量额度。",
"c7566c908e14be09": "支出",
"ae693772acb75c75": "本计费周期内的支出与你的 {provider} 支出上限对比。",
"7d72af75b2812d60": "{environment} 上的 {provider}",
"bb34eaf6ddc55a72": "此账户没有订阅限制。",
"42a2622893a6bced": "无法读取限额。",
Expand Down
4 changes: 3 additions & 1 deletion docs/user/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ refresh provider status. Cursor reports
its monthly allowance, including separate Auto and API usage, for `CURSOR_AUTH_TOKEN` when it is set,
otherwise for the account you signed in with in T3 or set as `CURSOR_API_KEY`.
Sign-in and API keys report limits only with Cursor's default API endpoint. If you configure a custom
Cursor endpoint, use an explicit `CURSOR_AUTH_TOKEN` for limits.
Cursor endpoint, use an explicit `CURSOR_AUTH_TOKEN` for limits. Accounts without a monthly
allowance, such as Enterprise, show a **Spend** bar for this billing cycle against your personal
spend limit. If Cursor reports no personal limit, Usage links to Cursor's usage dashboard instead.

Grok reports the remaining subscription allowance and reset time for its current billing period
after signing in with `grok login`. Explicit `XAI_API_KEY` connections and custom authentication
Expand Down
116 changes: 112 additions & 4 deletions packages/provider-cursor/src/server/usageLimits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,41 @@ describe("Cursor usage limits", () => {
);
});

it("shows Spend against the personal limit only when no allowance is included", () => {
const zeroPercents = { totalPercentUsed: 0, autoPercentUsed: 0, apiPercentUsed: 0 };
const windowIds = (response: Parameters<typeof cursorUsageResponseToLimits>[0]) =>
cursorUsageResponseToLimits(response, checkedAt).windows.map((window) => window.id);
const planIds = ["apiPercentUsed", "autoPercentUsed", "totalPercentUsed"];
const pool = { pooledLimit: "3000000", overallLimit: 50000, overallUsed: 3211 };
// Usage already counted against the plan, an included allowance, or no team pool keep the plan bars.
expect(
windowIds({ planUsage: { ...zeroPercents, autoPercentUsed: 6 }, spendLimitUsage: pool }),
).toEqual(planIds);
expect(
windowIds({ planUsage: { ...zeroPercents, limit: "2000" }, spendLimitUsage: pool }),
).toEqual(planIds);
expect(
windowIds({ planUsage: zeroPercents, spendLimitUsage: { individualLimit: 5000 } }),
).toEqual(planIds);
// A start equal to the end is not a billing cycle; a missing used means zero.
expect(
cursorUsageResponseToLimits(
{
billingCycleStart: "1793491200000",
billingCycleEnd: "1793491200000",
spendLimitUsage: { overallLimit: 0, individualLimit: "2000", individualUsed: "500" },
},
checkedAt,
).windows,
).toEqual([{ id: "spendLimit", kind: "monthly", label: "Spend", usedPercent: 25 }]);
expect(
cursorUsageResponseToLimits(
{ spendLimitUsage: { overallLimit: 50000, individualUsed: 3211 } },
checkedAt,
).windows[0]?.usedPercent,
).toBe(0);
});

it("reports the billing-cycle length so pace can be computed", () => {
const planUsage = { totalPercentUsed: 40, autoPercentUsed: 30, apiPercentUsed: 20 };
const durations = (billingCycleStart: string | number | undefined, billingCycleEnd: string) =>
Expand All @@ -54,7 +89,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 +126,27 @@ 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);
// Enterprise seat with only the team pool and no personal limit.
expect(
cursorUsageResponseToLimits(
{
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 +155,61 @@ 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,
// Captured from a live Enterprise account (token-based contract), 2026-11-23:
// the team pool arrives as int64 strings, the personal pair as numbers.
Response.json({
billingCycleStart: "1793491200000",
billingCycleEnd: "1796083200000",
planUsage: { totalPercentUsed: 0, autoPercentUsed: 0, apiPercentUsed: 0 },
spendLimitUsage: {
totalSpend: 679881371,
pooledLimit: "1009395000",
pooledUsed: 679881371,
pooledRemaining: "329513629",
limitType: "team",
overallLimit: 100000,
overallUsed: 68757,
overallRemaining: 31243,
},
}),
),
);
}),
),
);
expect(limits).toEqual({
checkedAt: expect.any(String),
windows: [
{
id: "spendLimit",
kind: "monthly",
label: "Spend",
usedPercent: 68.757,
resetsAt: "2026-12-01T00:00:00.000Z",
windowDurationMins: 43_200,
},
],
});
}),
);

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