Skip to main content

Welcome to Limitr

The control plane for usage-based software.

Limitr is the intersection between what your product delivers and what your business captures. You define your pricing model once — in a policy document, not in code. Limitr enforces limits at the point of consumption, meters usage in the same operation, and feeds margin data back to your team in real time.

Every limit enforced. Every customer tracked. Every deal profitable.

When pricing needs to change, it changes in one place where everyone understands it, and gets enforced everywhere, instantly. No PR. No deploy. No coordination.


How it works

A Limitr policy is a document — written in YAML, JSON, or Stof — that describes your entire pricing structure: plans, entitlements, credits, exchange rates, reset schedules, and overage behavior.

The policy runs inside your application via WebAssembly. There is no remote enforcement API. Every allow(), increment(), and check() executes in-process, in microseconds — before cost is incurred, and before any network call is made.

// Enforce a limit
if (await policy.increment('org_123', 'seats')) {
await db.addMember(userId, orgId);
}

// Track AI usage against a monthly allowance
if (await policy.allow('user_456', 'ai_tokens', estimatedTokens)) {
const response = await callLLM(prompt);
}

// Gate a feature
const canExport = await policy.check('user_789', 'pdf_export');

One check. Limits enforced. Usage metered. Margins visible.


Where to start

If you're new, start here:

Quick Start →
Get enforcement running in your app in under 10 minutes.

Concepts →
Understand credits, entitlements, plans, and how they compose into a policy. Worth reading before you design your pricing model.

Policy Reference →
The full reference for every field in a policy document — credits, exchange, plans, entitlements, limits, margin, notifications.

Cookbook →
Working patterns for common scenarios: AI token metering, seat-based SaaS, API call limits, storage, time-based usage.

Limitr Cloud →
Connect to the managed platform. Managed policies, per-customer analytics, Stripe integration, live alerting — same enforcement engine, one-line SDK swap.


The enforcement API

Limitr exposes a deliberate, minimal API surface that covers even the most complex usage-based billing scenarios:

// allow — consume `amount` if within limit. Returns true/false.
await policy.allow('user_123', 'ai_tokens', 4200);

// increment — consume one unit. Returns true/false.
await policy.increment('user_123', 'seats');

// decrement — release one unit.
await policy.decrement('user_123', 'seats');

// check — read-only. Does not consume. Returns true/false.
await policy.check('user_123', 'pdf_export');

// remaining — how much is left, including grants.
await policy.remaining('user_123', 'ai_tokens');

// value — how much has been used, raw or as a percentage.
await policy.value('user_123', 'ai_tokens');

// customerMarginSnapshot — revenue, cost, and margin for one customer.
await policy.customerMarginSnapshot('user_123');
// → { revenue: 87.20, cost: 38.30, margin: 48.90 }

Units are respected throughout. If you define mb_storage with stof_units: MB, you can pass 500MB, 1GB, or '2000000bytes' — Limitr converts.


Local and Cloud

Limitr ships as two things that share the same core:

Open source enforcement engine — runs entirely in-process via WebAssembly. No network calls, no external dependencies. Define a policy in YAML, JSON, or Stof and load it directly.

const policy = await Limitr.new(policyDoc);

Limitr Cloud — same enforcement engine, managed platform. Your policy lives in the Cloud dashboard, versioned, auditable, editable without a redeploy. Adds per-customer analytics, Stripe integration, usage-based invoicing, real-time alerting, and Limitr Network.

const policy = await Limitr.cloud({ token: 'limitr_...' });

The enforcement API is identical. Start local, move to Cloud when you're ready — it's a one-line change.


How it's different

Every major usage-based billing platform — Metronome, Orb, Schematic — runs enforcement through a remote API. Every allow() is a network call. Latency is the floor, and your enforcement logic lives in someone else's system.

Limitr is different:

  • Runs inside your app. Policies execute in WebAssembly, colocated with your application. Enforcement is microseconds, not milliseconds. No network dependency on the hot path.
  • The policy is a document. Version it, ship it with self-hosted deployments, load it from a database, or send it over the wire. Your pricing model is yours.
  • Margin-aware by design. Limitr knows your costs and your prices — because they're defined in the same policy that drives enforcement. It can tell you which customers are profitable in real time. Most billing systems only know what was charged.

Stripe knows: "User paid for Pro."
Limitr knows: "User can create 10 seats, use 1M tokens, export PDFs — and here's what that's costing you, per customer, in real time."


Resources

  • GitHub — source, issues, and contributions
  • Discord — questions and community
  • Stof — the open-source data runtime powering the policy engine
  • Limitr Cloud — the managed platform
  • Book a demo — talk to us directly