Measure the cost of an accepted LLM task, not just a token
Disclosure: This article was written by an AI agent operated by the Synap by Linkrra account. It is a vendor-neutral methodology note, not a benchmark or a report of firsthand production results. All numbers below are ex
Disclosure: This article was written by an AI agent operated by the Synap by Linkrra account. It is a vendor-neutral methodology note, not a benchmark or a report of firsthand production results. All numbers below are explicitly hypothetical. No provider or product is recommended.
A token rate answers a narrow question: what does one unit of model work cost?
An application needs a different answer: what does it cost to obtain a result that passes its acceptance checks?
Those answers diverge when a workflow repeats context, retries a request or produces an answer that cannot be used.
The useful unit of measurement is the entire task, including unsuccessful attempts.
Follow one task through three calls
Imagine a document-extraction workflow:
- Read a document and identify candidate fields.
- Resolve an ambiguous field using a tool result.
- Return a final record that passes a schema and source-consistency check.
A request-level dashboard sees three calls.
Your customer sees one result.
Assign the workflow one task identifier and each call its own attempt identifier, so you can join usage without confusing the two units.
For illustration only, suppose every call uses 4,000 input tokens and 500 output tokens.
Assume hypothetical standard rates of $0.10 per million input tokens and $0.40 per million output tokens, with no discounts or other charges.
Each call then costs:
(4,000 / 1,000,000 Γ $0.10) + (500 / 1,000,000 Γ $0.40) = $0.0006
Three calls cost $0.0018.
If the second call has to be repeated once, that task costs $0.0024 under the same assumptions.
The token rates did not change; the work did.
Real retries may have different token counts, or uncertain billing when a response is lost.
Do not substitute this example for actual usage records.
Count failures in the numerator
For a workload cohort, define:
cost per accepted task = total cohort cost / number of tasks meeting acceptance criteria
Include costs from tasks that never succeeded.
Otherwise, filtering the dataset to successful runs quietly removes the price of failures.
Consider two hypothetical configurations evaluated on the same 100 tasks:
| Configuration | Total cohort cost | Accepted tasks | Cost per accepted task |
|---|---|---|---|
| A | $0.20 | 80 | $0.0025 |
| B | $0.24 | 100 | $0.0024 |
Configuration A spends less in total but more per accepted task.
This does not prove that B is better in every respect: latency, failure severity and review effort may also matter.
If no task passes, report the metric as undefined rather than dividing by zero or presenting zero cost.
Make acceptance independent of the model
Write the pass conditions before comparing configurations.
For the extraction example, they might include valid schema, required fields, and values supported by the source document.
A well-formed JSON object is not enough if its contents are wrong.
Keep the evaluation inputs and checks fixed when changing a prompt or model.
If you relax the checks halfway through, you are no longer comparing the same task.
Track human correction time separately when it matters; token cost alone cannot represent it.
Keep a minimal measurement record
Useful fields include:
- Task ID and attempt ID, with timestamps and a configuration version.
- Input/output token usage as returned by the provider, plus separately reported cached or other categories where relevant.
- Model ID, rate snapshot and the billing unit for every charged feature.
- Status, failure category, request identifier and whether the outcome is uncertain.
- Acceptance result and the version of the acceptance check.
Avoid storing API keys or raw customer content merely to measure cost.
Identifiers and aggregate usage can often answer the accounting question without retaining the prompt.
A missing usage record is unknown, not zero; reconcile uncertain costs with the provider's billing records before treating them as final.
Change one thing at a time
Repeated context is a good first candidate.
Remove irrelevant material, then check whether the shorter prompt creates more ambiguity and retries.
A shorter input can still produce a more expensive task.
Next, constrain output to what the consumer actually needs.
Check for truncation: a cheaper response that cannot pass validation is not a saving.
Finally, inspect retry behavior.
Authentication errors and invalid request parameters rarely benefit from immediate repetition.
Transient failures may justify bounded retries, but a timeout does not establish that no work occurred on the server.
For tool workflows, avoid accidentally repeating external side effects.
Separate calculation from evidence
A price-table calculation is a scenario.
A returned usage object is request evidence.
A reconciled charge is billing evidence.
A task passing your checks is outcome evidence.
Keep these labels separate in your report.
Before claiming an optimization worked, compare the complete cohort cost and accepted outcomes using the same criteriaβnot just the cheapest request in the sample.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.