Skip to content

Cost and FinOpsMethodology

Switching models changes the tokenizer: how much does your bill move?

A forecast built from list prices per million tokens assumes a million tokens means the same amount of your text on both models. It often does not. This method measures your own prompts under each provider's counter and turns the gap into a correction factor finance can apply.

By INFRO Editorial

Published

9 min read

Glowing token streams being compressed into a precise efficient AI infrastructure pipeline

In short

Measure the same prompts and outputs with each target model's own counting method, take the ratio per workload slice, and weight it by the input and output share of the new cost. That weighted ratio is the correction factor to multiply into a list-price forecast.

Key takeaways

  • A list price per million tokens is a price per million of that model's tokens, so two models with equal rates can cost different amounts for the same text.
  • Count the same real payloads with each target's own counting method, per workload slice, and keep input and output ratios separate.
  • The correction factor is the input ratio and output ratio weighted by their shares of the cost at the new rates.
  • Tokenizer drift is only one term: output length, caching and length-based price thresholds move the bill separately, so measure them as separate factors.
  • Treat the pre-switch factor as a forecast and replace it with the factor computed from provider-reported usage after a canary.

Why a list price per million tokens is not a unit price

A model-switch forecast usually looks like this: take last month's input and output token totals, multiply by the new model's rates per million tokens, compare to the current bill. The arithmetic is fine. The inputs are not, because last month's totals were produced by the current model's tokenizer, and the new model will cut the same text into a different number of tokens.

A token is a unit of a specific tokenizer. INFRO's earlier analysis of billing units cites Anthropic's pricing page for the statement that Claude 4.7 and later models use a newer tokenizer that produces approximately 30% more tokens for the same text, with the exact increase depending on content and workload shape.1 Two models with identical published input rates are therefore not the same price per unit of your text if one of them cuts your text into more units. That article makes the point; this one supplies the measurement procedure it leaves open.

The goal is one number per workload: a correction factor you multiply into the naive list-price forecast. It is built from three measured quantities per slice of traffic: the input-token ratio, the output-token ratio, and the share of cost each side carries at the new rates.

What to measure, and what not to fold in

The bill ratio between two models is a product of several separate effects. Mixing them makes the result impossible to debug later.

FactorWhat moves itMeasured by
Rate ratioNew model's list rates against current effective ratesRate tables, your contract
Tokenizer factorSame text, different token countsThis method
Behavior factorDifferent answer length, reasoning or thinking volumeA replay of real prompts on the candidate
Cache factorHit rate, write premium, read multiplierProvider-reported cache fields
Threshold factorRates that change with prompt lengthDistribution of counted prompt sizes
five terms that make up the bill ratio of a model switch. Only the second is a pure tokenizer effect.

Keep the tokenizer factor pure. It answers one question: if the candidate produced exactly the text the current model produces, and read exactly the payloads you send today, how many tokens would each side bill? Anything about the candidate writing longer or shorter answers belongs in the behavior factor, which needs real generations and is covered in reasoning tokens and their cost.

Step 1: build a corpus that carries the whole payload

Sample real requests and keep the full payload, not just the user text: system prompt, tool and schema definitions, message history, and any documents. Counting only the text a user typed underestimates input, because system prompts, tools and message framing are billable input too.2

Then partition the sample into slices that tokenize differently. A workable starting set:

  • Short conversational turns with a large shared system prompt.
  • Retrieval prompts with long prose context.
  • Code in the languages you actually use.
  • Structured data: JSON, tables, logs.
  • Tool-heavy requests with many function schemas.
  • Non-English text, per language that matters to your volume.

Store the observed output of the current model beside each prompt. You need it in step 3. Aim for slices large enough that the ratio stops changing when you add samples, and weight each slice by its share of last month's token volume when you aggregate.

Redact before you copy. The corpus is production prompts, so it falls under your payload logging policy, not under a convenience script.

Step 2: count each payload with each target's own method

A local tokenizer counts plain text and misses roles, tools, images and files, so use each provider's counting endpoint on the exact payload you would send. INFRO's counting guide lists OpenAI's POST /v1/responses/input_tokens, Anthropic's POST /v1/messages/count_tokens and Gemini's countTokens.2 Anthropic's endpoint accepts the same structured inputs as message creation, including system prompts, tools, images and PDFs, and returns the total input tokens.3 Anthropic describes counting as a way to manage costs and make model routing decisions, which is the use here.3

Three cautions from the same sources:

  • Anthropic says the real input count may differ by a small amount from the estimate.2 Treat ratios as accurate to a few percent, not to the token.
  • Anthropic's endpoint refuses some inputs: server tools, the MCP connector, and media given by URL or file id.2 Slice those requests out and measure them from real usage instead.
  • Counts belong to a model. Count against the exact model id you plan to use, and recount when a new generation appears.2
