Cost Per Task: Why LLM Pricing Shouldn’t Be Measured by Token Unit Price Alone
When integrating large language models into business systems, teams often start by checking the price sheet. While the per-million-token price is important, it represents only one part of the total cost. What truly determines whether a project can run long-term is the cost of completing a specific task. As new model generations are released with adjusted pricing structures—lower input token rates, proportionally reduced output token rates, and larger discounts for cached input—developers should shift from token-based billing to task-based cost evaluation. This article explains the three token billing categories, why unit prices alone are misleading, and how to use score-cost curves, caching strategies, and monitoring systems to make data-driven model selection and cost optimization decisions.
Introduction
Before integrating a large language model into a business system, teams typically start by reviewing the price sheet. The listed price per million tokens matters, but it is only one component of total cost. What determines whether a project can sustain long-term operation is how much a single task actually costs to complete. When next-generation models are released, pricing structures are often adjusted simultaneously: input token unit prices drop, output token unit prices are correspondingly reduced, and discounts for cached input tokens become more generous. These adjustments push developers to move from token-based billing toward evaluating costs based on task-level outcomes.
What Are the Three Token Billing Categories?
Input tokens correspond to prompts, system instructions, and context. Their unit price is relatively low. Output tokens correspond to content generated by the model, and their unit price is typically several times higher than input tokens. Cached input tokens apply to repeated content, such as fixed system prompts or prior conversation history. The server reuses previously computed results via key-value caching, so this portion is significantly cheaper than freshly processed input.
The higher the cache hit rate, the closer a single request’s cost approaches the output cost alone. Consider a customer service bot where every request includes a fixed 2,000-token system prompt. If that portion consistently hits the cache, the largest fixed overhead per request is effectively reduced. Specific discount rates vary by provider, so teams should verify the details before going live.
Why Unit Price Comparison Is Not Enough
Token consumption for the same task varies significantly across models. Stronger models sometimes deliver answers of equivalent quality with fewer output tokens, thereby offsetting a higher unit price. Comparing only the per-million-token price can lead teams to select models that are cheaper per token but require repeated retries and produce unnecessarily verbose output.
Model selection should therefore be based on the total cost per task. That total cost includes at least input, output, and cached token fees, as well as failed retries, additional calls from concurrency, and the time spent on human evaluation.
How to Use a Score-Cost Curve for Model Selection
In a score-cost curve, the horizontal axis represents cost per task and the vertical axis represents an evaluation score such as accuracy, F1, or human preference rating. The closer a curve sits to the upper-left corner, the better the outcome for the same cost. Use your own business dataset to generate the curve rather than relying on public leaderboards.
Follow these steps:
- Build a representative task set — for example, 200 real-world questions covering common scenarios and edge cases.
- For each candidate model, record the average input tokens, output tokens, and cached input tokens per task.
- Calculate the cost of each task using current unit prices, factoring in the retry rate.
- Score each model using your evaluation methodology.
- Plot points with cost on the x-axis and score on the y-axis, and identify which models fall toward the upper-left.
Four Cost Optimization Approaches
| Method | Applicable Scenario | Key Parameters | Main Risk |
|---|---|---|---|
| Prompt simplification | Verbose instructions or unstable output formatting | Remove irrelevant descriptions, enforce structured output | Over-trimming reduces accuracy |
| Prefix caching | Recurring fixed system prompts | Keep stable content at the start of the prompt | Cache invalidation when prefix content changes |
| Model routing | Requests with widely varying difficulty | Define rules for distinguishing simple vs. complex tasks | Misclassification degrades quality |
| Batch and async processing | Independent offline tasks | Use Batch APIs or async queues | Not suitable for real-time response scenarios |
When submitting tasks in batch, pay attention to two points. First, do not force unrelated requests into the same shared context — requests will interfere with each other and may exceed the context length limit. Second, set rate limits and timeouts to avoid a single slow request holding up the entire batch.
How to Configure Caching
The cache TTL determines how long cached content is retained. If the TTL is set too long, context may become stale — the model may return outdated information after a knowledge base update. If the TTL is set too short, the cache expires before it can be reused, saving little money. Set the TTL based on how frequently your business content changes, and periodically check the hit rate. Since vendor-specific rules for prefix cache trigger conditions and retention periods vary, consult the relevant documentation.
Context containing user privacy or sensitive data should never enter the cache. Cache retention policies must remain consistent with your data security guidelines.
Hit rate should be tracked separately by task type. An overall hit rate can hide the fact that a particular category of tasks rarely hits the cache at all.
How to Set Up Cost Monitoring
After going live, continuously collect input, output, and cached token usage, and aggregate these metrics by task type. Set up at least the following alerts:
- Alert when the P95 of per-task cost exceeds the budget line.
- Alert when the cache hit rate drops beyond a configured threshold.
- Alert when the failure-and-retry rate exceeds a threshold.
Each alert should have a designated owner and a handling deadline. Periodically regenerate the score-cost curve with fresh business data and adjust routing rules accordingly. Most major cloud platforms provide logging and alerting capabilities that can collect these metrics directly; the specific choice depends on your team’s existing tech stack.
Summary
The goal of cost optimization is not to minimize unit price, but to make per-task spending predictable and explainable while maintaining quality. If teams establish a representative task set, a consistent cost calculation methodology, and monitoring alerts, they can use real data to determine whether a price change or model migration is worthwhile.
