Testing chatbot cost calculators: billing pack boundaries and resolution costs
A chatbot cost estimator needs a billing contract before it needs a slider. Two plans can have the same headline monthly price and very different invoices if one bills in blocks and the other bills per successful resolut
A chatbot cost estimator needs a billing contract before it needs a slider. Two plans can have the same headline monthly price and very different invoices if one bills in blocks and the other bills per successful resolution.
Here is a deliberately small, reproducible example of the first model. I use it as a sanity check when comparing quotes for customer support automation.
1. Define the billable unit
Let a subscription include I monthly units, with additional units sold in packs of P at a price C. For monthly usage U and base fee B:
extra = max(0, U - I)
packs = ceil(extra / P)
monthly cost = B + packs * C
All inputs below are fictional; they are not vendor quotes. For a $20 subscription including 1,000 units, with 500-unit packs at $10, the boundaries are:
| Usage | Extra packs | Monthly bill |
|---|---|---|
| 0 | 0 | $20 |
| 1,000 | 0 | $20 |
| 1,001 | 1 | $30 |
| 1,500 | 1 | $30 |
| 1,501 | 2 | $40 |
A continuous linear approximation misses the jump at 1,001. That can matter for a small business choosing a plan.
2. Make rounding an explicit test
Use integer cents and integer billable units rather than rounding floating-point dollar totals. This Node.js example requires no dependencies:
import assert from "node:assert/strict";
function monthlyBill({ base, usage, included, pack, price }) {
for (const n of [base, usage, included, pack, price]) {
if (!Number.isSafeInteger(n) || n < 0) {
throw new RangeError("Expected non-negative safe integers");
}
}
if (pack === 0) throw new RangeError("Pack must be positive");
const extra = Math.max(0, usage - included);
const total = base + Math.ceil(extra / pack) * price;
if (!Number.isSafeInteger(total)) throw new RangeError("Bill overflow");
return total;
}
const plan = { base: 2000, included: 1000, pack: 500, price: 1000 };
for (const [usage, expected] of [
[0, 2000], [1000, 2000], [1001, 3000],
[1500, 3000], [1501, 4000]
]) {
assert.equal(monthlyBill({ ...plan, usage }), expected);
}
assert.throws(() => monthlyBill({ ...plan, usage: -1 }));
assert.throws(() => monthlyBill({ ...plan, usage: 1, pack: 0 }));
Run it with Node.js as an ES module. The important cases are exactly at the allowance and one unit past each pack boundary.
3. Separate invoice units from outcomes
A conversation, message, AI credit, token and resolved ticket are not interchangeable. Before using a cost model, ask the provider what triggers each billable event, how failed or reopened conversations are treated, whether unused units roll over, and whether seats and support are included.
For example, 1,000 interactions with 600 independently confirmed resolutions and a $120 total monthly software cost imply $0.20 per confirmed resolution, excluding human handling and other costs. Do not equate that with a vendor's billed per-resolution price unless its definition and denominator match yours.
4. Test answer quality alongside cost
A cheap bot that makes unsupported commitments can be costly to operate. For a controlled test, hold the fictional knowledge base and prompts constant, record the model and version, and check evidence, uncertainty handling, multi-turn context and handover separately. A critical failure should not disappear inside an average score.
Our team maintains a public chatbot evaluation kit with 100 synthetic cases from five fictional businesses and a dependency-free CLI. The cases are test fixtures, not observed vendor performance. You can also try the interactive cost calculator to explore your own assumptions.
Disclosure: I run the team behind ChatbotPricing.com. The example is illustrative, not a quotation or a claim about competing vendors. This tutorial was prepared with AI assistance.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.