Research

The Cheapest Model Is Not the Cheapest Model

We built an evaluation harness around a production agent, tested models on the workload it performs, and cut inference cost by 86% while preserving reliability.

Inside the commission reconciliation platform we have built for a client, call them client X here, is an agentic feature that lets the user cross-verify their data, check corrections, and do whatever else is useful with it. One of the key problems we faced in delivering this service was that the cost of the model powering the agent quickly started to eat into the margins.

This is why it was difficult

The model we had chosen was a specific choice, and it gave the system the right capabilities at the right price at the time. The agentic feature was added in February, on Claude. By summer it ran on Claude Sonnet 5 with adaptive thinking and a one-hour prompt cache, and that is the configuration measured below. At the time it was the right choice, balancing cost, speed, data retention and developer velocity.

Sonnet was also the easiest choice, because we did not see the value in going for a less tested open model. Keep in mind that this was February. The GLM-5 report came out on 17 February, claiming state of the art on the major open benchmarks in its own abstract, and the open models that followed it through the spring were still to be proven on anything like our workload. Since then, the market of open models has grown greatly in count and quality.

So the agent for client X was ripe for a round of model choice optimization.

This is what we changed

The first requirement with this kind of system, which handles large amounts of sensitive data and needs a higher level of environmental control, is to consider which model API services meet the data retention requirements while also meeting the quality and cost targets that are the foundation of the work.

Through my experience with a wide range of providers, I do have a selected few. For the client X system I chose Baseten, which provides accounts with zero data retention out of the box. In addition to meeting the privacy requirement, Baseten brings up the latest models quickly and has run an inference service of the highest quality for years.

Beyond the provider comes the evaluation harness and the workload tasks to run each configuration against, to find the suitable choice. In the client X system we already had seven months of chat history in the database, about 400 user messages across 90 conversations, which we had access to and from which we could build the evaluations. This let us simulate the specific use cases accurately and find the exact tradeoff between cost, quality and intelligence.

The tests we created were mainly about the model using a SQL tool against a read replica of the customer database. The agent writes SQL, receives the result into a sandbox, and runs commands there to read and use the data. Other tasks were to process a pasted or uploaded file into the agent's sandbox, from where it uses the same commands to compare the file against database data, to check for differences or to help the user understand what they have.

The beauty of this kind of agentic system is that its outputs can be validated and checked. What this fundamentally means is that when testing a wide range of models, I can programmatically verify whether each model's output is correct. With that feedback loop in place, the model evaluations scale with much less work.

I designed the evaluations to work through the problems users had already used the system for, and to verify the agent's output against the data in the customer's database. The harness is 22 cases with deterministic gates: a figure resolved from the database at run time that must appear in the answer, a tool that must have been called first, a table that must reach the panel with the right row count, a write that must be proposed and never executed, Norwegian orthography that must survive. Six of the cases attach a file or a paste and run in the sandbox. Every case runs in-process against the same tools and the same prompt, and the eval runner records the tokens the provider reported and what they cost at list price.

Keep in mind that there are a lot of different model configurations. From the effort level (an approximation of the size of the reasoning budget), to which inference provider (and their model deployment configuration) is used.

In our comparison below we look at the previous model used for client X system, with the new model configuration, and comparing the costs before and after on the same cases.

In its production configuration: Sonnet 5 with adaptive thinking, and GLM-5.3-Flash on Baseten at max effort. GLM-5.3-Flash passed 62 of 66 runs across three first repetitions, succeeding once environment error was fixed.

Cheaper on all 22 cases, by 4.6 to 12 times a turn

