> ## Documentation Index
> Fetch the complete documentation index at: https://docs.integrateledger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Features

> Model any action or resource in your app as a feature, metered, held, on or off, priced in credits or billed as AI usage in dollars.

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`](https://docs.integrateledger.com/customers/check-and-track). Plans decide how much of it each customer gets, through [items](https://docs.integrateledger.com/concepts/plans-and-items.md).

## Five types

| `type` | Example | A plan item gives | `track` does | Pattern |
| - | - | - | - | - |
| `metered` | Messages, API calls | An allowance per period (`included`), or unlimited | Spends `quantity` units (default 1) | [Metered](https://docs.integrateledger.com/pricing/metered.md) |
| `held` | Projects, seats | A limit on how many at once (`included`), or unlimited | Adds `quantity`, removes with a negative one, or sets `count` | [Limits](https://docs.integrateledger.com/pricing/limits.md), [Per seat](https://docs.integrateledger.com/pricing/per-seat.md) |
| `boolean` | SSO, audit log | Access, nothing to count | Logs the use and charges nothing | [Feature flags](https://docs.integrateledger.com/pricing/feature-flags.md) |
| `credits` | Image generation | Nothing per feature: the plan's credits are one shared pool, or the item makes it unlimited | Spends `quantity × creditCost` credits | [Credits](https://docs.integrateledger.com/pricing/credits.md) |
| `ai_tokens` | Model calls | The shared pool (default), or its own dollar allowance per period | Prices the call's `model` and `tokens` in dollars and spends them | [AI usage in dollars](https://docs.integrateledger.com/pricing/ai-credits.md) |

`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`](https://docs.integrateledger.com/pricing/credits#cheaper-at-volume).

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](https://docs.integrateledger.com/pricing/ai-credits.md).

```ts ledger.config.ts theme={"system"}
features: [
	feature({ id: "messages", name: "Messages", type: "metered" }),
	feature({ id: "projects", name: "Projects", type: "held" }),
	feature({ id: "sso", name: "SSO", type: "boolean" }),
	feature({ id: "generate_image", name: "Generate an image", creditCost: 1 }),
],
```

```json ledger.catalog.json theme={"system"}
"features": [
  { "id": "messages", "name": "Messages", "type": "metered" },
  { "id": "projects", "name": "Projects", "type": "held" },
  { "id": "sso", "name": "SSO", "type": "boolean" },
  { "id": "generate_image", "name": "Generate an image", "creditCost": 1 }
]
```

## 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](https://docs.integrateledger.com/billing/plan-versions.md) 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

> [card] [Plans and items](https://docs.integrateledger.com/concepts/plans-and-items.md)
>
> Put features into plans with allowances, limits and prices.

> [card] [Balances](https://docs.integrateledger.com/concepts/balances.md)
>
> How grants turn into what a customer can use.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.