Usage: add cost summaries to /usage + mac menu

This commit is contained in:
Peter Steinberger
2026-01-19 00:04:58 +00:00
parent 1ea3ac0a1d
commit 3ce1ee84ac
14 changed files with 706 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
import { loadConfig } from "../../config/config.js";
import { loadCostUsageSummary } from "../../infra/session-cost-usage.js";
import { loadProviderUsageSummary } from "../../infra/provider-usage.js";
import type { GatewayRequestHandlers } from "./types.js";
@@ -6,4 +8,9 @@ export const usageHandlers: GatewayRequestHandlers = {
const summary = await loadProviderUsageSummary();
respond(true, summary, undefined);
},
"usage.cost": async ({ respond }) => {
const config = loadConfig();
const summary = await loadCostUsageSummary({ days: 30, config });
respond(true, summary, undefined);
},
};