Clavem

Metered licensing

Metered licensing ties what a customer may do, or what they pay, to how much they actually use, such as API calls, renders or tokens, instead of to a fixed number of keys or devices.

How it works

Metering does three jobs, and they can live in different places.

  1. Measure: record each billable action, such as an export, with who did it.
  2. Decide: compare the running total with the customer’s allowance and allow or refuse the next action.
  3. Bill: turn the total into an invoice, if the price depends on use.

The counter has to sit on a server you control. A count kept in the app can be reset by a reinstall, so it is useful for showing a progress bar but not for enforcement.

A worked example

An example plan: $20 a month includes 500 exports, and each extra export costs $0.05. A customer makes 640 exports in a month. The bill is $20 + (640 - 500) x $0.05 = $20 + $7.00 = $27.00.

The flow in the app is short:

  1. The app asks your backend to record an export, sending the license id and a unique request id.
  2. The backend adds one to the counter for that license, unless it has seen the request id before.
  3. It answers with the number left. At zero the app shows an upgrade prompt, or lets the action through and bills the overage.

The unique request id is an idempotency key. Without it, a network retry counts the same export twice.

Failure modes

  • Offline use: the app queues usage events and sends them later. Decide how far over the allowance a customer may go while offline.
  • Double counting: retries, as above.
  • Counting for enforcement versus counting for billing: the first can be rough, the second must match what you invoice.

Metered licensing versus usage-based pricing

Usage-based pricing is about the price. Metered licensing is about the allowance. A flat-price plan with a monthly quota is metered but not usage-priced. A pay-as-you-go plan with no cap is usage-priced and needs metering only for the invoice.

How Clavem handles it

Clavem does not meter usage. It has no counters, credits or overage, and it never counts validations toward your bill, which is a flat monthly price by active licenses. The signed token’s claims are a fixed list, so you cannot put a remaining balance in it. Do not use validate as a counter either: it is rate limited to 60 requests per 60 seconds per key, and its answer carries no usage counts apart from the number of active devices.

What Clavem can do is identify the customer. A verified token carries lid, the license id, and pid, the product. Use lid as the customer id in your own counter table, and use the token to decide whether the person is a paying customer at all. For billing by use, Stripe Billing supports usage-based pricing, built on its Meters API, and as of November 2026 points new integrations to Metronome. Clavem’s job stays the same: it issues and checks the license. See the API reference and offline verification.

Questions

Is metered licensing the same as usage-based pricing?

They overlap. Usage-based pricing is a way to charge. Metered licensing is a way to enforce an allowance. You can meter without charging by use, for example a flat price with a monthly export quota.

Where should usage be counted?

On a server you control. A counter stored inside the app can be reset by reinstalling or editing a file.

Sources

  1. Stripe documentation, basic usage-based billing (checked November 2026)