Let Lancelot act
Emergency stop and budgets
Stop a runaway customer inside your app, with no network call and no waiting for a human.
Both run in the SDK and need enableFlags. Counts are kept in memory, in each process, and checked before each wrapped call.
Emergency stop
A customer who suddenly makes too many calls, or spends too fast, is stopped for a cooldown:
| Limit | Default |
|---|---|
| Calls a minute, per customer | 600 |
| Spend in 5 minutes, per customer | $50 |
| Cooldown | 5 minutes |
Stopped calls raise LancelotBlockedError with reason "runaway". The SDK tells Lancelot at once, so you're notified within a minute, and Lancelot proposes a lasting fix.
Change the limits on the Protection page. To override them in one process, or turn the stop off:
const lc = lancelot({ enableFlags: true, breaker: { maxCallsPerMinute: 2000 } });
const quiet = lancelot({ enableFlags: true, breaker: false });lc = lancelot(enable_flags=True, breaker={"max_calls_per_minute": 2000})
quiet = lancelot(enable_flags=True, breaker=False)Budgets
Give every free-plan customer a daily AI budget on the Protection page (Free plan, $ a day). A single customer gets a daily cap through the Cap spend fix. A customer who reaches their budget is held, with reason "budget", until the period resets.
Many servers
Each process keeps its own counts, so with many instances the limits are approximate. Lancelot's own detectors work across all your usage and catch what one instance can't see.
Handling a blocked call
import { LancelotBlockedError } from "@lancelotwatch/node";
try {
return await openai.chat.completions.create({ model: "gpt-5", messages });
} catch (e) {
if (e instanceof LancelotBlockedError) {
// e.reason: "throttled" | "paused" | "runaway" | "budget"
return "You've reached your limit for now. Try again shortly.";
}
throw e;
}from lancelotwatch import LancelotBlockedError
try:
return openai.chat.completions.create(model="gpt-5", messages=messages)
except LancelotBlockedError as e:
# e.reason: "throttled" | "paused" | "runaway" | "budget"
return "You've reached your limit for now. Try again shortly."If Lancelot is unreachable, nothing is blocked.