Cheaper on all 22 cases, by 4.6 to 12 times a turn, Measured 9 September 202622 cases, two models, warm prefix One row per eval case, the median over runs. Cost is the provider's reported tokens at list price, with the shared prefix priced as a cache read on both sides, which is what a turn after the first in a session pays. The number after each row is the ratio between the two. The cost axis is logarithmic. Hover or tap a mark for its values. With the chart focused, use the left and right arrow keys to move between marks.$0.0002$0.0005$0.001$0.002$0.005$0.01$0.02$0.05110x1. agent-count, direct lookup. Flash, max $0.0008, Sonnet 5 $0.0082 warm, $0.0088 cold, with the cache write. 10x.210x2. empty-history-row, direct lookup. Flash, max $0.0011, Sonnet 5 $0.011 warm, $0.013 cold, with the cache write. 10x.311x3. period-total, direct lookup. Flash, max $0.0009, Sonnet 5 $0.0094 warm, $0.010 cold, with the cache write. 11x.410x4. agreement-not-found, direct lookup. Flash, max $0.0008, Sonnet 5 $0.0087 warm, $0.0087 cold, with the cache write. 10x.512x5. norwegian-orthography, direct lookup. Flash, max $0.0007, Sonnet 5 $0.0081 warm, $0.073 cold, with the cache write. 12x.611x6. auto-tier-knowledge, direct lookup. Flash, max $0.0005, Sonnet 5 $0.0052 warm, $0.070 cold, with the cache write. 11x.74.6x7. pension-formula, direct lookup. Flash, max $0.0013, Sonnet 5 $0.0060 warm, $0.071 cold, with the cache write. 4.6x.88.4x8. no-tool-narration, direct lookup. Flash, max $0.0010, Sonnet 5 $0.0086 warm, $0.074 cold, with the cache write. 8.4x.97.7x9. no-data-honesty, direct lookup. Flash, max $0.0013, Sonnet 5 $0.0098 warm, $0.075 cold, with the cache write. 7.7x.104.7x10. english-follows-user, direct lookup. Flash, max $0.0024, Sonnet 5 $0.011 warm, $0.078 cold, with the cache write. 4.7x.116.8x11. agreement-lookup-uses-tool, direct lookup. Flash, max $0.0017, Sonnet 5 $0.012 warm, $0.080 cold, with the cache write. 6.8x.127.0x12. auth-material-refused, direct lookup. Flash, max $0.0007, Sonnet 5 $0.0052 warm, $0.070 cold, with the cache write. 7.0x.139.3x13. users-are-out-of-scope, direct lookup. Flash, max $0.0007, Sonnet 5 $0.0063 warm, $0.071 cold, with the cache write. 9.3x.148.4x14. write-proposes-never-executes, direct lookup. Flash, max $0.0024, Sonnet 5 $0.020 warm, $0.088 cold, with the cache write. 8.4x.1511x15. write-flags-out-of-band, direct lookup. Flash, max $0.0012, Sonnet 5 $0.013 warm, $0.079 cold, with the cache write. 11x.167.7x16. top-agents-table, direct lookup. Flash, max $0.0020, Sonnet 5 $0.016 warm, $0.086 cold, with the cache write. 7.7x.178.2x17. semicolon-paste, paste or file, in the sandbox. Flash, max $0.0012, Sonnet 5 $0.010 warm, $0.077 cold, with the cache write. 8.2x.1810x18. tab-paste-total-row, paste or file, in the sandbox. Flash, max $0.0015, Sonnet 5 $0.015 warm, $0.085 cold, with the cache write. 10x.196.9x19. period-stays-put, paste or file, in the sandbox. Flash, max $0.0036, Sonnet 5 $0.025 warm, $0.094 cold, with the cache write. 6.9x.209.0x20. big-attachment, paste or file, in the sandbox. Flash, max $0.0011, Sonnet 5 $0.010 warm, $0.077 cold, with the cache write. 9.0x.217.4x21. synthetic-reconciliation, paste or file, in the sandbox. Flash, max $0.0036, Sonnet 5 $0.026 warm, $0.097 cold, with the cache write. 7.4x.226.2x22. pdf-statement, PDF statement, read by OCR. Flash, max $0.0027, Sonnet 5 $0.017 warm, $0.088 cold, with the cache write. 6.2x.Cost per turn (USD, log scale)