count_ratio.py
from openai import OpenAI
import anthropic
from google import genai

oa, an, gg = OpenAI(), anthropic.Anthropic(), genai.Client()

def count_openai(model, payload):
    r = oa.responses.input_tokens.count(
        model=model,
        instructions=payload["system"],
        input=payload["messages"],
        tools=payload.get("tools_openai", []),
    )
    return r.input_tokens

def count_claude(model, payload):
    r = an.messages.count_tokens(
        model=model,
        system=payload["system"],
        messages=payload["messages"],
        tools=payload.get("tools_claude", []),
    )
    return r.input_tokens

def count_gemini(model, payload):
    r = gg.models.count_tokens(model=model, contents=payload["gemini_contents"])
    return r.total_tokens

COUNTERS = {"current": count_claude, "candidate_a": count_openai, "candidate_b": count_gemini}
# one row per payload: slice, tokens per target; ratios are computed per slice

Each provider wants its own request shape, so the corpus needs one adapter per target that maps the stored payload to that shape. Keep the adapters in version control; a wrong adapter silently drops tools or history and biases the ratio low.

Step 3: count the outputs the same way

No endpoint counts generated output, because generation has not happened yet.2 But the text of an output you already hold can be counted. Send the stored output of the current model to each target's counting method as a single message, then subtract the count of a one-character message to cancel the fixed framing. The remainder is the output-side token count for that text under that tokenizer, to within a token or two.

This gives an output ratio for identical text. It is a different number from the input ratio, because outputs are mostly prose or the structured format you asked for, while inputs carry system prompts and tool schemas. Do not assume one ratio covers both: the sections below keep them separate, and the weighting step depends on it.

If a candidate emits reasoning or thinking tokens, the stored text will not include them. That volume is the behavior factor, not part of this ratio.

Step 4: compute ratios and the correction factor

For each slice, compute

  • r_in = tokens_in(candidate) / tokens_in(current) over the slice's payloads.
  • r_out = tokens_out(candidate) / tokens_out(current) over the slice's stored outputs.

Aggregate by volume weight. Then price both ways with the candidate's rates:

  • Naive cost N = T_in × P_in + T_out × P_out, using last month's token totals T from the current model.
  • Corrected cost C = T_in × r_in × P_in + T_out × r_out × P_out.
  • Correction factor CF = C / N = a × r_in + (1 − a) × r_out, where a = T_in × P_in / N is the input share of the naive cost at the new rates.

The weight a is why the factor depends on the rate card as well as on the tokenizer. A model with expensive output makes r_out count for more; one with a cheap output rate makes r_in dominate.

Report the factor per slice as well as in total. If tool-heavy requests carry a ratio of 1.4 and short chats 1.1, finance can see which product feature absorbs the movement, and the engineers can see where trimming schemas pays.

Step 5: check for threshold crossings

A token-count ratio above 1 does more than scale cost linearly. Some rates are set by prompt length, and a larger count can push a request across the line. Per Anthropic's rate table, Claude Haiku 5.5 is priced at $0.10 per million input tokens for prompts up to 100K tokens and $0.50 above that, with output at $0.50 and $2.50 respectively.4 INFRO's earlier article lists similar thresholds at OpenAI above 272K input tokens and Gemini 3.1 Pro above 200K, and notes a request over the line is re-priced as a whole.2

So take the histogram of counted prompt sizes per slice, apply r_in, and count the share of requests that now land above a threshold on the candidate. A request that was 90K tokens on the old tokenizer and is 117K tokens on the new one changes price tier, not just count.

Step 6: normalize caching before you compare

If your corpus replays real usage, make sure the cache fields are normalized per provider before computing totals. Anthropic reports cache reads and writes outside input_tokens, so the total is the sum of three fields; OpenAI reports cached tokens as a subset inside the input total.1 Add them wrongly and you double-count or drop the cached prefix, which changes T_in and every ratio built on it.

The counting endpoints give an uncached count. Apply the cache factor separately: your observed hit rate, the target's read multiplier, and its write premium. Anthropic's rate table shows how much these differ even inside one family: Sonnet 5.5 lists cache reads at $0.10 and writes at $2.50 per million against $2 input, while Opus 5.5 lists $0.20 and $5 against $4 input.4 A cached prefix that grows 28% under a new tokenizer grows 28% in its write cost as well.

Step 7: replace the forecast with a measured factor

