Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

Bump app to v2.4.51 — don't leak cost-cap $ to users

Louis Beaumonta7795ba9d63f
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 0021ca892..18909ff7f 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -95,15 +95,10 @@ function buildDailyLimitMessage(errorStr: string): string {
}
if (isCostLimit) {
- // Surface the actual spent / cap figures when the gateway returns them
- // so the user sees "$39.50 of $35 today" and knows it's the account-wide
- // budget (often hit by background pipes), not a per-model limit.
- const spent = errorStr.match(/"spent_today_usd":\s*([\d.]+)/)?.[1];
- const cap = errorStr.match(/"cost_cap_usd":\s*([\d.]+)/)?.[1];
- if (spent && cap) {
- return `You've spent $${spent} of your $${cap} daily AI budget (resets at midnight UTC). This is an account-wide limit — background pipes consume it too. Try a free model (gemini-3-flash, haiku) or disable noisy pipes at Settings → Pipes.`;
- }
- return "You've hit your daily AI budget. Try a free model (gemini-3-flash, haiku) or wait until midnight UTC.";
+ // Don't leak the raw dollar cap — that's our internal margin. Frame it
+ // as an account-wide budget so the user understands why it fired even
+ // when they "didn't use much" (background pipes consume it too).
+ return "You've hit today's AI usage limit. This is an account-wide budget — background pipes count too. Switch to a free model (gemini-3-flash, haiku) or check Settings → Pipes for chatty schedules.";
}
const tierMatch = errorStr.match(/"tier":\s*"([^"]+)"/);
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 912cdd1c1..bdb47a225 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.4.50"
+version = "2.4.51"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/packages/ai-gateway/src/index.ts b/packages/ai-gateway/src/index.ts
index fc03a26ee..9cbb3c238 100644
--- a/packages/ai-gateway/src/index.ts
+++ b/packages/ai-gateway/src/index.ts
@@ -48,14 +48,13 @@ async function handleRequest(request: Request, env: Env, ctx: ExecutionContext):
// Usage status endpoint - returns current usage without incrementing
if (path === '/v1/usage' && request.method === 'GET') {
const status = await getUsageStatus(env, authResult.deviceId, authResult.tier, authResult.userId);
- // Enrich with cost-based limit info
+ // Enrich with cost-based limit flag (NOT the raw $ numbers — those
+ // are our internal margin and shouldn't leak to any client/user).
const dailyCost = await getDailyUserCost(env, authResult.deviceId);
const maxCost = getTierDailyCostCap(authResult.tier, env);
const enriched = {
...status,
cost_limit_reached: dailyCost >= maxCost,
- spent_today_usd: Number(dailyCost.toFixed(2)),
- cost_cap_usd: Number(maxCost.toFixed(2)),
};
return addCorsHeaders(createSuccessResponse(enriched));
}
@@ -110,9 +109,7 @@ async function handleRequest(request: Request, env: Env, ctx: ExecutionContext):
resetsAt.setUTCHours(24, 0, 0, 0);
return addCorsHeaders(createErrorResponse(429, JSON.stringify({
error: 'daily_cost_limit_exceeded',
- message: `You've used $${dailyCost.toFixed(2)} of your $${maxCost.toFixed(2)} daily AI budget (resets at midnight UTC). Switch to a free model (gemini-3-flash, qwen3.5-flash) or wait until tomorrow.`,
- spent_today_usd: Number(dailyCost.toFixed(2)),
- cost_cap_usd: Number(maxCost.toFixed(2)),
+ message: `You've hit today's AI usage limit. This is an account-wide budget that background pipes also consume. Switch to a free model (gemini-3-flash, qwen3.5-flash, claude-haiku-4-5) or review Settings → Pipes for chatty schedules.`,
resets_at: resetsAt.toISOString(),
tier: authResult.tier,
free_models: ['gemini-3-flash', 'qwen3.5-flash', 'claude-haiku-4-5'],
@@ -351,9 +348,7 @@ async function handleRequest(request: Request, env: Env, ctx: ExecutionContext):
resetsAt.setUTCHours(24, 0, 0, 0);
return addCorsHeaders(createErrorResponse(429, JSON.stringify({
error: 'daily_cost_limit_exceeded',
- message: `You've used $${dailyCost.toFixed(2)} of your $${maxCost.toFixed(2)} daily AI budget (resets at midnight UTC). Switch to a free model (gemini-3-flash, qwen3.5-flash) or wait until tomorrow.`,
- spent_today_usd: Number(dailyCost.toFixed(2)),
- cost_cap_usd: Number(maxCost.toFixed(2)),
+ message: `You've hit today's AI usage limit. This is an account-wide budget that background pipes also consume. Switch to a free model (gemini-3-flash, qwen3.5-flash, claude-haiku-4-5) or review Settings → Pipes for chatty schedules.`,
resets_at: resetsAt.toISOString(),
tier: authResult.tier,
free_models: ['gemini-3-flash', 'qwen3.5-flash', 'claude-haiku-4-5'],
@@ -456,9 +451,7 @@ async function handleRequest(request: Request, env: Env, ctx: ExecutionContext):
resetsAt.setUTCHours(24, 0, 0, 0);
return addCorsHeaders(createErrorResponse(429, JSON.stringify({
error: 'daily_cost_limit_exceeded',
- message: `You've used $${dailyCost.toFixed(2)} of your $${maxCost.toFixed(2)} daily AI budget (resets at midnight UTC). Switch to a free model (gemini-3-flash, qwen3.5-flash) or wait until tomorrow.`,
- spent_today_usd: Number(dailyCost.toFixed(2)),
- cost_cap_usd: Number(maxCost.toFixed(2)),
+ message: `You've hit today's AI usage limit. This is an account-wide budget that background pipes also consume. Switch to a free model (gemini-3-flash, qwen3.5-flash, claude-haiku-4-5) or review Settings → Pipes for chatty schedules.`,
resets_at: resetsAt.toISOString(),
tier: authResult.tier,
free_models: ['gemini-3-flash', 'qwen3.5-flash', 'claude-haiku-4-5'],