Skip to main content
Anything your app does or holds can be priced as a feature: sending a message, creating a project, signing in with SSO, generating an image, calling a model. Your backend passes its id to check and track. Plans decide how much of it each customer gets, through items.

Five types

type is credits when you leave it out. A credits feature sets a creditCost, a whole number above 0, and can make it fall with volume through creditCostTiers. An ai_tokens feature has no fixed cost: each call is priced from its model and tokens at Ledger’s model price table plus your markup (markupPercent, by provider or by model), and charged in dollars. Its balance is pool, the shared credit pool once the catalog sets creditsPerUsd, or own, a dollar allowance its plan item grants. See AI usage in dollars.

Which type to use

  • Usage you count per period is metered: each feature gets its own allowance, which resets with the period.
  • Something the customer holds is held: the count goes up and down, and never resets.
  • Something a plan has or doesn’t is boolean.
  • Several actions sharing one budget, priced differently (an HD image costs 4, a standard one 1), are credits: plans grant credits, not uses.
  • Model calls billed at what they cost, plus your markup, are ai_tokens.

Rules

  • The type is fixed once the feature exists (feature_type_locked), and so is an AI feature’s balance. To change either, publish a new feature.
  • Metered, held and boolean features need an item on the plan; without one, check and track answer feature_not_in_plan. A credits feature needs no item: any plan’s credits pay for it.
  • A credits feature costs the same on every plan. A bigger plan gives more monthlyCredits, or makes the feature unlimited with an item.
  • Credits and metered units never mix. A metered allowance is its own balance, never paid from or into the credit pool.
  • Changes apply in place. A new name or creditCost applies from then on; usage already tracked keeps what it was charged. Plan versions are untouched.
  • Removing a feature from the file archives it. check and track return 404 feature_not_found for it, and its recorded usage stays. Publishing its ID again brings it back.
  • A feature in use stays live. Archiving a feature that a current plan lists in its items, or that a live subscriber’s plan version lists (older and archived versions included), is refused with 409 feature_in_use. Remove it from those plans and move their subscribers to a version without it, then archive it.
  • IDs are 1–100 characters of letters, numbers, _ and -, and are permanent. Names are 1–120 characters.

Next steps

Plans and items

Put features into plans with allowances, limits and prices.

Balances

How grants turn into what a customer can use.