Live demoProblemHow it worksOpen sourcePricingFAQCompareBlogGitHub

LLMBRAKE

Per-customer cost caps for AI apps.

Monthly dollar budgets per customer. Cheaper model near the cap, hard block at the cap. Per-customer margin view.

Try the live demo · runs in your browser, simulated →
MIT on GitHub·TypeScript·OpenAI-compatible·No prompts stored
Floating cards: illustrative UI, not real data
01 / The problemProject-level limits only

Your provider caps the project. Nobody caps the customer.

Provider budgets apply per organization or project. The invoice is one number, not per customer.

A · Surprise bills

One loop, one night

One scripted user can run up a large bill overnight, visible only on the invoice.

B · Hidden losses

Unprofitable accounts

Heavy customers can cost more in tokens than they pay. Without per-customer cost data it stays invisible.

C · Rebuilt plumbing

Everyone rebuilds it

Token logging, price tables, streaming usage, counters, upgrade prompts.

02 / How it worksVisuals: illustrative, not real data

A small wrapper. Not a proxy.

Wraps your existing client. Direct provider calls with your own keys. Prompts stay on your servers.

Wrap once01
import { createGuard, isBudgetExceededError } from "llmbrake";

const guard = createGuard({
  budgetUsd: (ctx) => (ctx.plan === "pro" ? 20 : 2),
  downgradeAt: 0.8,
  downgradeMap: { "gpt-5.5": "gpt-5.4-mini" },
});

const chat = openai.chat.completions;
const create = guard.wrap(chat.create.bind(chat));

const res = await create(
  { model: "gpt-5.5", messages: [{ role: "user", content: "Hello" }] },
  { customerId: user.id, plan: user.plan, feature: "chat" },
);
// at the cap → throws BudgetExceededError (isBudgetExceededError(e))

Wrap once

One line around your OpenAI-compatible create() call. Streaming usage is captured too. Same code as the README quickstart.

Set budgets02
cus_A71$3.05
cus_C09$10.40
cus_8F2$18.40
cus_2KQ$2.00
$080%: cheaper model100%: blocked
Illustration of how the thresholds work

Set budgets

A monthly USD budget per customer, by plan or by customer. Counters live in memory, Redis or your own store.

Auto-downgrade03
cus_8F2 at 92% of budget
gpt-5.5gpt-5.4-mini
Same request · cheaper model
Illustrative

Auto-downgrade

Near the cap (e.g. 80%), mapped models switch to cheaper ones.

Block at cap04
BudgetExceededError: Customer cus_2KQ has used $2.0000 of a $2.00 AI budget for 2026-10.
e.code === "LLMBRAKE_BUDGET_EXCEEDED"
You've hit this month's AI limit. Upgrade for more.Upgrade
Example upgrade prompt

Block at cap

Typed BudgetExceededError before the provider call.

Usage events05
// onUsage(event): metadata only
{
  customerId: "cus_8F2", plan: "pro", feature: "chat",
  requestedModel: "gpt-5.5",
  model: "gpt-5.4-mini", downgraded: true,
  promptTokens: 1102, cachedTokens: 640,
  completionTokens: 182,
  costUsd: 0.0012135,
  spentUsd: 18.40, budgetUsd: 20,
  // no prompt, no completion
}
Illustrative values

Know every call's cost

One usage event per call: tokens and computed cost. To your logs, warehouse, or the hosted dashboard

See margin06 · Hosted
CustomerAI costRevenueMargin
Customer A$4.10$29.00+$24.90
Customer B$41.70$29.00−$12.70
Mockup with illustrative numbers. Not real customer data.

See margin

AI cost vs Stripe revenue per customer. Hosted dashboard.

03 / Open sourceMIT licensed SDK · github.com/llmbrake/llmbrake

Open source.

Enforcement runs in your code. MIT. The hosted dashboard is optional.

npm install llmbrake

npm · GitHub · TypeScript types included · Node 18+

A

MIT licensed

Zero runtime dependencies. TypeScript; Python port in the repo.

B

Metadata only

Customer ID, plan, model, token counts, cost and timestamps. Never prompts or completions.

C

Fails open

Calls go through if the budget store is unreachable. Fail-closed optional.

04 / PricingNo card needed

Free SDK. Hosted dashboard.

SDK: free, MIT. Hosted dashboard (shared counters, Slack/webhook alerts, Stripe margin view): free during early access, then $29/month founding price.

Hosted dashboardFounding price
$29 / month
  • Hosted dashboard: cost per customer, feature and model
  • Shared budget counters across servers and serverless
  • Slack and webhook alerts near and at caps (email Soon)
  • Stripe revenue vs AI cost per customer
  • Free during early access; founding price when billing starts
  • Direct line to the builders for feature requests
Sign up

No card needed.

SDKMIT
$0
  • Per-customer dollar budgets in your app
  • Cheaper model near the cap, hard block at the cap
  • In-memory, Redis or Postgres store
  • TypeScript and Python
Read the quickstart
05 / FAQPrivacy first
01Do you see or store my prompts?

No. We store usage metadata only: customer ID, plan, feature tag, model, token counts, computed cost and timestamps. Prompts and completions never leave your servers. The open-source SDK doesn't read message contents at all.

02Is this a proxy in front of OpenAI?

No. The SDK runs inside your app and calls your provider directly with your own keys. The budget check runs before each call, and the cost is recorded after it.

03What happens if your service is down?

By default the SDK fails open: if the budget store is unreachable, calls go through, so your product keeps working. You can choose to fail closed instead.

04Which providers and models are supported?

Any OpenAI-compatible chat completions API, including OpenAI, OpenRouter, Anthropic's OpenAI-compatible endpoint and many gateways. Verify and extend the bundled price table; provider prices change.

05How accurate are the costs?

Costs are computed from the token usage the provider returns and your price table. Batch discounts, long-context tiers and regional uplifts aren't modeled yet. Reconcile with your provider invoice.

06Can I use it without paying?

Yes. The SDK is MIT licensed (npm install llmbrake) and works on its own with an in-memory or your own Redis/Postgres store. The paid plan covers the hosted dashboard, alerts and the Stripe margin view, free during early access.

07Who's building this?

A small independent team. SDK on npm; hosted dashboard at app.llmbrake.com.

No card needed

Start braking.