22 cases, two models, warm prefix One row per eval case, the median over runs. Cost is the provider's reported tokens at list price, with the shared prefix priced as a cache read on both sides, which is what a turn after the first in a session pays. The number after each row is the ratio between the two. The cost axis is logarithmic.

  • GLM-5.3-Flash at max effort, the model after it
  • Claude Sonnet 5, the model before the cutover
  1. agent-count, direct lookup. $0.0008 per turn against $0.0082, 10x.
  2. empty-history-row, direct lookup. $0.0011 per turn against $0.011, 10x.
  3. period-total, direct lookup. $0.0009 per turn against $0.0094, 11x.
  4. agreement-not-found, direct lookup. $0.0008 per turn against $0.0087, 10x.
  5. norwegian-orthography, direct lookup. $0.0007 per turn against $0.0081, 12x.
  6. auto-tier-knowledge, direct lookup. $0.0005 per turn against $0.0052, 11x.
  7. pension-formula, direct lookup. $0.0013 per turn against $0.0060, 4.6x.
  8. no-tool-narration, direct lookup. $0.0010 per turn against $0.0086, 8.4x.
  9. no-data-honesty, direct lookup. $0.0013 per turn against $0.0098, 7.7x.
  10. english-follows-user, direct lookup. $0.0024 per turn against $0.011, 4.7x.
  11. agreement-lookup-uses-tool, direct lookup. $0.0017 per turn against $0.012, 6.8x.
  12. auth-material-refused, direct lookup. $0.0007 per turn against $0.0052, 7.0x.
  13. users-are-out-of-scope, direct lookup. $0.0007 per turn against $0.0063, 9.3x.
  14. write-proposes-never-executes, direct lookup. $0.0024 per turn against $0.020, 8.4x.
  15. write-flags-out-of-band, direct lookup. $0.0012 per turn against $0.013, 11x.
  16. top-agents-table, direct lookup. $0.0020 per turn against $0.016, 7.7x.
  17. semicolon-paste, paste or file, in the sandbox. $0.0012 per turn against $0.010, 8.2x.
  18. tab-paste-total-row, paste or file, in the sandbox. $0.0015 per turn against $0.015, 10x.
  19. period-stays-put, paste or file, in the sandbox. $0.0036 per turn against $0.025, 6.9x.
  20. big-attachment, paste or file, in the sandbox. $0.0011 per turn against $0.010, 9.0x.
  21. synthetic-reconciliation, paste or file, in the sandbox. $0.0036 per turn against $0.026, 7.4x.
  22. pdf-statement, PDF statement, read by OCR. $0.0027 per turn against $0.017, 6.2x.

Saved data (JSON)

Cost per turn is where the two separate. The shared prefix, the system prompt and the tool definitions, is about 17,000 tokens on Sonnet and 11,000 on GLM. So most of the bill is the input tokens that get cached prefix. With the prefix served from cache (which is what an iterative agent loop does), the turns after the initial message is billed at, $0.012 per turn on Sonnet 5 and $0.0016 on GLM-5.3-Flash. That is a saving of 86% per turn, on every one of the 22 cases, GLM is cheaper by between 4.6 and 12.3 times.

The comparison harness starts a fresh conversation when running each case, which means that we loose out on the cache read for the first step. Priced that way the run cost Sonnet $1.48 against GLM $0.11, a saving of 98%. Running a cold (not cached) test is the honest bill for a workload of mostly one-turn conversations, and the 86% figure is the honest bill for a session that continues (warm, cache hit).

Faster on 15 of 22 cases, and seven times slower on one

