# Usage-based pricing simulator

Three changes to a usage-based price list, sized to the same revenue and tested on 2,000 synthetic customers: whose bill jumps more than 20%, what an assumed usage response does to the gain, and how many of the shocked accounts can leave before a platform fee stops out-earning the tier changes.
Every bill is reproducible from one seeded run and rounded once to the cent; revenue is the exact sum of the bills, and a spreadsheet recalculates all of it with live formulas.

Open [the report](report.html) for the findings, what the change is worth in US dollars and the recommendation, or the
[workbook](pricing-simulator.xlsx) to change the prices yourself.

<!-- results:start -->
**In the base case, higher tier thresholds beat the flat platform fee unless fewer than about 1 in 4 of the 1,295 accounts it shocks would leave, but only if the larger accounts stay: losing 3.0% of the bills the thresholds raise (869 accounts, largest first) erases their gain at the middle response.** Across the three tested usage responses the fee out-earns the tier changes only while fewer than 8.5% to 48.9% of its shocked accounts leave (25.2% at the middle response). With no usage response it never does: the three changes raise the same revenue, so any leaving tips the balance to the tier changes. Leaving and the usage response are swept assumptions, not estimates, and in the base case only shocked accounts can leave, so nobody leaves the tier changes, which favours them; [results-tier-leaving.json](results-tier-leaving.json) lets the largest accounts leave them too.

Every alternative is sized to the same static revenue: **US$2.83M** a month, +5.0% on the baseline's US$2.70M, from 2,000 synthetic customers with usage held fixed.

| Alternative | Size at the target | Bill-shock exposure | Change after middle response (e = −0.3) |
|---|---|---:|---:|
| Higher tier thresholds | tier ends × 1.358 (13,580 / 67,898 / 339,488) | 0.0% (0 customers) | +2.9% |
| Shallower volume discounts | discounts × 0.889 (17.8 / 35.6 / 49.8% off) | 0.0% (0 customers) | +2.8% |
| Platform fee | US$202.28 a month, usage rates 10% lower | 64.8% (1,295 customers) | +7.4% |

Of the platform fee's 1,295 shocks, 95 are accounts that paid nothing at baseline. A variant that sizes each change in advance is kept in [results-v1.json](results-v1.json), and the main results without the churn breakeven in [results-v2.json](results-v2.json).
<!-- results:end -->

<img src="assets/churn-breakeven.png" alt="Monthly revenue change against the share of shocked accounts that leave: the platform fee line falls and crosses the flat tier-change lines at the breakeven">

<img src="assets/revenue-change.png" alt="Revenue change for each alternative at the same static revenue target, with the range after an assumed usage response">

<img src="assets/bill-shock.png" alt="Bill-shock exposure by segment and alternative at equal revenue">

## Purpose and reader

This is for pricing, finance and data teams deciding how to raise revenue from a usage-based price
list. It compares three ways to raise the same revenue: higher tier thresholds, shallower volume
discounts and a platform fee. It shows the mechanics a pricing review needs (marginal versus
whole-volume tiers, free allowances, rounding, a platform fee), which customers each change hurts,
how an assumed usage response moves the gain, and the trade-off that decides it: how many of the
accounts a change shocks can leave before its extra revenue is gone.

## What is real and what is simulated

Everything is simulated. The 2,000 customers are drawn from a seeded lognormal usage model in four
segments. The price list is an illustrative synthetic schedule. It is not any
vendor's price list and was not derived from one. There is one plan, billed in USD for one calendar
month. The usage unit is a compute credit: metered usage to two decimals, rounded up to a whole
credit each month, after which 500 free credits come off.

| Scheme | Change from baseline |
|---|---|
| Baseline | Tiers end at 10,000, 50,000 and 250,000 billable credits; 0, 20, 40 and 56% off a $0.05 list rate |
| Higher tier thresholds | Every tier end multiplied by one factor |
| Shallower volume discounts | Every tier discount multiplied by one factor |
| Platform fee | A monthly fee on every account, with every usage rate 10% lower |

Each alternative is sized so its static revenue (usage held fixed) comes as close as possible to
baseline revenue plus 5%, within 0.01%. The target was fixed before the sized run. Baseline revenue
itself would not work as a target: higher thresholds and shallower discounts can only raise
revenue, so neither has a version that holds baseline revenue except no change at all. The solved
sizes are in the table above the charts. The threshold and discount changes each change one part of the schedule;
the platform fee changes two (it adds a fee and lowers every usage rate). All four bill at the
margin: each credit is priced at its own tier's rate. The report also prices the baseline schedule
on whole volume to show why that creates cliffs.