The pre-switch factor is an estimate from a sample. After a canary on real traffic, compute the same ratios from provider-reported usage: tokens billed per request for the candidate, against the corpus's current-model counts for the same prompts. If the two factors differ by more than the sample's noise, the corpus is unrepresentative, and the usual cause is a slice you under-sampled.

INFRO records each request's token or unit counts and an estimated provider cost, as your provider reports it, and estimates what the provider will bill.5 That per-request record, queryable by model and project, is the data for the post-canary factor; the estimate for a request before it is sent is documented under billing (opens in a new tab).6 If your contract carries negotiated rates, enter them so the estimate uses them ahead of list rates, and reconcile against the provider's own cost reports so a persistent gap is attributed rather than guessed at. The tokenizer factor is a count-side correction; it does not replace a rate-side one. INFRO takes 0% of model spend, so none of this changes what your provider invoices.6

A checklist for the review:

  • Corpus carries full payloads, with PII handled per policy.
  • Slices cover prose, code, structured data, tools and each major language.
  • Each target counted with its own method on its own request shape.
  • Input and output ratios computed separately, per slice and volume-weighted.
  • Correction factor computed with the candidate's rates, not the current ones.
  • Threshold crossings estimated from the prompt-size histogram.
  • Token-denominated limits converted.
  • Behavior and cache factors reported as their own lines.
  • A date set to recompute the factor from real usage after the canary.

For the broader question of what else a per-token estimate cannot produce, see tokens are not the unit you are billed in; for counting mechanics, see how to count tokens before you call the API.

Questions readers ask

Can I use one provider's tokenizer to approximate another's?
Only as a rough lower-bound sizing aid. The ratio between two tokenizers depends on your content: prose, code, JSON, non-English text and tool schemas each move differently, which is why the method measures per slice with each target's own counting method.
How many prompts do I need in the sample?
Enough per slice that the ratio stops moving when you add more. Compute the ratio on growing subsets and stop when it is stable to the precision finance needs; a slice that stays noisy is a slice to sample more, not to average away.
Does the correction factor apply to image, audio or video inputs?
Not as a tokenizer ratio. Those inputs are counted by each provider's own rules, so measure them with the counting endpoint on real files as their own slice, and check whether the target bills them in tokens at all.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • Usage and cost per request

    Available with a plan

    Every request records its model, latency, token or unit counts, and estimated provider cost, queryable by project and key.

    Read the documentation for Usage and cost per request
  • Cost estimates before a request

    Available with a plan

    Ask what a request would cost on your own provider account before you make it: per image with resolution and quality tiers, per second of video, per character of speech, per token of text.

    Read the documentation for Cost estimates before a request
  • Negotiated provider rates

    Available with a plan

    Enter the rates your contracts actually carry, per model and optionally per provider, so estimated cost uses them before the vendor's list rate. Included on every plan.

    Read the documentation for Negotiated provider rates
  • Provider cost reconciliation

    Available with a plan

    Daily comparison of estimated spend against the cost reported by OpenAI's and Anthropic's own cost APIs, using a separate admin credential, with the likely cause of a persistent gap and a suggested rate you can apply. Included on every plan.

    Read the documentation for Provider cost reconciliation
  • Traffic changes

    Available with a plan

    Changes in your traffic that come with no error: a model answered by a new snapshot, longer answers, a lost prompt cache, more fallbacks, answers cut off by the length limit, slower responses or a new error mix. Each finding names the likely cause and the estimated weekly change in provider cost. INFRO sees request metadata, not answers, so it does not judge answer quality.

    Read the documentation for Traffic changes

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.Tokens are not the unit you are billed in (opens in a new tab) — INFRO. Accessed Nov 6, 2026.
  2. 2.How to count tokens before you call the API: OpenAI, Claude, Gemini (opens in a new tab) — INFRO. Accessed Nov 6, 2026.
  3. 3.Token counting (opens in a new tab) — Anthropic (Claude Platform Docs). Accessed Nov 6, 2026.
  4. 4.Plans & pricing (API rates) (opens in a new tab) — Anthropic. Accessed Nov 6, 2026.
  5. 5.INFRO documentation overview (opens in a new tab) — INFRO. Accessed Nov 6, 2026.
  6. 6.Billing — Organizations (opens in a new tab) — INFRO. Accessed Nov 6, 2026.

About this article

Read on 2026-11-06: Anthropic's token counting page, Anthropic's API rate table on claude.com/pricing, INFRO's docs overview and billing page, and two earlier INFRO articles on counting and billing units. Google's token guide and OpenAI's pricing page could not be read, so OpenAI and Gemini specifics come only from INFRO's own article, and no OpenAI or Gemini rates are quoted.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.