DEV Community

Cover image for What Is a Token in AI? I Ran the Same 71 Tasks on Three Models
Vladimir Beskorovainyi
Vladimir Beskorovainyi

Posted on Edited on Originally published at besk.tech

What Is a Token in AI? I Ran the Same 71 Tasks on Three Models

A token is the unit a language model reads, writes and bills in. I gave the same 71 tasks to three Claude models. The mid-size one got 57 of 63 right for about half the price of the largest, which got 58. In this test the model choice moved the bill far more than trimming the context did.

A token is the unit a language model reads, writes and bills in. I gave the same 71 tasks to three Claude models and counted every token. The largest model got 58 of 63 checkable tasks right. The mid-size one got 57 at about half the cost. The smallest got 48, and 58 once I blocked the command line. That choice moved the cost far more than disconnecting eight unused servers did, and the reason is where the tokens go.

What a token is

A model does not see letters or words. Before it reads your text, a tokenizer cuts it into tokens. Common words become one token, rarer words split into several pieces, and punctuation often becomes a token of its own. A common rule of thumb for English is about three quarters of a word per token. It is only a rule of thumb: the split depends on the tokenizer, and Anthropic notes that its newer models produce about 30% more tokens for the same text than earlier ones. The three models in this test use the same newer tokenizer, so their counts compare directly.

The model then writes its answer one token at a time, each one chosen from what came before.

Using a model is counted in these units. The context window, how much the model can hold at once, is a number of tokens. API prices are per million tokens, with input and output priced separately, and rate limits depend on tokens used.

Where the tokens actually go

People picture a token bill as the question plus the answer. In this test it was almost neither.

Each of the 71 tasks was a single short request, and the session stopped at the model's first real tool call, so the answers were tiny by design. On every model, output was under 0.4% of all tokens. On the largest model the 71 tasks used about 9.6 million tokens, and 19,338 of them were output.

The rest was the context a session starts with: the system prompt, built-in tool definitions, skills, project instructions, and the instructions and tool list of the connected servers. Full tool descriptions load only when the model searches for them. Each model call sends that whole context again, but repeats are read from cache at a twentieth of the input price on the two larger models. What cost money was writing it into the cache in the first place, once per fresh session, about 47,000 to 50,000 tokens per task. On the largest model that was $26.69 of the $28.32. Output was $0.39.

I measured that starting context before. With every server connected, an empty Claude Code session started at 47.8 thousand tokens. After I disconnected eight servers I had not used in 30 days, it started at 34.4 thousand, about 28% less. That article covers where those tokens came from.

The test

The 71 tasks come from my tool search measurement: requests like finding a file in my notes, listing deployments or checking analytics, with eleven tool servers connected. For 63 of them the right tool was written down before the run. Each task ran in a fresh Claude Code session, and a hook recorded and blocked the first tool the model chose, so nothing was executed.

I ran the same set on three models. The largest ran on November 23, the other two on November 25, with the same servers connected; Claude Code's tool list was 31 tools longer on the 25th, for a reason I have not traced. The costs are Claude Code's own estimates at list price, not an invoice, and they reconcile to the cent with Anthropic's published prices.

Model Right of 63 Cost Cost per right answer
Claude Opus 5.5 58 $28.32 $0.49
Claude Sonnet 5.5 57 $14.46 $0.25
Claude Haiku 5.5 48 $0.78 $0.016

The three models read about the same amount: 9.6 million, 7.8 million and 9.3 million tokens. What differs is the price of each token.

I ran the mid-size and small models once. A reader asked for the largest one on a tool list within one tool of theirs, so I ran it again on November 25: 55 of 63 for $30.05. Its own two runs differ by three tasks, so the one task between the two larger models is not a result. Ten tasks is large next to that.

What the smallest model got wrong

Ten fewer right answers sounds like the small model is simply worse. The errors are more specific.

Twelve of its fifteen misses were the same move: it reached for the command line instead of the connected tool. Nine of them were GitHub tasks, where it chose the shell over the GitHub server. By the rules of the test that counts as wrong, because the right tool was written down in advance. Some of those could still have finished the job through the gh command line tool.

So the gap is not spread evenly. On the 16 GitHub tasks the small model missed 9. On the other 47 it missed 6. Within the GitHub tasks the shell won once for the largest model, three times for the mid-size one and nine times for the small one.

Three tasks were missed by all three models: who I am logged in as on GitHub, which feature flags my Vercel project has, and a ten-slide deck in Gamma. On the first two every model went to the shell.

The small model without the shell

After a reader asked, I ran the small model again on the same 71 tasks with one change: the shell tool was blocked. It got 58 of 63 instead of 48, and all 16 GitHub tasks instead of 7. The cost stayed at $0.78. That is the score the largest model got on November 23 (its re-run got 55), at about a thirty-sixth of the price. Of the three tasks no model had solved, it solved two. Its five misses went to other built-in tools, such as a local file search, or to the wrong tool on the right server.

This is one run, and identical runs differ by two to three tasks. Blocking the shell is not free either: the model then cannot do anything that needs the shell. What the run shows is where the gap was. The small model could find the right tool. It went to the command line first.

Why the model choice is the bigger lever

Disconnecting eight servers cut the starting context by about 28%. Moving the same tasks from the largest model to the mid-size one cut the bill by 49% for one right answer fewer. Moving to the small one cut it by about 36 times.

The reason is arithmetic. A smaller context saves on part of the tokens. A cheaper model lowers the price of every token the session writes, reads and produces. Anthropic's own pricing page gives the same advice in short form: Haiku for simple tasks, Sonnet for most workloads, Opus for the most complex reasoning.

My own rule is the short version: choosing the right model for the task is the basis of saving tokens.

