How to Evaluate LLM Cost Per Task and Cost-Effectiveness Scientifically
Token pricing alone can be misleading when choosing a large language model. This article explains why per-task cost—not per-token price—is the metric that matters, walks through a calculation method for per-task and per-success costs, discusses how to interpret parameter counts and benchmark scores, and provides a practical evaluation workflow with code to help teams select models based on real business data.
Why Token Price Alone Isn’t Enough
LLM services are typically priced per million tokens, with separate rates for input and output. Output tokens usually cost significantly more than input tokens. When comparing models, it’s easy to just look at the price sheet and conclude which model is “cheaper.”
But what your business actually pays is the total cost of completing a task. The cost of a single call can be written as:
Per-task cost = input tokens × input price + output tokens × output price
Output tokens include both the model’s internal reasoning tokens (e.g., its thinking process) and the final content returned to the user. For models that perform long chain-of-thought reasoning, output tokens can far exceed the length of the visible answer. As a result, a model with a lower unit price may not have a lower per-task cost.
Calculating Per-Task Cost
The following function computes the cost of a single call, with prices in dollars per million tokens:
def cost_per_task(input_tokens: int, output_tokens: int,price_in: float, price_out: float) -> float:"""price_in and price_out are in USD per million tokens."""return (input_tokens * price_in + output_tokens * price_out) / 1_000_000
Here’s an illustration with fictional numbers. These values are for demonstration only and don’t correspond to any real product:
- Model A: input price 1.0, output price 4.0, average output 40K tokens. Per-task cost = (2000 × 1.0 + 40000 × 4.0) / 1e6 = $0.162.
- Model B: input price 3.0, output price 15.0, average output 10K tokens. Per-task cost = (2000 × 3.0 + 10000 × 15.0) / 1e6 = $0.156.
Model B’s output price is 3.75 times that of Model A, yet their per-task costs differ by only about 4%. The reason is that Model A consumes 4 times as many output tokens. This shows that token efficiency is just as central to cost as unit price.
Token Efficiency and Cost Per Success
Cost calculations also need to account for task quality. If a model is cheaper per call but has a lower success rate—requiring retries or manual rework—its real cost can end up higher. It’s therefore recommended to track these metrics together:
- Average per-task cost: the arithmetic mean of all sample costs.
- Task success rate: the proportion of samples passing your business acceptance criteria.
- Cost per success: average per-task cost divided by the success rate.
Continuing the example above, if Model B’s success rate is 80%, its cost per success is 0.156 / 0.80 = $0.195. If Model A’s success rate is 70%, its cost per success is 0.162 / 0.70 ≈ $0.231. Under these assumptions, Model B is cheaper overall. The conclusion depends on actual success rates, so you must measure them with your own business data rather than relying on someone else’s numbers.
Understanding Parameter Scale
LLMs are often described by “total parameters” and “active parameters.” These two metrics mean different things:
- Total parameters determine the storage footprint and upper bound of GPU memory for model weights, affecting deployment requirements.
- In a Mixture-of-Experts (MoE) architecture, each token only passes through a subset of expert networks, so active parameters are closer to the actual computation per inference.
Note that a smaller active parameter count doesn’t necessarily mean lower cost. Inference cost also depends on output token count, server-side batching efficiency, hardware utilization, and pricing strategy. Also, fewer active parameters doesn’t necessarily mean weaker capability—capability depends on training data, post-training methods, and evaluation settings. So parameter scale is useful for understanding a model’s technical approach, but shouldn’t be the sole basis for selection.
Using Third-Party Benchmark Scores Correctly
Composite benchmark scores are usually weighted results across multiple subtasks. Two models with the same score may not perform identically across task types. When interpreting benchmark results, keep these points in mind:
- Look at subtask scores and confirm performance on the task types you care about.
- Check whether the benchmark version, prompt templates, reasoning effort settings, context length, and sampling temperature match your business setup.
- Watch sample sizes and result variance. With few samples, small score differences may just be random noise.
- Treat scores as an initial screening tool only. Once models make your shortlist, re-test them with your real business samples.
Building Your Own Cost Evaluation Process
Teams can establish a fixed evaluation process in four steps.
Step 1: Collect representative samples. Use stratified sampling by task type—e.g., Q&A, information extraction, code generation—keeping enough samples per stratum, and define acceptance criteria for each sample.
Step 2: Record token usage. When calling the API, read input and output token counts from the usage fields in the response, and log reasoning tokens separately to help analyze where output bloat comes from.
Step 3: Compute cost and success rate. Run the same batch of samples against each candidate model and reasoning-effort setting, and produce average per-task cost, success rate, and cost per success.
Step 4: Set budgets and routing policies. Based on the results, route simple requests to lightweight models and reserve stronger models for complex requests. Also set output length caps and reasoning budgets to prevent individual requests from generating unusually high costs.
Here’s a code skeleton for the evaluation process:
def evaluate(client, dataset, price):total_cost, successes = 0.0, 0for sample in dataset:resp = client.generate(sample["prompt"]) # returns text and token usagetotal_cost += cost_per_task(resp.input_tokens, resp.output_tokens,price["in"], price["out"],)successes += int(sample["checker"](resp.text))n = len(dataset)avg_cost = total_cost / nsuccess_rate = successes / nreturn {"avg_cost": avg_cost,"success_rate": success_rate,"cost_per_success": avg_cost / success_rate if success_rate else float("inf"),}
The checker should be a business-defined acceptance function, such as structured field comparison, unit test execution, or rule-based validation. The closer your acceptance logic is to the real business, the more reliable the evaluation results.
Model Selection and Ongoing Monitoring
Model pricing and versions change over time, so evaluation conclusions have a shelf life. Re-run the evaluation process after every price change or model upgrade, and always use the provider’s latest official pricing.
In practice, also keep the following in mind:
- For high-frequency, low-complexity requests, prefer models with low cost and low latency.
- For low-frequency, high-complexity requests, stronger models are acceptable, but set a per-request cost cap.
- For highly repetitive prompts, use caching to reduce input costs.
- Monitor the daily distribution of input and output tokens, and investigate prompts or reasoning settings promptly when abnormal growth appears.
In short, model selection should center on cost per success, combined with your task distribution, quality requirements, and budget constraints. Unit price is just one input to cost—what truly determines spend is the total number of tokens consumed to complete tasks, together with the success rate.
