> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.preview.paid.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.preview.paid.ai/_mcp/server.

# Formulaic pricing

> Turn a pricing formula, such as pages × a rate per document type × 1.5 for rush jobs, into meters, prices and rate cards that Paid bills exactly.

A **pricing formula** is any charge your pricing page writes as arithmetic: tokens × a rate per model × 0.5 for batch, or pages × a rate per document type, plus 10% for support. In Paid you don't write the formula as code. You split it into parts, and each part is set on the Paid object built for it: a meter measures the quantity, a rate card chooses the rate, modifiers multiply it, and prices add fees on top. Your events carry facts, never amounts, so changing the formula is configuration, not a deploy.

Use this page to:

* **Map a formula onto Paid**, part by part, with the [five parts of a formula](#the-five-parts-of-a-formula).
* **Find the pattern** for a formula you already charge, in [common formulas](#common-formulas).
* **See a formula billed** from events to the invoice line, in the [worked example](#build-a-formula).
* **Know what to do** when a formula [doesn't fit](#formulas-that-dont-fit-directly).

The objects on this page are in private beta: send `Paid-Beta` with `meters=v1`, `prices=v1` and `rate_cards=v1`, as each object's page describes.

## The five parts of a formula

Every formula Paid bills splits into the same five parts, applied in this order:

| Part           | Answers                                        | Set by                                                                                                                                                                                            |
| -------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1. Quantity    | How much was used?                             | A [meter](/usage/meters): an aggregation such as `sum` or `uniqueCount`, or a [workflow meter's](/usage/workflows-and-outcomes#shape-the-derived-event) `composite`, `divideBy` and `round`       |
| 2. Rate        | What does one unit cost, given its dimensions? | A [price](/catalog/prices) for one rate, or a [rate card](/catalog/rate-cards) that matches each dimension, such as `payload.model`                                                               |
| 3. Modifiers   | What multiplies the rate?                      | Rate card modifiers for every customer, and [negotiated pricing](/core-concepts/introduction-to-pricing#how-one-line-is-priced) for one order                                                     |
| 4. Shape       | How does a quantity become an amount?          | `pricing` on the price or rate: `perUnit` with `per`, `graduated` or `volume` tiers, `tierScope`                                                                                                  |
| 5. Composition | How does the charge relate to other charges?   | [Percent-of](/catalog/prices#percent-of-prices) and [cost-plus](/catalog/prices#cost-plus-pricing) prices, [commits](/orders-and-billing/commits) and [credits](/core-concepts/money-and-credits) |

Read a formula left to right and give each term to its part. Trey Research' token pricing is:

```
tokens × rate for the model × 0.5 if batch × 2 if the prompt is over 200,000 tokens
```

| Term                         | Part     | In Paid                                                                                                  |
| ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `tokens`                     | Quantity | A meter per token type that sums the tokens, with `groupBy` on `payload.model` and `payload.serviceTier` |
| `rate for the model`         | Rate     | A rate per model family on the `api_list_prices` rate card, matched by `prefix`                          |
| `× 0.5 if batch`             | Modifier | A batch modifier on `payload.serviceTier`, × 0.5                                                         |
| `× 2 if over 200,000 tokens` | Modifier | A long-context modifier on the request's input token fields, × 2                                         |

Paid keeps every step exact and rounds once, half-up, to the currency's minor unit on each invoice line. A formula's result never drifts from its arithmetic because of rounding along the way.

## Common formulas

| Formula                                                                  | Build it from                                                                                                                                              |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Units × a rate per dimension (model, region, document type)              | A meter with `groupBy`, priced by a [rate card](/catalog/rate-cards)                                                                                       |
| × a discount or premium for some usage (batch, priority, region)         | A rate card modifier                                                                                                                                       |
| × a premium for large requests (long context, high resolution)           | A rate card modifier on the request's fields                                                                                                               |
| × a negotiated rate for one customer                                     | [Negotiated pricing](/core-concepts/introduction-to-pricing#how-one-line-is-priced) on the customer's order: a contracted price, a discount or a surcharge |
| A fee per call + a rate per token                                        | Two meters on the same events, `count` and `sum`, each with its own price or rate                                                                          |
| Cheaper per unit at volume                                               | `graduated` or `volume` tiers, which reset each billing period                                                                                             |
| One rate for the first N units of each job, another after                | [`tierScope: "event"`](/catalog/prices#tiered-pricing) on a usage price or a rate card's rate                                                              |
| At least a set amount per request                                        | `volume` tiers with a `flatAmount`, and `tierScope: "event"`, as in [a minimum per request](#a-minimum-per-request)                                        |
| Effort from several fields, such as tokens ÷ 1,000 + review minutes ÷ 10 | A [workflow meter](/usage/workflows-and-outcomes#shape-the-derived-event) with a `composite` quantity                                                      |
| What it cost you × a margin                                              | A [cost-plus](/catalog/prices#cost-plus-pricing) price on the events' cost lines                                                                           |
| A percentage of other charges, with a floor or cap                       | A [percent-of](/catalog/prices#percent-of-prices) price with `minimum` and `maximum`                                                                       |
| At least a set amount per year                                           | An invoiced minimum [commit](/orders-and-billing/commits#invoiced-minimums)                                                                                |
| Usage drawn from prepaid credits                                         | Prices or rate cards in a [credit currency](/credits/how-credits-work)                                                                                     |

## Build a formula

Clausebase reviews contracts for law firms. Instead of one tiered rate per page, it charges by document type, with a premium for rush jobs and a priority support fee on top:

```
pages × (8¢ for an NDA, 15¢ for an MSA, 12¢ for anything else)
      × 1.5 for rush turnaround
+ 10% of review charges for priority support, at least $500.00 a month
```

| Term                      | Part        | Object                                                             |
| ------------------------- | ----------- | ------------------------------------------------------------------ |
| `pages`                   | Quantity    | The `pages_by_type` meter, grouped by document type and turnaround |
| `8¢`, `15¢`, `12¢`        | Rate        | Three rates on the `review_rates` rate card                        |
| `× 1.5 for rush`          | Modifier    | A `rush` modifier on the same card                                 |
| `+ 10%, at least $500.00` | Composition | A `percentOf` price on the order's usage charges, with a `minimum` |

Each review sends one `review.completed` event with `pages`, `documentType` and `turnaround` in its payload. Amounts on rates are decimal strings in cents. The percent-of `minimum` is Money: an integer in cents with its currency.

#### API

[Create a meter](../api-reference/metering/meters/create) that sums the pages and splits them by the two dimensions the formula reads:

**`POST /v1/meters`**

```json title="POST /v1/meters"
{
  "key": "pages_by_type",
  "name": "Pages by document type",
  "eventNames": ["review.completed"],
  "measure": {
    "type": "events",
    "events": {
      "aggregation": { "type": "sum", "sum": { "path": "payload.pages" } },
      "unit": "page",
      "groupBy": ["payload.documentType", "payload.turnaround"]
    }
  }
}
```

Set up a rate card, `review_rates`, with a rate per document type, a fallback for every other type, and the rush premium. The rate card API is in preview; [Rate cards](/catalog/rate-cards) explains how a rate card's versions, rates and modifiers price a meter.

| Rate     | Matches                         | Amount     |
| -------- | ------------------------------- | ---------- |
| NDA      | `payload.documentType` is `nda` | 8¢ a page  |
| MSA      | `payload.documentType` is `msa` | 15¢ a page |
| Fallback | everything else                 | 12¢ a page |

A `rush` modifier multiplies the rate by 1.5 when `payload.turnaround` is `rush`.

[Create a price](../api-reference/catalog/prices/create) for priority support at 10% of the order's usage charges, with a \$500.00 monthly minimum:

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "doc_review",
  "name": "Priority support",
  "currency": "usd",
  "type": "percentOf",
  "percentOf": {
    "percent": "10",
    "of": { "type": "chargeTypes", "chargeTypes": ["usage"] },
    "minimum": { "amount": 50000, "currency": "usd" }
  }
}
```

Put the rate card and the price on Halberd LLP's [order](/orders-and-billing/orders). The formula now runs on every `review.completed` event Clausebase sends.

#### Dashboard

> **Draft**
>
> These steps describe the planned v1 dashboard and will change before release.

1. Go to **Configure > Meters** and click **Create meter**. Sum `payload.pages` from `review.completed` events, in the unit `page`, and group by `payload.documentType` and `payload.turnaround`.
2. Go to **Configure > Products**, open **Doc review**, and under **Rate cards** click **Create rate card**. Add a rate of 8¢ a page for **payload.documentType is nda**, 15¢ for **msa**, and a fallback of 12¢ that matches everything.
3. Under **Modifiers**, add **Rush turnaround** (×1.5 when **payload.turnaround is rush**), then click **Create rate card**.
4. Under **Prices**, click **Create price**, choose **Percent of**, enter 10%, choose **Usage** charges as the base, and set a monthly minimum of \$500.00.

### How it bills

In November, Clausebase reviews 41,000 pages for Halberd LLP:

| Usage                       | Rate that matches    | Calculation                                         | Amount         |
| --------------------------- | -------------------- | --------------------------------------------------- | -------------- |
| 12,000 NDA pages, standard  | `eq` `nda`: 8¢       | 12,000 × 8¢ = 96,000¢                               | \$960.00       |
| 20,000 MSA pages, standard  | `eq` `msa`: 15¢      | 20,000 × 15¢ = 300,000¢                             | \$3,000.00     |
| 4,000 MSA pages, rush       | `eq` `msa`: 15¢      | 4,000 × 15¢ = 60,000¢, × 1.5 rush = 90,000¢         | \$900.00       |
| 5,000 other pages, standard | fallback `[]`: 12¢   | 5,000 × 12¢ = 60,000¢                               | \$600.00       |
| **Contract review**         |                      | 96,000¢ + 300,000¢ + 90,000¢ + 60,000¢ = 546,000¢   | **\$5,460.00** |
| **Priority support**        | 10% of usage charges | 546,000¢ × 10% = 54,600¢, above the 50,000¢ minimum | **\$546.00**   |
| **Total, before tax**       |                      | \$5,460.00 + \$546.00                               | **\$6,006.00** |

The invoice shows a sub-line for each document type and turnaround, with the rush modifier itemised under the MSA rush line, so Halberd can check every term of the formula. In a quiet month with \$3,000.00 of reviews, 10% is \$300.00 and the support line is the \$500.00 minimum.

To change a rate in the formula for every customer, publish a new rate card version and [migrate](/core-concepts/introduction-to-pricing#migrations) the orders that should use it. To change it for Halberd alone, add [negotiated pricing](/core-concepts/introduction-to-pricing#how-one-line-is-priced) to its order.

## Put the formula in the quantity

When a formula combines several fields before applying a rate, compute that combination in the meter, not the price. The price then charges one rate for one quantity, and the invoice still reads as quantity × rate.

A [workflow meter](/usage/workflows-and-outcomes#shape-the-derived-event) combines values with `composite` (`add`, `min` or `max`), and scales each with `divideBy` and `round`. Litware bills support effort as one unit, where 1,000 output tokens or 10 minutes of human review each count as one:

```json
"quantity": {
  "type": "composite",
  "composite": {
    "op": "add",
    "values": [
      { "type": "sum", "sum": { "path": "cost.inference.outputTokens" }, "divideBy": "1000" },
      { "type": "sum", "sum": { "path": "payload.reviewMinutes" }, "divideBy": "10" }
    ]
  },
  "round": "nearest",
  "unit": "effortUnit"
}
```

A ticket with 4,200 output tokens and 25 review minutes counts as 4.2 + 2.5 = 6.7, rounded to 7 effort units. A usage price on the meter then charges a single rate per effort unit.

## A minimum per request

`volume` tiers charge the whole quantity at the rate of the tier it ends in, and a tier's `flatAmount` is charged when the quantity ends in that tier. With `tierScope: "event"`, both apply to each event on its own. Together they charge the larger of a minimum and the metered amount, per request.

Trey Research charges \$5.00 per million tokens on its embeddings API, and at least 1¢ a request. At 500¢ per million, 2,000 tokens cost exactly 1¢, so that's where the first tier ends:

```json
"pricing": {
  "type": "volume",
  "volume": {
    "per": "1000000",
    "tierScope": "event",
    "tiers": [
      { "upTo": "2000", "unitAmount": "0", "flatAmount": 1 },
      { "upTo": null, "unitAmount": "500" }
    ]
  }
}
```

| Request       | Ends in     | Calculation                   | Charge |
| ------------- | ----------- | ----------------------------- | ------ |
| 800 tokens    | First tier  | flat 1¢                       | 1¢     |
| 2,000 tokens  | First tier  | flat 1¢                       | 1¢     |
| 10,000 tokens | Second tier | 10,000 × 500 ÷ 1,000,000 = 5¢ | 5¢     |

`tierScope` is set on a usage price or on each rate of a rate card, so the same tiers work for one rate per meter or for a rate per dimension.

## Formulas that don't fit directly

| Formula                                                                                                | What to do                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| A rate that depends on total spend across meters, such as 10% off everything above \$50,000.00 a month | Tiers count one meter's quantity. Agree the discount as [negotiated pricing](/core-concepts/introduction-to-pricing#how-one-line-is-priced) on the order or a [commit](/orders-and-billing/commits) instead. |
| A condition across several events of one request                                                       | Group the events into a [workflow](/usage/workflows-and-outcomes) and price its outcome or quantity.                                                                                                         |
| Math Paid doesn't offer, such as a square root or an exponent                                          | Compute the billable quantity in your code, send it in `payload`, and `sum` it. You'll need a deploy to change the formula, so keep only that term in code.                                                  |

Usage that a formula can't rate is never billed at a guessed amount. A meter counts invalid values in `health.invalidValues24h`, so a gap in a formula shows up before an invoice is issued.

## Related

* [Pricing models](/core-concepts/pricing-models)
* [Introduction to pricing](/core-concepts/introduction-to-pricing)
* [Prices](/catalog/prices)
* [Meters](/usage/meters)
* [Workflows and outcomes](/usage/workflows-and-outcomes)