Fix duplicate session billing and align pricing with DeepSeek ×3.

Serialize billSessionUsage with row locks, expose rates on recharge, add compensation script and admin usage views.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
John
2026-06-16 03:10:05 -07:00
parent befeedfd37
commit 03690ee354
14 changed files with 472 additions and 52 deletions
+15
View File
@@ -141,6 +141,8 @@ export type BillingConfig = {
tiersCents: number[];
minRechargeCents: number;
balanceCents: number;
inputCentsPer1k: number;
outputCentsPer1k: number;
};
export type JsapiPayParams = {
@@ -619,6 +621,19 @@ export type UsageRecord = {
createdAt: number;
};
export type UsageTotals = {
requestCount: number;
inputTokens: number | null;
outputTokens: number | null;
totalTokens: number;
costCents: number;
};
export type UsageSummary = {
allTime: UsageTotals;
last24h: UsageTotals;
};
export type BalanceUpdate = {
balanceCents: number;
tokensUsed?: number;