Files
Cato 6d637c7f48 Make shared packages the default product foundation (#192)
* Make shared packages the default product foundation

* Support the fleet CI runner Node version
2026-10-24 14:59:48 +02:00

13 lines
560 B
TypeScript

import { slidingWindow, toHeaders, type LimitResult } from "limitkit";
/** App-only budgets; account limits and proxy/recipient keys belong to accountkit. */
export const limits = {
ai: slidingWindow({ limit: 20, windowMs: 60 * 60_000 }),
modelProbe: slidingWindow({ limit: 20, windowMs: 10 * 60_000 }),
};
export function tooMany(result: LimitResult): Response {
return Response.json(
{ error: "rate_limited", retryAfterSeconds: result.retryAfterSeconds },
{ status: 429, headers: { ...toHeaders(result), "Cache-Control": "no-store" } },
);
}