Faster on 15 of 22 cases, and seven times slower on one, Measured 9 September 202622 cases, two models, wall time One row per eval case, the median wall time over runs from the question to the last token, tool calls and sandbox included. The number after each row is the ratio between the two. Hover or tap a mark for its values. With the chart focused, use the left and right arrow keys to move between marks.0102030405011.6x1. agent-count, direct lookup. Flash, max 2.2 s, Sonnet 5 3.6 s. 1.6x.21.6x2. empty-history-row, direct lookup. Flash, max 5 s, Sonnet 5 7.9 s. 1.6x.31.6x3. period-total, direct lookup. Flash, max 2.5 s, Sonnet 5 4.1 s. 1.6x.41.8x4. agreement-not-found, direct lookup. Flash, max 2.8 s, Sonnet 5 4.9 s. 1.8x.51.9x5. norwegian-orthography, direct lookup. Flash, max 4.1 s, Sonnet 5 7.9 s. 1.9x.61.3x6. auto-tier-knowledge, direct lookup. Flash, max 2.2 s, Sonnet 5 2.9 s. 1.3x.70.1x7. pension-formula, direct lookup. Flash, max 25 s, Sonnet 5 3.6 s. 0.1x.81.2x8. no-tool-narration, direct lookup. Flash, max 5.2 s, Sonnet 5 6 s. 1.2x.92.0x9. no-data-honesty, direct lookup. Flash, max 4 s, Sonnet 5 8 s. 2.0x.101.9x10. english-follows-user, direct lookup. Flash, max 3.7 s, Sonnet 5 6.9 s. 1.9x.110.8x11. agreement-lookup-uses-tool, direct lookup. Flash, max 8 s, Sonnet 5 6.6 s. 0.8x.120.7x12. auth-material-refused, direct lookup. Flash, max 6.4 s, Sonnet 5 4.5 s. 0.7x.131.3x13. users-are-out-of-scope, direct lookup. Flash, max 5.5 s, Sonnet 5 6.9 s. 1.3x.140.9x14. write-proposes-never-executes, direct lookup. Flash, max 14 s, Sonnet 5 13 s. 0.9x.151.4x15. write-flags-out-of-band, direct lookup. Flash, max 5.9 s, Sonnet 5 8.5 s. 1.4x.161.2x16. top-agents-table, direct lookup. Flash, max 5.7 s, Sonnet 5 7.1 s. 1.2x.171.0x17. semicolon-paste, paste or file, in the sandbox. Flash, max 27.3 s, Sonnet 5 27.3 s. 1.0x.181.2x18. tab-paste-total-row, paste or file, in the sandbox. Flash, max 28.4 s, Sonnet 5 32.8 s. 1.2x.190.8x19. period-stays-put, paste or file, in the sandbox. Flash, max 44.1 s, Sonnet 5 35.3 s. 0.8x.201.0x20. big-attachment, paste or file, in the sandbox. Flash, max 28.6 s, Sonnet 5 27.4 s. 1.0x.211.3x21. synthetic-reconciliation, paste or file, in the sandbox. Flash, max 38 s, Sonnet 5 47.6 s. 1.3x.221.1x22. pdf-statement, PDF statement, read by OCR. Flash, max 35.7 s, Sonnet 5 37.8 s. 1.1x.Wall time per turn (seconds)

22 cases, two models, wall time One row per eval case, the median wall time over runs from the question to the last token, tool calls and sandbox included. The number after each row is the ratio between the two.

  • GLM-5.3-Flash at max effort, the model after it
  • Claude Sonnet 5, the model before the cutover
  1. agent-count, direct lookup. 2.2 s against 3.6 s, 1.6x.
  2. empty-history-row, direct lookup. 5 s against 7.9 s, 1.6x.
  3. period-total, direct lookup. 2.5 s against 4.1 s, 1.6x.
  4. agreement-not-found, direct lookup. 2.8 s against 4.9 s, 1.8x.
  5. norwegian-orthography, direct lookup. 4.1 s against 7.9 s, 1.9x.
  6. auto-tier-knowledge, direct lookup. 2.2 s against 2.9 s, 1.3x.
  7. pension-formula, direct lookup. 25 s against 3.6 s, 0.1x.
  8. no-tool-narration, direct lookup. 5.2 s against 6 s, 1.2x.
  9. no-data-honesty, direct lookup. 4 s against 8 s, 2.0x.
  10. english-follows-user, direct lookup. 3.7 s against 6.9 s, 1.9x.
  11. agreement-lookup-uses-tool, direct lookup. 8 s against 6.6 s, 0.8x.
  12. auth-material-refused, direct lookup. 6.4 s against 4.5 s, 0.7x.
  13. users-are-out-of-scope, direct lookup. 5.5 s against 6.9 s, 1.3x.
  14. write-proposes-never-executes, direct lookup. 14 s against 13 s, 0.9x.
  15. write-flags-out-of-band, direct lookup. 5.9 s against 8.5 s, 1.4x.
  16. top-agents-table, direct lookup. 5.7 s against 7.1 s, 1.2x.
  17. semicolon-paste, paste or file, in the sandbox. 27.3 s against 27.3 s, 1.0x.
  18. tab-paste-total-row, paste or file, in the sandbox. 28.4 s against 32.8 s, 1.2x.
  19. period-stays-put, paste or file, in the sandbox. 44.1 s against 35.3 s, 0.8x.
  20. big-attachment, paste or file, in the sandbox. 28.6 s against 27.4 s, 1.0x.
  21. synthetic-reconciliation, paste or file, in the sandbox. 38 s against 47.6 s, 1.3x.
  22. pdf-statement, PDF statement, read by OCR. 35.7 s against 37.8 s, 1.1x.

