Token Efficiency: When the Expensive Model Ends Up Cheaper

APIFreeKeyAnthropic · Updated 2026-11-22 · 8 min read

One large truck versus many small vans making repeated trips
Fewer, fuller trips can cost less than many cheap ones.

Price lists suggest a simple rule: small models are cheap per token, big models are expensive, so route everything you can to the small one. Yet people who watch their usage meters closely keep reporting the reverse. A large model finishes a hefty refactor in a few clean passes, while a smaller or faster sibling chews through far more of the quota on the same job. Another common surprise is a simple planning task on a model router costing more than a dollar, because the agent quietly reread the project dozens of times.

This article explains where tokens actually go in agent work, why total tokens per finished task is the number that matters, and how to measure it for your own workload before you pick a model. It is written for builders on a budget who use Claude models, open models such as free-ai, or a mix of both.

Frequently asked questions

What does token efficiency mean for a model?

It is how many tokens a model consumes, input plus output, to reach an accepted result. A model with a higher per-token price can still be cheaper if it needs fewer attempts, fewer tool calls and shorter context.

Why would a smaller model use more tokens?

Smaller models more often take wrong turns, call tools redundantly, misread files and retry. Each extra step resends the growing conversation, so mistakes multiply input tokens quickly.

How does per-token price differ from cost per task?

Per-token price is what the vendor charges for one unit. Cost per task is price multiplied by everything the job consumed, including failed attempts. Only the second number tells you what a feature really costs.

Which is better for agents: one big model or routing between sizes?

Routing helps when tasks are clearly separable, such as cheap file summaries feeding an expensive planner. It backfires when the small model's errors force the big one to redo work. Measure both on real tasks.

Do subscription usage meters count tokens the same way as the API?

Not necessarily. Subscriptions often express usage as a share of an allowance whose exact formula is not public. Treat the meter as a relative signal and check the vendor's current documentation for details.

Does reasoning mode increase token usage?

Yes, reasoning produces extra hidden or visible tokens. On hard problems that extra thinking can prevent retries and lower the total, while on easy problems it is pure overhead.

Can a free model help me measure this?

A free endpoint is useful for measuring how many steps your agent loop takes and how big its context grows, at no cost. The step counts on a paid model will differ, so validate there before deciding.

Where the tokens in an agent run really go

In a single chat turn, output is a big share of the bill. In agent work, input dominates. Every tool call result, every file the agent opens and every previous message is sent again on the next turn. A task that takes forty turns resends the early context forty times. That is why one session can look tiny in output and huge in total.

Once you see agent cost as a sum over turns, the bigger-model paradox makes sense. Cutting the number of turns from forty to fifteen saves more than any difference in per-token price, because each saved turn removes a full copy of the context.

Context reloads

The conversation history is resent on every call. Long histories make every later step more expensive than the one before.

Tool output bloat

Search results, directory listings and test logs often land in context in full. A careless grep can add thousands of tokens that stay for the rest of the run.

Output tokens

Answers, code and reasoning traces. Usually a smaller slice in agents, but large when the model rewrites whole files instead of patching them.

Why stronger models often take fewer steps

A more capable model is more likely to pick the right file first, write a correct patch on the first try and recognise when the job is finished. Each of those saves a turn. A weaker model might open five files to find the one it needs, write a patch that fails the tests, read the failure, and try again. None of that is visible in the price table.

This is not a law. On simple, well-specified jobs, like converting a list of strings or summarising a short document, a small model finishes in one turn just like a large one and the per-token price wins outright. The gap appears on long, ambiguous, multi-file tasks, which is exactly where people notice it.

Fewer wrong turns

Better planning means fewer dead-end explorations that fill the context with irrelevant files.

Patches instead of rewrites

Stronger models more reliably edit only what changed, keeping output short and tests green.

Growing stack of repeated document copies beside a photocopier
Each agent turn resends the whole conversation.

Measure cost per accepted result

The honest comparison is cost per accepted result: total tokens for all attempts, divided by the number of outputs you actually kept. If one model needs three tries for every usable answer, its effective cost is triple the per-call figure. Track this on a small set of real tasks, not synthetic benchmarks.

Most OpenAI-compatible APIs, including the keyless one here, return a usage object with prompt and completion tokens for each response. Summing those across an agent run gives you the true footprint. The script below runs a task loop and totals tokens per attempt.

Count the retries

Log each attempt, including ones you threw away. Rejected outputs are part of the price of the accepted one.

from openai import OpenAI

client = OpenAI(base_url="https://api.apifreekeyanthropic.com/v1", api_key="none")

