Token-Based Pricing and Model APIs
Model quality must be weighed against latency and cost, and the firmest requirements should be fixed first and used to filter candidates before softer goals are compared.
Why the Smartest Model Can Be the Wrong Choice
What do you think happens?
Imagine two candidate models. Model A gives excellent answers but users give up before it finishes responding. Model B answers quickly and well but costs so much per request that the product cannot pay for itself. Which one is a good choice?
Reveal answer
Neither. Each model is a poor choice even though its raw quality looks impressive on paper.
Evaluating a model means keeping three forces in view at the same time: the quality of what it produces, how long users wait for it, and what it costs to run. A strong result on one axis cannot excuse a failure on another axis the application depends on.
This article follows how those three forces interact and how to make a sensible choice among them. Quality, latency, and cost pull against one another in practice, and the best model for a given application is rarely the one that wins on every axis. Choosing a model is therefore less about finding the single strongest model and more about deciding which constraints are fixed and which are preferences, then selecting the model that fits the application's real needs.
Following One Response Through Time
Latency sounds like a single quantity, but for foundation models it is measured in several ways. Each metric captures a different part of the experience a user has while waiting, so the right one depends on what your application is trying to protect. A streaming chat interface cares a great deal about when the first words appear, while a batch report generator may care only about when the entire response is finished. The diagram below traces where each common metric starts and stops within a single response.
Read the timeline from left to right. The first interval is the wait before any output appears. The middle intervals describe the spacing of the tokens as they arrive. The final interval runs until the whole response is done. Each metric measures one of these stretches, which is why a single number can hide a problem that another metric would reveal.
What Drives Latency and How to Control It
Latency is not a fixed property of a model. It also depends on the prompt that is sent and on the sampling settings used to generate output. Since output length is a major driver, the most direct levers are the ones that control how much the model writes.
- Careful prompting can ask the model to be concise, which shortens the output and therefore the total wait.
- A stopping condition for generation can end the output at a defined point rather than letting it run on.
- Other optimization techniques can also reduce the time a response takes.
- In every case the aim is to control the latency that users actually observe, not an abstract benchmark number.
Weighing Several Objectives with Pareto Optimization
Optimizing several objectives at once is a field of study known as Pareto optimization. The core technique is to rank your objectives by how firm they are. A firm objective acts as a filter: any candidate that fails it is removed outright. Only after filtering do you compare the survivors on the softer objectives. This ordering matters, because it stops a strong result on one dimension from quietly excusing a failure on a dimension you cannot give up.
A useful habit is to ask, for every objective, whether it is a fixed requirement or a preference. Many teams, once they see the trade-off clearly, deliberately choose a model that is somewhat weaker in quality because it responds faster or charges less. Whether that trade is worth making depends entirely on what the application needs.
| Candidate | Quality | Time per query | Cost per request | Dominated? |
|---|---|---|---|---|
| Model X (generated example) | High | Slow | High | No, it is best on quality |
| Model Y (generated example) | Medium | Fast | Low | No, it is best on speed and cost |
| Model Z (generated example) | Medium | Slow | High | Yes, Model Y is at least as good on every axis and better on two |
A candidate is dominated when another candidate is at least as good on every objective and strictly better on at least one. Dominated candidates can be removed from consideration.
How Token Counts Set the Bill
If you call a model through an API, the provider usually charges by the number of tokens, counting both what you send in and what comes back. Every additional input token and every additional output token raises the bill. The diagram below labels which parts of a single exchange count toward the total.
Shortening an Answer Reduces the Total Token Count
A generated example: a support application sends 1,200 input tokens per request (instructions plus the customer message) and receives 300 output tokens. The team asks whether a more concise prompt that cuts the answer to 100 output tokens meaningfully changes the total billed tokens per request.
- 1Count the original total
Input and output tokens are both billed, so the original request totals 1,200 plus 300, which is 1,500 tokens.
- 2Count the revised total
The input is unchanged at 1,200 tokens, and the concise answer is 100 tokens, so the revised total is 1,200 plus 100, which is 1,300 tokens.
- 3Measure the change
The difference is 200 tokens. Since 200 divided by 1,500 is about 13 percent, the output reduction lowers the billed tokens per request by roughly 13 percent, even though the input was not touched.
- 4Check the latency effect
Because output tokens are generated one at a time, the same 200-token reduction also shortens the time per query, so one change helps both cost and latency.
Shortening the output lowers the bill and the wait at the same time. Trimming input has a similar effect on cost, but it does not shorten generation time in the same way.
API Access Versus Running Your Own Model
The source of cost depends on how the model is delivered. With a model API, the provider handles the infrastructure and bills you per token. If you host your own model, the picture changes. Apart from outside engineering cost, your main expense is compute, meaning the machines that run the model. Because machines come with fixed amounts of memory, there is a strong incentive to choose the largest model that fits on the hardware you already have. Memory sizes such as 16 GB, 24 GB, 48 GB, and 80 GB shape which models are practical, and this is one reason many popular models have roughly seven billion or sixty-five billion parameters.
| Question | Model API | Self-hosted model |
|---|---|---|
| What is the main cost driver? | Total input and output tokens | Compute, meaning the machines that run the model |
| Cost per token as volume grows | Stays fairly steady, so the total bill rises in direct proportion to usage | Can drop substantially, because compute spending is largely fixed once a cluster is in place |
| Who runs the infrastructure? | The provider | Your team |
| Key constraint at high volume | The service must be able to handle your volume at all | The hardware must have capacity for the model you choose |
| Is the decision permanent? | No, revisit it as usage changes | No, revisit it as usage changes |
Build-or-buy comparison. The cost structures differ mainly in how they scale with usage.
Scale changes which delivery approach is cheaper. Suppose you have already built a cluster able to serve one billion tokens a day. Whether you serve one million tokens or one billion, the compute cost is the same, so the per-token cost at the lower volume is far higher. At high volume the self-hosted option can become cheaper per token, but only if the usage actually arrives. Because the economics shift with scale, the choice between an API and self-hosting is not permanent, and companies need to reconsider it as their usage changes.
Writing Criteria Down and Choosing in Two Steps
Turning the three forces into something you can check requires writing criteria down. A criteria table lists each dimension, the metric used to measure it, a benchmark that supplies the test conditions, a hard requirement that a model must meet, and an ideal target that a model should aim for. The illustrative table below uses a fictional application so that the hard requirements and ideal targets sit side by side.
| Dimension | Metric | Benchmark | Hard requirement | Ideal target |
|---|---|---|---|---|
| Quality | Task accuracy | Internal task test set | Meets the agreed accuracy floor | Highest accuracy available |
| Latency | Time to first token | Standard load test | Users see the first words within the agreed limit | As low as possible |
| Latency | Time per query | Standard load test | Full response finishes within the agreed limit | Shorter, through concise output |
| Cost | Billed tokens per request | Typical request mix | Fits within the per-request budget | Lowest cost that keeps quality |
| Scale | Volume handled | Projected peak usage | Service can handle peak volume | Headroom above peak |
Illustrative criteria table for a fictional application. Every row names a benchmark so that two models are compared under the same test conditions.
Notice that each row names a benchmark. Two models can look different only because they were measured on different test sets, so the benchmark column is what makes the comparison fair. A factual consistency criterion, measured with an internal metric against an internal hallucination dataset, can be added the same way when accuracy is a concern for the application.
Once the criteria are written, selection proceeds in two stages. The first stage applies the fixed hard requirements as filters and removes any candidate that fails one. The second stage compares the survivors on the softer goals, placing them on a map whose axes are cost and performance, and picks the one that delivers the most performance for the money. The diagram below shows the path from criteria to a chosen model, including the return to the start when usage changes.
The process is more nuanced than two stages suggest, and it does not happen only once. When you use prompt engineering, you might begin with the strongest available model to test whether the task is feasible at all, then work backward toward smaller models to see whether they are good enough. When you finetune, you might begin with a small model so you can test your code cheaply, then move toward the largest model that still fits your hardware constraints, such as a single GPU.
Mistakes That Skew Model Choices
Common mistake Choosing the model with the highest quality score without checking latency or cost
What it looks likeA generated example: a chat product selects the most accurate model, and users abandon sessions before the reply finishes.
Why it failsA strong result on one axis cannot excuse a failure on an axis the application cannot give up.
Do this insteadWrite down which of the three forces are fixed requirements, filter on those first, then compare the survivors.
Common mistake Comparing models measured on different test sets
What it looks likeOne model's accuracy comes from an easy internal test, and the other's from a harder public one.
Why it failsTwo models can look different only because the test conditions differ.
Do this insteadUse one benchmark per criterion for every candidate, as the criteria table does.
Common mistake Counting only the prompt when estimating API cost
Why it failsAPI pricing counts both input and output tokens, so a long answer raises the bill as much as a long prompt does.
Do this insteadEstimate the total billed tokens per request, including the expected output length.
Common mistake Treating the build-or-buy decision as permanent
Why it failsSelf-hosted cost per token can fall as volume grows, while API cost per token stays fairly steady, so the best option can change with usage.
Do this insteadRevisit the API versus self-hosting decision whenever usage changes substantially.
Applying the Criteria to a Short Scenario
A generated scenario: a team builds an internal assistant. Requirements: the first words must appear quickly for a streaming interface, the answers must meet an agreed accuracy floor, and the monthly volume is modest and expected to stay flat. Candidate A is the most accurate but slowest. Candidate B meets the accuracy floor and streams quickly. Candidate C is cheapest but misses the accuracy floor. Using the two-step process, which candidates survive the hard requirements, and which of the survivors should the team compare on the soft goals?
Hints
- Start with the firm requirements. Any candidate that fails the accuracy floor is removed before anything else is compared.
- Check which requirement is a hard filter: the accuracy floor and the streaming responsiveness both sound firm, so decide which one the scenario states as a requirement.
- After filtering, compare the survivors on the softer goals, such as cost, to see which delivers the most performance for the money.
Key Takeaways
- Model quality must be weighed against latency and cost, and the firmest requirements should be fixed first and used to filter candidates before softer goals are compared.
- Latency has several metrics, including time to first token, time between tokens, and time per query, and each describes a different part of what a user waits through. Output length is a central driver because autoregressive models generate one token at a time.
- Pareto optimization ranks objectives by firmness, removes candidates that fail firm objectives, and compares the survivors on softer objectives so that one strong result cannot hide a failure elsewhere.
- API cost scales with total input and output tokens, while self-hosted cost is driven by compute and can fall per token as scale grows, so the build-or-buy decision must be revisited as usage changes.
- A criteria table with benchmarks and hard requirements, applied through a two-step selection process, makes model choices fair and checkable.