Saved data (JSON)

Speed went the same way for most of the set. GLM-5.3-Flash was faster in 15 of the 22 cases, with a median of 5.8 seconds versus 7.5, and the difference on direct lookups was about a second and a half. GLM was slower on seven cases, and badly so on one: a formula question that Sonnet answered in 3.6 seconds took GLM 25 seconds at max effort, almost all of it spent reasoning. That is one downside of running GLM at max effort.

A practical solution to that would be to configure a timeout on each API call so that, if the model exceeds X seconds, a new API call immediately fires at a lower reasoning level. Given GLM’s lower cost, this is a pragmatic way to eliminate pathological over-reasoning. The obvious qualification is the task itself: if it genuinely requires the additional reasoning time, then permit it.

We have so far discussed only two models, Sonnet and GLM 5.3 Flash. This is after having iterated the evaluations over the models and configurations available. I converged on GLM-5.3-Flash as the suitable option for this workload.

The larger open model costs 1.6 times Sonnet 5 a turn and passes fewer gates

The larger open model costs 1.6 times Sonnet 5 a turn and passes fewer gates, Measured 9 September 20265 configurations, one harness Each point is one model at one reasoning setting over the whole case set: the mean warm cost per turn against the median wall time. The count beside each point is the gates passed over the cases run. Repetitions are counted as separate runs. Hover or tap a mark for its values. With the chart focused, use the left and right arrow keys to move between marks.Median wall time (seconds)051015$0.001$0.002$0.005$0.01$0.02Claude Sonnet 5, adaptive thinking. $0.012 per turn warm, $0.067 cold, with the cache write. 7.5 s median. 22 of 22 passed.Sonnet 5, 22/22GLM-5.3-Flash, max effort. $0.0016 per turn warm, $0.0016 cold, with the cache write. 5.8 s median. 62 of 66 passed.Flash, max, 62/66GLM-5.3-Flash, high effort. $0.0012 per turn warm, $0.0012 cold, with the cache write. 3.3 s median. 61 of 66 passed.Flash, high, 61/66GLM-5.3-Flash, low effort. $0.0012 per turn warm, $0.0012 cold, with the cache write. 2.5 s median. 63 of 66 passed.Flash, low, 63/66GLM-5.3, max effort. $0.019 per turn warm, $0.019 cold, with the cache write. 12.6 s median. 39 of 44 passed.GLM-5.3, max, 39/44Mean cost per turn (USD, log scale)

5 configurations, one harness Each point is one model at one reasoning setting over the whole case set: the mean warm cost per turn against the median wall time. The count beside each point is the gates passed over the cases run. Repetitions are counted as separate runs.

  • Claude Sonnet 5, adaptive thinking. $0.012 per turn warm, $0.067 cold, with the cache write. 7.5 s median. 22 of 22 passed, 100%.
  • GLM-5.3-Flash, max effort. $0.0016 per turn warm, $0.0016 cold, with the cache write. 5.8 s median. 62 of 66 passed, 94%.
  • GLM-5.3-Flash, high effort. $0.0012 per turn warm, $0.0012 cold, with the cache write. 3.3 s median. 61 of 66 passed, 92%.
  • GLM-5.3-Flash, low effort. $0.0012 per turn warm, $0.0012 cold, with the cache write. 2.5 s median. 63 of 66 passed, 95%.
  • GLM-5.3, max effort. $0.019 per turn warm, $0.019 cold, with the cache write. 12.6 s median. 39 of 44 passed, 89%.

Saved data (JSON)

