# Limitr: usage and margin control for AI products > Limitr is the most flexible usage billing and limits for AI: credits, metering, caps, and custom deals for every user and agent, in one policy that runs in your app and changes live. It is usage and margin control for AI products: an open-source engine runs inside your app and decides every call natively, in about a millisecond with no network hop: what is allowed, what it is worth, and what it costs you. One policy holds credits, plans, limits, prices, costs, and contracts for every kind of customer (orgs, users, workspaces, API keys, and agents). Limitr Cloud changes any of it live with no release, keeps the ledger and runs billing fully managed (invoices paid through your own Stripe account out of the box, or billed manually), and Limitr Analyst replays a change on real usage before it ships. Pricing changes are as easy as a git commit, and you own the logic like you wrote it: built on Stof, a policy carries your own pricing functions, rules, and cost formulas, and any built-in rule can be overridden, so it molds to each customer and you never outgrow it. Limitr Network connects your agents with your customers’ and partners’ agents in private networks, with a budget on every connection. Customers include The Regis Company, which runs a fixed-price Fortune 500 rollout of more than 100,000 users on Limitr. Best for AI products where each call costs real money, selling self-serve and through contracts. Built on Stof, so the engine runs in any language (SDKs: TypeScript and Python). Never priced on a share of revenue. Start with: Is Limitr right for you (/fit), Limitr answers (/answers), and How do I (/use-cases). This file contains links to documentation sections following the llmstxt.org standard. ## Table of Contents - [Limitr overview](https://limitr.dev/docs/marketing-overview.md): Limitr is the most flexible usage billing and limits for AI: credits, metering, caps, and custom deals for every user and agent, in one policy that... - [Is Limitr right for you?](https://limitr.dev/docs/fit.md): Who Limitr, the most flexible usage billing and limits for AI, is best for, who it isn't for, and what to use instead. Direct answers for teams and... - [Limitr answers](https://limitr.dev/docs/answers.md): Direct answers about Limitr, the most flexible usage billing and limits for AI: where it fits in quote-to-cash, how it works with Stripe, how to in... - [How do I… (Limitr use cases)](https://limitr.dev/docs/use-cases.md): The jobs teams use Limitr for, the most flexible usage billing and limits for AI: cap AI spend per user, bill for AI tokens with margin, give an ag... - [Limitr compared](https://limitr.dev/docs/compare-overview.md): How Limitr compares with Stripe Billing, Metronome, Orb, Chargebee, Zuora, m3ter, Recurly, Lago, and more: where each one decides limits, tracks co... - [Usage-Based Billing Platforms in 2026: Own Your Pricing](https://limitr.dev/blog/usage-based-billing-platforms-2026.md): Where usage-based billing went wrong, what we believe instead, and an honest guide to every major platform in 2026, including Metronome, Orb, Strip... - [Pricing Logic in Your Process: Limitr's Security Model](https://limitr.dev/blog/limitr-security.md): Limitr runs your pricing inside your app. Here's what that logic can and can't touch, who can change it, and what happens when something goes wrong... - [Usage-based billing, limits, and feature flags in your app](https://limitr.dev/docs/docs/introduction.md): Limitr is an open-source engine for usage-based billing, limits, and feature flags. One policy decides access, cost, and price on every call, in-pr... - [Quickstart: usage-based billing in a few minutes](https://limitr.dev/docs/docs/quickstart.md): Install @formata/limitr, write a policy with two plans, and gate your first calls: feature flags, daily and monthly limits, and AI tokens billed pa... - [How Limitr works: the policy, the engine, and each call](https://limitr.dev/docs/docs/how-it-works.md): The pieces of a Limitr policy (credits, plans, entitlements, customers, grants, caps), how the engine decides each call, and the events it sends. - [Live demo: the Limitr engine in your browser](https://limitr.dev/docs/docs/demo.md): The Limitr engine running live in your browser. Change prices, costs, limits, and modes, and watch usage, revenue, cost, and margin move call by call. - [Limitr tutorial: usage-based billing in 15 programs](https://limitr.dev/docs/docs/tutorial/index.md): A short book on usage-based billing with Limitr: 15 chapters, each one a small program you can run, from a first policy to AI calls, org budgets, a... - [Limitr tutorial 1: Why Limitr](https://limitr.dev/docs/docs/tutorial/why-limitr.md): Where usage-based billing gets hard, and what Limitr does about it: one policy, and an engine that runs inside your app. - [Limitr tutorial 2: Your first policy](https://limitr.dev/docs/docs/tutorial/first-policy.md): Credits, plans, and entitlements, the allow call, and how a Stof policy is written. - [Limitr tutorial 3: Customers and plans](https://limitr.dev/docs/docs/tutorial/customers-and-plans.md): Default plans, orgs and their users through refs, plan changes, and alt IDs. - [Limitr tutorial 4: Limits and resets](https://limitr.dev/docs/docs/tutorial/limits-and-resets.md): Units like 1GB and 1day, rolling and calendar periods, and resets that need no cron jobs. - [Limitr tutorial 5: Hard, soft, and observe](https://limitr.dev/docs/docs/tutorial/hard-soft-observe.md): Deny the call, allow it and bill the overage, or just watch: limit modes and the events they send. - [Limitr tutorial 6: Pricing and margins](https://limitr.dev/docs/docs/tutorial/pricing-and-margins.md): Prices, costs, and tiers, and the margin of every call as it happens. - [Limitr tutorial 7: AI calls: reserve and settle](https://limitr.dev/docs/docs/tutorial/reserve-and-settle.md): Costs that change per call, usage you only know afterwards, and predicting the size of a call before it runs. - [Limitr tutorial 8: Stacking entitlements](https://limitr.dev/docs/docs/tutorial/stacking-entitlements.md): One action, several meters: hold what you'll know afterwards, count what you know now, and give holds back on a refusal. - [Limitr tutorial 9: Control and monetize](https://limitr.dev/docs/docs/tutorial/control-and-monetize.md): Rate limits that protect you, next to the usage you sell, with governors. - [Limitr tutorial 10: Seats, top-ups, and spend caps](https://limitr.dev/docs/docs/tutorial/seats-topups-caps.md): Org seats, prepaid credit packs, and budgets shared across an org. - [Limitr tutorial 11: Running it in your app](https://limitr.dev/docs/docs/tutorial/running-in-your-app.md): One engine per server, gating requests in one place, and saving customer state. - [Limitr tutorial 12: Validation and errors](https://limitr.dev/docs/docs/tutorial/validation-and-errors.md): Policy formats, validation, and what happens when something is wrong. - [Limitr tutorial 13: Going to Cloud](https://limitr.dev/docs/docs/tutorial/going-to-cloud.md): The same code with Limitr Cloud: managed policies, shared customer state, billing, and analytics. - [Limitr tutorial 14: The language underneath: Stof](https://limitr.dev/docs/docs/tutorial/stof.md): Reading the policy document from your app, asking it questions, and why Limitr is built on Stof. - [Limitr tutorial 15: Feature flags and custom deals](https://limitr.dev/docs/docs/tutorial/feature-flags.md): Rollouts, kill switches, per-call rules, and giving or taking features per customer. - [Map your pricing model to a policy](https://limitr.dev/docs/docs/how-to/map-your-pricing.md): Turn a pricing page into a Limitr policy, line by line, for usage-based, seat-based, credit-based, flat, and hybrid pricing. - [Price AI tokens per model, with margin per call](https://limitr.dev/docs/docs/how-to/ai-token-costs.md): Price AI calls per model and per input and output token, with a credit per model or a cost function. Bill line items that match your provider, and ... - [Reserve and settle LLM calls](https://limitr.dev/docs/docs/how-to/reserve-llm-calls.md): Gate LLM calls whose size you only know afterwards: reserve room first, settle what the call used, and keep concurrent calls from overspending toge... - [Predict LLM output tokens before the call](https://limitr.dev/docs/docs/how-to/predict-output-tokens.md): Predict how long an AI answer will be before the call, from its input tokens, per model. Use it to set max_tokens, quote a price, or pick a model. - [Govern Claude agents (Agent SDK)](https://limitr.dev/docs/docs/how-to/claude-agent-sdk.md): Govern agents built on the Claude Agent SDK with a Limitr policy: hide tools by plan, decide and count every tool call, meter every model response,... - [Govern Claude API calls (Messages API)](https://limitr.dev/docs/docs/how-to/claude-messages-api.md): Size, decide, and meter every Claude Messages API call with a Limitr policy: tools by plan, max_tokens capped at the tokens left, room held while a... - [Feature flags, rollouts, and experiments](https://limitr.dev/docs/docs/how-to/feature-flags.md): Kill switches, percentage rollouts that widen cleanly, beta lists, rules per request, features for the front end, and measuring a rollout or A/B test. - [Trials and custom deals without a plan per customer](https://limitr.dev/docs/docs/how-to/custom-deals.md): Give one customer a feature their plan doesn't have, trial a higher plan's feature with an expiry, raise limits with overrides, pause a feature, or... - [Seat-based pricing on the org](https://limitr.dev/docs/docs/how-to/seats.md): Count seats on the org whichever user invites someone. Included seats, billing extra seats, hard seat limits, removing members, and what to bill ea... - [Budgets and spend limits for customers and orgs](https://limitr.dev/docs/docs/how-to/budgets.md): Let customers set a monthly spend limit, warn them before they reach it, share a budget across an org, and cap what a customer can cost you. - [Prepaid credits and credit packs](https://limitr.dev/docs/docs/how-to/prepaid-credits.md): Sell credits that every feature spends at its own rate. Monthly included credits, credit packs, balances, and features that stop when credits run out. - [Rate limits next to paid usage](https://limitr.dev/docs/docs/how-to/rate-limits.md): Protect your infrastructure with rate limits (governors) that sit next to the usage customers pay for, never lifted by credit packs, with a Retry-A... - [Bill usage from events](https://limitr.dev/docs/docs/how-to/bill-from-events.md): Turn Limitr's events into invoice lines: plan fees, overage, extra seats, and credit packs, with what credits covered already taken off. - [Save customer state in your database](https://limitr.dev/docs/docs/how-to/save-customer-state.md): Keep Limitr's customer state in your own database: save changed customers from events, load them on start or first use, and run more than one server. - [Self-hosting Limitr](https://limitr.dev/docs/docs/how-to/self-hosting.md): There is no Limitr server to deploy: the engine is a package (npm or PyPI) that runs inside your app. What self-hosting means, what you own, and ho... - [Change plans: upgrades, downgrades, and credit packs](https://limitr.dev/docs/docs/how-to/change-plans.md): Upgrade and downgrade customers mid-period: keep usage counted so far, carry credit packs to the new plan, keep deal features, and handle customers... - [Test a pricing policy like code](https://limitr.dev/docs/docs/how-to/test-a-policy.md): Test pricing like code. Validate a policy in CI, write tests for what each plan allows and bills, test time-based behavior, and test policies in St... - [Extend Limitr: your own rules, tools, and services](https://limitr.dev/docs/docs/how-to/extend-limitr.md): A Limitr policy can carry its own logic: cost functions, feature rules, event handlers, your own functions, capabilities, and connections to your a... - [Write policies in Stof](https://limitr.dev/docs/docs/how-to/write-stof-policies.md): The Stof you need for Limitr policies: syntax and units, functions for costs, rules, and notifications, shared types, null handling, and flat memory. - [Call your app from a policy](https://limitr.dev/docs/docs/how-to/call-your-app.md): Let policy functions call your application: register host functions with doc.lib, call them from notifications and handlers, and allow HTTP from a ... - [Give AI agents tools, gated by plan](https://limitr.dev/docs/docs/how-to/ai-tools.md): Define capabilities in a Limitr policy and hand them to Claude as tools, filtered by each customer's plan. Tool definitions, running a tool_use blo... - [Get started with Limitr Cloud](https://limitr.dev/docs/guides/cloud/quickstart.md): Sign up for Limitr Cloud, build your first policy with a template or the Analyst, connect your app with an API key, and find your way around the ap... - [Edit and publish your policy in Limitr Cloud](https://limitr.dev/docs/guides/cloud/policies.md): The Policy page in Limitr Cloud: the shared draft, starter templates, entitlements, plans, credits, rules, the Stof code, reviewing changes, publis... - [Limitr Analyst, the agent in Limitr Cloud](https://limitr.dev/docs/guides/cloud/agent.md): What Limitr Analyst, the agent in Limitr Cloud, can do: write and simulate your policy, read your customers and usage and the files you attach, put... - [Manage customers in Limitr Cloud](https://limitr.dev/docs/guides/cloud/customers.md): Find customers, see their usage, limits, balances, and bill, change one customer (plan, limit overrides, giving or taking an entitlement, caps, top... - [Contracts and rules in Limitr Cloud](https://limitr.dev/docs/guides/cloud/contracts.md): Put negotiated terms in place without a plan per deal: rules in your policy say what changes (limits, features, caps, rates), and contracts say who... - [Coupons and promo codes in Limitr Cloud](https://limitr.dev/docs/guides/cloud/coupons.md): Offer coupon and promo codes with a segment and a rule: a discount for the customers who entered a code, for as long as you choose, applied on Clou... - [Dashboards and usage by metadata in Limitr Cloud](https://limitr.dev/docs/guides/cloud/dashboards.md): Limitr Cloud dashboards: usage, cost, value, and margin from your calls, broken down by the metadata your calls carry and by groups like tasks, wit... - [Customer segments in Limitr Cloud](https://limitr.dev/docs/guides/cloud/segments.md): Group customers by plan, type, metadata, activity, or usage with rules or a Stof condition, see how many match as you write it, filter every page b... - [Notifications, alerts, and events in Limitr Cloud](https://limitr.dev/docs/guides/cloud/notifications.md): Raise alerts and email your team when something happens with your customers: limits, overages, caps, plan changes, given or taken entitlements, and... - [Connect Stripe to Limitr Cloud](https://limitr.dev/docs/guides/cloud/stripe.md): Charge your customers through your own Stripe account: connect Stripe in test and live, link and sync your Stripe customers, and how invoices, usag... - [Connect your app to Limitr Cloud](https://limitr.dev/docs/guides/cloud/connect-your-app.md): Make an API key in Limitr Cloud and connect your app with the Limitr SDK: test and live keys, usage-only keys for browsers, what syncs, what happen... - [Your team in Limitr Cloud](https://limitr.dev/docs/guides/cloud/team.md): Invite teammates to a Limitr Cloud workspace and choose what each can do: publish policies, create, change, or delete customers, manage API keys, t... - [Limitr Cloud plans and billing](https://limitr.dev/docs/guides/cloud/plans-and-billing.md): Limitr Cloud's Free, Pay as you go, Scale, and Enterprise plans: what each includes, how active customers, governed calls, and the Analyst's usage ... - [Policy document reference](https://limitr.dev/docs/docs/reference/policy.md): The shape of a Limitr policy, the formats it can be written in (Stof, JSON, YAML, TOML), its top-level fields, and how the engine validates it. - [Credits, prices, and pricing models](https://limitr.dev/docs/docs/reference/credits.md): Credits are the units Limitr counts. Each has a price, an overhead cost, units, and a pricing model: flat, tiered, volume, or stairstep. - [Cost functions and margin per call](https://limitr.dev/docs/docs/reference/cost-and-margin.md): How Limitr records what each call costs you (fixed, per-call cost functions, or the provider's actual cost), its list price, and margin per call, c... - [Exchange: convert any credit into any other](https://limitr.dev/docs/docs/reference/exchange.md): The exchange converts any credit into any other through runes: abstract credits like AI credits that pay for the credits you meter, prices set in c... - [Plans, the default plan, and plan fees](https://limitr.dev/docs/docs/reference/plans.md): Plans group entitlements and credit packs. Plan fields, the default plan, how customers get a plan (directly or through refs), plan changes, and su... - [Entitlements, limits, and resets](https://limitr.dev/docs/docs/reference/entitlements.md): What a plan allows: entitlement and limit fields, hard, soft, and observe modes, resets and calendar schedules, rate limits, and org scope. - [Feature rules: rollouts, kill switches, and tracking](https://limitr.dev/docs/docs/reference/feature-rules.md): An entitlement's enabled rule for kill switches, rollouts, and per-call rules; customer.bucket for percentage rollouts; features() for the front en... - [Customers: IDs, refs, overrides, and state](https://limitr.dev/docs/docs/reference/customers.md): Customers hold Limitr's state. Creating customers, IDs, users and orgs through refs, alt IDs, overrides, giving and taking entitlements, and saved ... - [Grants and topups: credit packs and balances](https://limitr.dev/docs/docs/reference/grants-and-topups.md): Topups are credit packs on a plan, and grants are the balances they give a customer. Fields, included packs, expiry, resets, rollover, spend order,... - [Spend caps: budgets across features and credits](https://limitr.dev/docs/docs/reference/spend-caps.md): Budgets across calls, entitlements, and credits, in any currency: adding caps, shared org budgets, overage-only and cost caps, warnings, resets, an... - [Reservations and estimates](https://limitr.dev/docs/docs/reference/reservations.md): Reserve room before a call whose size you only know afterwards, settle what it used, and predict how big a call will be: reserve, settle, release, ... - [Events reference: usage, billing, and customer events](https://limitr.dev/docs/docs/reference/events.md): Every event the Limitr engine sends and its payload: meter events with cost and price per call, caps, customers, plans, and features, and which to ... - [Notifications: rules on engine events](https://limitr.dev/docs/docs/reference/notifications.md): Rules in the policy that watch Limitr's events: matches and fire, adding notifications at runtime, Stof event handlers, and common alert conditions. - [Capabilities: compose and extend a policy](https://limitr.dev/docs/docs/reference/capabilities.md): Capabilities are named, access-controlled functions in a Limitr policy. Run them from your app, connect services, load data from APIs, and hand the... - [Engine functions reference](https://limitr.dev/docs/docs/reference/engine-functions.md): Every function the Limitr engine exposes on the policy, with signatures and return values: metering, reservations, reads, customers, caps, and plans. - [TypeScript SDK reference (@formata/limitr)](https://limitr.dev/docs/docs/reference/typescript-sdk.md): Reference for @formata/limitr, the TypeScript and JavaScript SDK: creating the engine, every method with arguments and defaults, events, and Cloud ... - [Python SDK reference (limitr)](https://limitr.dev/docs/docs/reference/python-sdk.md): Reference for limitr, the Python SDK: creating the engine, every method with arguments and defaults, events, threads and asyncio, Limitr Cloud, and... - [Runtime and sandbox](https://limitr.dev/docs/docs/reference/runtime.md): How the Limitr engine runs in your process: where it runs, the sandbox, the sealed engine, time and memory limits on policy calls, flat memory, rea... - [Security model](https://limitr.dev/docs/docs/reference/security.md): What Limitr's engine and policy code can and can't touch in your app, who can change your pricing, what leaves your process with Limitr Cloud, how ... - [How to Design a Flexible Pricing Model for AI Products](https://limitr.dev/blog/design-a-flexible-pricing-model-for-ai.md): A practical playbook for AI startups to design a flexible and scalable pricing strategy. - [AI Pricing Strategy in 2026: A Practical Guide](https://limitr.dev/blog/ai-pricing-strategy-guide.md): A practical playbook for AI startups navigating pricing complexity, margin pressure, and the shift to hybrid monetization. - [We Mean Runtime Literally](https://limitr.dev/blog/we-mean-runtime-literally.md): Everyone in usage-based pricing says enforcement has to happen at runtime. Limitr means runtime as a noun — an execution environment embedded in yo... - [How to Control Overhead Cost for AI Products](https://limitr.dev/blog/how-to-control-ai-overhead-costs.md): Cost-to-deliver isn't enough. Here's how to measure margin-to-deliver per account, feature, and vendor — then control it with enforcement limits an... - [Customer Story: The Regis Company](https://limitr.dev/blog/regis-case-study.md): How The Regis Company, an enterprise learning platform, used Limitr to meter and enforce real-time AI avatar usage ahead of a fixed-price Fortune 5... - [Limitr 0.7: Real Costs, Predicted Usage, and Feature Flags](https://limitr.dev/blog/limitr-engine-0-7-0.md): Limitr 0.7 is the biggest release of the open-source engine yet. Costs that change on every call, reservations that predict a call's usage before i... - [The New Limitr Cloud: Analyst, Contracts, Pay As You Go](https://limitr.dev/blog/limitr-cloud.md): Limitr Cloud is rebuilt on the 0.7 engine. One versioned policy for plans, prices, limits, and contracts, Limitr Analyst working beside you on ever... - [Limitr 0.8: Contracts in the Engine, Quote to Cash in Cloud](https://limitr.dev/blog/limitr-0-8.md): Limitr 0.8 puts negotiated terms into the open-source engine as rules, and Limitr Cloud turns a signed contract into what your app enforces and wha... - [Limitr for Python](https://limitr.dev/blog/limitr-for-python.md): Limitr 0.8.7 adds a Python SDK: the same open-source engine, policies, events, Limitr Cloud connection, and Limitr Network, in-process in Python 3....