def run_task(prompt, max_turns=5):
    messages = [{"role": "user", "content": prompt}]
    total_in = total_out = 0
    for turn in range(max_turns):
        r = client.chat.completions.create(model="free-ai", messages=messages, max_tokens=800)
        total_in += r.usage.prompt_tokens
        total_out += r.usage.completion_tokens
        text = r.choices[0].message.content or ""
        messages.append({"role": "assistant", "content": text})
        if "FINAL:" in text:
            return turn + 1, total_in, total_out
        messages.append({"role": "user", "content": "Continue. Start the final answer with FINAL:"})
    return max_turns, total_in, total_out

turns, tin, tout = run_task("Plan the steps to add input validation to a small Flask form. Start the final answer with FINAL:")
print(f"turns={turns} input_tokens={tin} output_tokens={tout}")

Routing between model sizes, done carefully

Plugins and gateways that route easy steps to a small model and hard ones to a large model are popular, and the idea is sound: there is no reason to pay a flagship price to read a file or format a JSON blob. The catch is the hand-off. If the small model summarises a file badly, the large model plans on wrong information and may have to reread the original anyway.

Route by task type, not by guesswork. Mechanical steps with checkable outputs, like extracting function names or classifying a log line, are safe to send to a cheap model. Steps where a subtle error spreads, like deciding which module to change, are better left to the strongest model you can afford.

The hidden cost of a bad summary

A cheap model that drops one important detail from a file summary forces the planner to guess or reopen the file. If that happens on a third of the hand-offs, the routing savings shrink fast, and the extra rereads can make the mixed setup more expensive than sending everything to the large model from the start. Sample a few hand-offs by hand each week to see whether the summaries still carry what the planner needs.

  • Good for a small model: summarising a single file, reformatting data, writing boilerplate tests from a spec, labelling items.
  • Keep on the large model: multi-file planning, debugging unclear failures, reviewing security-sensitive code.
  • Always verify: give small-model outputs a cheap automatic check, such as a schema or a test, before passing them on.
Coins on a kitchen scale beside a calculator
Measure cost per accepted result, not per token.

Trim the context before switching models

Before concluding that you need a cheaper model, check whether you are paying for context you do not need. Many agent setups load enormous instruction files, keep full tool outputs forever, and never summarise history. Fixing those habits cuts tokens on every model.

Simple tactics work: truncate tool outputs to the relevant lines, summarise finished sub-tasks into a few sentences and drop the raw transcript, and keep standing instructions short. A short procedure file for recurring tasks, so the agent does not rediscover the same steps each time, is another easy win.

Cap tool output

Return the first and last lines of long logs plus a count, instead of the entire output. The model rarely needs more.

Summarise and reset

When a sub-task is done, replace its turns with a short summary. The next steps then start from a lighter context.

Reasoning tokens: overhead or savings

Reasoning modes add tokens per call, and on easy prompts they are wasted. On hard prompts they can save money by avoiding a wrong first answer that would trigger a retry. The keyless API here supports an optional "reasoning": true flag; when you use it, set max_tokens to 2000 or more so the thinking does not crowd out the answer.

A fair test runs the same hard task with reasoning on and off and compares total tokens per accepted result. If reasoning on gets it right first time and reasoning off needs two retries, the reasoning run is cheaper despite looking heavier per call.

When to switch it on

Multi-step logic, tricky bugs, and planning tasks. Leave it off for formatting, translation of short strings and simple lookups.

Railway junction splitting into two tracks
Routing helps only when the hand-off is reliable.

Where a free open model fits in this picture

The keyless free-ai model is an independent open-weight model of about 35B parameters. It is not a Claude model, and this site is not affiliated with Anthropic. Per token it costs you nothing, within the daily limits of 10,000 requests or 10,000,000 tokens per IP, so the cost-per-task question becomes a question of time and quality instead of money.

On short, checkable jobs it performs well. On long autonomous coding tasks a top commercial model will usually need fewer turns and make fewer mistakes, and in that case paying for it can be the efficient choice. A sensible split is to use the free model for the mechanical steps and development loops, and reserve paid credit for the planning-heavy steps. Our guide to making hackathon credits last shows this split in a time-boxed project, and rolling windows versus daily resets explains how quotas interact with long sessions.

A quick checklist before choosing a model on price

Price comparisons are only useful once you know your own workload. Spend an afternoon gathering numbers before committing to a plan or routing rule.

Watch the long tail

Averages hide the occasional runaway task that loops for an hour. Note the worst case for each model, not only the typical one.

  • Pick five to ten real tasks from your project, not toy prompts.
  • Run each on every candidate model and record turns, input tokens, output tokens and whether you kept the result.
  • Compute cost per accepted result using each vendor's current price page.
  • Trim context first, then rerun, because context bloat distorts every comparison.
  • Repeat after major model updates, since step counts change between versions.
Shears trimming a hedge into shape
Trimming context saves tokens on every model.
Try the free API

Send a first prompt from the chat box on the home page: no key, no account and no card, just your browser.

Read also