The effort setting is another axis the evaluation measures. On direct lookups, GLM-5.3-Flash at low effort responds in a median of 2.2 seconds versus 5.0 at max, spends 14 reasoning tokens per turn versus 711, and costs $0.0012 per turn versus $0.0016. High effort sits between the two.

GLM-5.3 at max effort (the larger sibling of GLM-5.3-Flash, fallback behind Flash in production) passed 39 of 44 runs, took a median of 12.6 seconds, and exceeded the two-minute budget on both runs of the largest sandbox case. At $0.019 per turn, it cost 1.6× as much as Sonnet 5 on a cached prefix and 12× as much as Flash.

This exposes a distinction that headline API prices hide. Sonnet 5 costs $2 per million input tokens and $10 per million output tokens, compared with $1.40 and $4.40 for GLM-5.3. On paper, GLM is cheaper. But on the largest sandbox case, running the models side by side reverses that relationship: GLM-5.3 costs 1.6× more per turn than Sonnet 5.

An evaluation harness is what lets us measure the practical cost of a model rather than infer it from the price of its tokens.

This is why that intervention worked

This cost reduction is possible because of the accelerating capabilities of open models, and because the bounded data on the existing user tasks allows a programmatic feedback loop that makes the model's output verifiable. That is different from a qualitative task, like the creation of a design or a website, which is much harder to quantify or validate because its output is judged by a person's opinion of its quality.

I believe that spending time understanding the evaluation harness as fully as possible, and considering creative ways to build feedback loops that validate a model's performance on a system, is very high value work. It is the precedent that allows every downstream evaluation of a model configuration.

When I have an evaluation that can be programmatically verified, I can scale the number of samples. More samples give higher resolution, because the distance between what was observed and what is inferred from it shrinks. Through such feedback loops I reach the scale at which I can make informed judgements about which model achieves the best outcome. On this set, three repetitions were enough to find that one failure was a provider defect that recurs on every run, and that another was a reasoning budget that occasionally overruns.

This is the measurable result

Measuring the v1 system against the optimized v2, the cost per simulated user task fell by 86% on a continuing session and by 98% on a fresh one, while the answers stayed accurate and reliable. Through the harness, the savings were low-hanging fruit, readily available to collect.

The greater picture is that open models are now cheap, fast and reliable enough that most of the workloads we run could be moved to them, for a more economically effective system overall.

One of the greater potentials here is the increase in margin, which can be used in two ways: retained, or reinvested in a more expensive open model. Since we have cut the cost of using a closed model, that capital is freed and could be spent on a more intelligent model at the same cost. That is an appealing option if users start doing more complex tasks and the cheaper model falls short. The margin can then be used to step up the model on those tasks, to increase the probability of success.

I enjoy this kind of discovery because it reveals that potential of a system needs to be modelled and discovered. The reward is greater operational efficiency.

Sources and measurement

Every number above comes from the platform's own eval harness, run on 9 September 2026 against a branch of the customer database, and the per-case results are in the dataset. The answers, the tool arguments and the progress labels are not in it, because they can carry figures from the customer's data. Nothing in the dataset names the client, a user or an agreement.

Prices are list prices read from the providers on the same day: Anthropic's pricing page for Sonnet 5, at $2 per million input tokens, $4 for a one-hour cache write, $0.20 for a cache read and $10 per million output, and Baseten's models endpoint for GLM-5.3-Flash, at $0.15 per million input, $0.03 cached and $0.50 output. Reasoning tokens are billed as output on both. The cost in the figures is the provider's reported usage at those prices, with the prefix on Sonnet priced as a cache read. The cold figures price the cache write the harness actually paid.

Sonnet 5 ran once over the 22 cases. The remaining cells ran two or three times each, and a case's figure is the median over its runs. Wall time is measured from the question to the last token and includes tool calls, database queries and the sandbox.

The figures are also available as images under /research/model-selection/, with SVG originals and a manifest recording the dataset hash.

This is the kind of work we do at Kylace: evaluate and improve AI workloads against the requirements that matter for the system. We test changes across models and the wider system on the actual work, then turn the results into a reusable evaluation and a recommendation your team can act on.

Next: When Does Owning Inference Pay?