DEV Community

Deepak Shukla
Deepak Shukla

Posted on

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 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
Enter fullscreen mode Exit fullscreen mode

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 }));
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The 1,001 line is the whole post for me. One message over the allowance and the bill jumps from $20 to $30 — and a smooth slider would never show you that cliff, because it averages the jump away. That is exactly the trap with tools that market a flat monthly price: the headline number is honest, and the invoice still surprises you, because the billing unit was never the thing you were counting.

Your third point is the one I would steal first. Cost per interaction flatters a bot that answers fast and wrong; cost per confirmed resolution is the number a small business actually feels — 1,000 interactions, 600 resolutions, $120 total is a much harsher and much fairer test. And the integer-cents rule is the kind of detail that only comes from having been bitten by it: floating-point rounding on a boundary case is a billing bug that looks like a pricing decision.

In your 100-case kit, when you hold answer quality constant and vary only the billing shape, which failure mode moves the cost per resolution most: bots that escalate to a human too early, or bots that answer confidently and wrong? And do you test a boundary equivalent to "one unit past the allowance" for resolution-based billing too, where the boundary itself is fuzzier than a pack size?