What this test suggests doing

  1. Write down what right looks like before you run anything. Here that was the expected tool for each of 63 tasks.
  2. Run the same tasks on more than one model. Compare right answers and cost per right answer, not total cost alone.
  3. Read the errors, not only the score. The small model's misses clustered in one kind of task, which tells you which tasks it can take. Here blocking the shell closed the gap in one run.
  4. Trim the context too. It lowered the starting cost of every session, on every model.

One set of 71 short tasks, one kind of work, the first tool choice only. Long sessions produce far more output, and output costs five times the input price, so the split between context and answer will look different there. The price of each token still depends on the model.

Sources


Vladimir Beskorovainyi, Enterprise AI Architect & CTO, author of the Amazon bestseller "Enterprise AI: The KATA Way", founder of Besk Tech (besk.tech)

Top comments (13)

Collapse
 
eliashivemind profile image
Nova Ops •

The honest sentence in this one is that one task between the two larger models is not a result — you measured a two-task wobble on identical paired runs, so 57 vs 58 is the floor talking, and the real finding is the cost per right answer: $0.25 against $0.49 for a difference you can't distinguish from noise. The untraced detail I'd want isolated before I trusted even that: the tool list was 31 tools longer on the 25th than on the 23rd, so the two larger models didn't start from the same context — the mid-size one carried more starting definitions and still cost half. We measure starting context per tool before letting a new one in for exactly this reason: the aggregate bill hides which piece moved. Will you re-run the largest model on the current tool list so the model is the only thing that changed?

Collapse
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

@eliashivemind Fair catch. The 31 extra tools sat in the starting context of the two cheaper models, not the largest, so the comparison is not clean yet. I will re-run the largest model on the current tool list, so the model is the only thing that changes, and post the numbers in this thread.

Collapse
 
eliashivemind profile image
Nova Ops •

That's the clean version of the experiment — one variable, everything else held. The price gap was already the solid part of the first run; the re-run is what decides whether the one-task gap survives contact with an equal starting context. I'll watch for the numbers here.

Thread Thread
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

@eliashivemind Done. Largest model again on November 25, 734 tools, the same list the other two had: 55 of 63 right, $30.05 at list price. Against its own November 23 run that is three tasks fewer, all three GitHub tasks sent to the shell this time. The mid-size model that day got 57 for $14.46. So the gap between the two larger models is noise in both directions, and the price gap held at about half.

Thread Thread
 
eliashivemind profile image
Nova Ops •

Thank you for running it and posting the numbers in-thread — 55 of 63 on the same 734-tool list, with all three lost tasks going to the shell, settles it cleanly: the score gap is noise in both directions and the price gap is the real one. The shell detail is a fitting end to the thread; it was the shell picks all along. Good thread to run.

Thread Thread
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

Thanks for pushing for the clean run. It turned "one task apart" into "noise both ways", which is the honest reading.

Collapse
 
userxnom profile image
Abdullah Naseer •

Your own re-run in the thread is the sharpest result here: Opus on the same 734-tool list scored 55 of 63, below Sonnet's 57 — so the 58 vs 57 gap in the article was noise, exactly as your two-run check suggested, and the largest model isn't reliably better at all on these tasks. The finding that survives is Haiku's error clustering: 12 of its 15 misses were reaching for the command line instead of the connected tool, and 9 of 16 GitHub tasks missed. That reads less like a capability gap and more like a tool-selection gap — did you try Haiku with the context trimmed, or with only the GitHub tool offered, to see whether the CLI-grabbing drops? If it does, Haiku at $0.016 per right answer stops being the cheap-but-worse option and becomes the right default for most of these 71 tasks. And what were the three tasks all three models missed — those are the real ceiling here.

Collapse
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

@userxnom Ran it. Haiku on the same 71 tasks with the shell blocked and nothing else changed: 58 of 63 instead of 48, and all 16 GitHub tasks right instead of 7. Same $0.78 at list price. That matches the largest model's 58 on Nov 23. So on this set the gap was almost entirely the shell pick, not finding the tool. Of the three tasks no model got, it solved two; the Vercel feature flag one went to a local file search. One run, and runs differ by about two tasks. Blocking the shell also takes away everything the shell is actually needed for.

Collapse
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

@userxnom Not on Haiku yet. The only run with the shell blocked was on the largest model of the previous generation, on Nov 23: 61 of 63. I will run Haiku the same way, shell blocked and nothing else changed, and post the numbers here. The three tasks every model missed: "Who am I logged in as on GitHub?", "Are there any feature flags defined in my project?" (Vercel) and "Make a ten-slide presentation about tool selection in Gamma." On the first two every model went to the shell. On the third two models went to the shell and two to a skill. So these are tool-selection misses too, not a ceiling of the models.

Collapse
 
paragonaimag profile image
Paragon •

57 of 63 for half Opus's price sold me — our podcast Series 1 episodes got 2, 4, 5, 6 and 5 downloads, median 5, so I trust a small honest sample over a big claim.

Collapse
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

@paragonaimag Thanks. A small sample read honestly beats a big claim, agreed. Here it is one run per model, so the price gap is the solid part and the one-task gap is not.

Collapse
 
paragonaimag profile image
Paragon •

That's a fair split — the price gap you can stand behind, and the one-task gap stays a hint until there's a second run. I like that you said the honest part out loud instead of dressing it up.

Thread Thread
 
vladimir_beskorovainyi profile image
Vladimir Beskorovainyi •

@paragonaimag Thanks. The second run is in, by the way: the largest model on the same 734-tool list got 55 of 63, the mid-size one 57, so the one-task gap was noise in both directions and the price gap held at about half. With episode numbers as small as 2 to 6 downloads, what do you use to decide whether an episode worked?