Price each step of your agent before you pick a model tier
DEV Community

Price each step of your agent before you pick a model tier

Most agent pipelines send every step to one model. Usually it is the large one, picked because it passed the demo.

This post is the engineer's companion to our guide on small language models. It turns the cost section of that guide into a script you can run against your own logs.

What do the tiers cost?

The rates below are the Anthropic standard rate card in USD per million tokens, checked on 30 November 2026. Haiku 5.5 charges 0.10 for input and 0.50 for output, while Fable 5.2 charges 8.00 and 40.00.

One catch. A Haiku 5.5 prompt over 100,000 tokens is billed at 0.50 and 2.50.

RATES = { # USD per million tokens: (input, output)
  "haiku-5.5": (0.10, 0.50),
  "sonnet-5.5": (2.00, 10.00),
  "opus-5.5": (4.00, 20.00),
  "fable-5.2": (8.00, 40.00),
}
HAIKU_LONG = (0.50, 2.50) # prompts over 100,000 tokens

def cost(model, tokens_in, tokens_out, batch=False):
  rate_in, rate_out = RATES[model]
  if model == "haiku-5.5" and tokens_in > 100_000:
    rate_in, rate_out = HAIKU_LONG
  usd = (tokens_in * rate_in + tokens_out * rate_out) / 1_000_000
  return usd * 0.5 if batch else usd

# one month of a classification step (example values)
calls, tin, tout = 2_000_000, 1_200, 20
for m in ("haiku-5.5", "fable-5.2"):
  print(m, round(calls * cost(m, tin, tout), 2))

With those example values the script prints 260.0 for Haiku 5.5 and 20800.0 for Fable 5.2. Swap in the call count and token sizes of a real step from your logs.

The batch flag applies the 50 percent Batch API discount for work that can wait.

Checklist before you assign tiers

  • Each step written as one sentence, with no second kind of thinking hidden behind an "and"
  • Latency and cost per request recorded for a small and a large model on the same real inputs
  • Prompt length checked against the 100,000-token threshold on the cheap tier
  • Facts supplied at run time from your documents, so the small model does not need them in its weights
  • The chosen model, tier and measured numbers written into the specification

Validation does not shrink with the model. A small model hallucinates as readily as a large one, so the test set stays the same size whichever tier wins.

The full guide has the decision table and two hybrid routing patterns: small language models.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.