Bill-shock exposure is the share of customers whose monthly bill rises more than 20% against
baseline. An account that paid nothing at baseline and pays anything under the alternative counts.
It counts customers; it is not a churn probability. The usage response uses assumed constant
elasticities of −0.1, −0.3 and −0.6 with respect to the marginal price: the rate of the tier holding
the customer's last billable credit. A fixed fee does not change that price, so it moves no usage.
The elasticities are sensitivities, not estimates, and revenue is shown separately before and after
each one.

The churn breakeven (its rules were written down before it was computed) lets a share of
the shocked accounts leave, the same share in every segment, swept from 0% to 100%. A leaver pays
nothing; the revenue lost is the bill it would have paid under that change. Only shocked accounts
can leave, so under this rule nobody leaves the tier changes. The breakeven is the share at which
the platform fee's revenue falls to the better tier change's, at no usage response and at each
assumed elasticity, overall and with only one segment leaving. Over a 12-month horizon with leavers
gone from the first month, the breakeven does not depend on the horizon. Downgrades are not modelled
separately (one plan; using less is the usage response). Two declared checks move the bill-rise
line to 10% and 30% and spread the leaving through the year.

A variant sizes each change in advance, so the alternatives raise different
revenue, and models the response on the ratio of bills. Its results are in
[results-v1.json](results-v1.json) and [customers-v1.csv](customers-v1.csv), and the report sets its
figures beside the main ones. The main results without the churn breakeven are in
[results-v2.json](results-v2.json); every field they hold has the same value in results.json.

## Outputs

The main outputs read one result file, [results.json](results.json). The priced holdout page reads its own,
[results-holdout.json](results-holdout.json), and changes nothing in the main results.

- [report.html](report.html): the reader-facing page. Every rendered number comes from a result field.
- [priced-holdout.html](priced-holdout.html): sizes the priced holdout the report recommends for the platform fee
  (who is in it, how many accounts, how long, the written stop rule) and shows how often that test makes the right
  ship-or-stop call, by simulation on the same accounts and model. The same model generates the test data and grades
  the call, so those rates hold only if customers behave the way the model says.
- [results-holdout.json](results-holdout.json): every right-call rate, the breakeven at any usage response, the test
  design and the sensitivity runs behind that page; it is built from a fixed seed.
- [analysis.ipynb](analysis.ipynb): executed notebook that re-derives the tables and checks reconciliation.
- [pricing-simulator.xlsx](pricing-simulator.xlsx): editable inputs, 2,000 customer rows and a summary,
  all as live formulas for Excel and LibreOffice Calc. Its summary sheet shows the Python values
  beside the live ones.
- [customers.csv](customers.csv): exact per-customer bills under every scheme and response, with the
  bill-shock flags the churn breakeven uses.
- `assets/`: charts as PNG and SVG.
- [fixtures/boundary_cases.json](fixtures/boundary_cases.json): hand-calculated bills at zero use,
  just below, at and above every threshold, and rounding cases, for every scheme in both runs.
- `vendor/viz-design-system/`: the page's fonts, styles and number
  formatting, copied unchanged from design system release 2.0.4 (pinned in
  `vendor/viz-design-system-adoption.json`).

## Reproduce and check

Use Python 3.12 and [uv](https://docs.astral.sh/uv/). From this directory:

    uv sync --frozen
    uv run python -m pricing.check

The check runs the tests (hand-calculated boundary fixtures, rounding, reconciliation, the revenue
target, the response and bill-shock rules, hand-made churn breakeven cases and an independent
recomputation of every breakeven from customers.csv, and a reproduction of the variant sized in advance), regenerates every
output into `runtime/check-build/`, confirms each file is byte-identical to the shipped one, and
prints a single `VERDICT:` line. To rewrite the outputs in place, run `uv run python -m pricing.run`.
Notebook execution needs permission to bind a local loopback port. No API key, network access after
installation, or paid service is needed.

## Limitations

- One synthetic month and one seed. No contracts, commitments, prepaid credits, negotiated discounts,
  taxes or currency effects.
- Segment mix and usage spread are assumptions. A different seed or mix moves every figure; the
  shape of each trade-off is the finding, not the dollar values.
- Leaving is a swept assumption, not a churn forecast: the breakeven says how much leaving the fee can
  absorb, not how much will happen. Only accounts past the bill-shock line can leave, so smaller rises
  under the tier changes are assumed to lose no one (the 10% check relaxes this).
- The fee's lead over the tier changes comes entirely from the assumed usage response to its rate
  cut; with no response it has no lead. The elasticities are assumed, applied to one month in one
  step, and not estimated from data.
- Spreadsheet recalculation is checked in Microsoft Excel. LibreOffice was not available on the
  build machine, so LibreOffice compatibility is expected from the function list but unverified.

## Fonts and licences

Fonts: Newsreader, Public Sans and IBM Plex Mono under the SIL Open Font License, from the vendored
design system; see [NOTICE.txt](NOTICE.txt).

Some files are packed in usage-based-pricing-data-1.zip; unzip it here to restore the full export, which the manifest lists file by file.
