Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
How LLMs Read and Charge  ›  Capstone Project

Token Based Pricing — Reading the Bill

Token Based Pricing 15 minHosted models charge per token for input and output at separate rates, and because an agent resends its growing history each step, input tokens often dominate the cost of a run.

Token Based Pricing — Reading the Bill

A demo of Tripmate costs less than a rupee. Then a thousand users each plan a trip, every plan takes a dozen model calls, and the monthly bill arrives with an extra zero. Knowing how model pricing works lets you predict that bill before it surprises you.

The rule

You pay per token, both ways — and agents resend the past every step.

Hosted models are usually priced per million tokens, with two separate rates:

  • Input tokens — everything you send: instructions, tools, history, tool results.
  • Output tokens — everything the model writes. This rate is typically several times higher than the input rate.

Take a made-up model priced at $1 per million input tokens and $4 per million output tokens. One Tripmate call that sends 5,000 tokens and gets back 500 costs:

input:  5,000 ÷ 1,000,000 × $1 = $0.005
output:   500 ÷ 1,000,000 × $4 = $0.002
total                          = $0.007

Bigger, more capable models usually charge more per token than small, fast ones, and models that "think" before answering may bill that hidden reasoning as output tokens too. Real prices differ between models and change often, so always check the current price sheet. The method does not change.

The shortcut

An agent is not one call — it is a loop of calls, and each call resends the growing history. So estimate a whole run, not a single call: add up the input of every step, then the output of every step.

Pricing one Tripmate trip planStep 1 of 4
  1. List the steps

    The plan takes 6 model calls: understand the request, search trains, check weather, compare, book, confirm.

Notice that input dominates here, even though its rate is lower. That is typical for agents: the resent history is the real cost. Trimming bulky tool results, summarising old turns, and using a smaller model for easy steps are the usual levers. Some providers also discount input they have seen recently (often called caching), which rewards keeping the fixed start of your prompt identical between calls.

Drills

Answer fast — trust the rule.

quick drill

At $1 per million input tokens, what does sending 20,000 input tokens cost?

quick drill

At $4 per million output tokens, what do 2,500 output tokens cost?

quick drill

Why does a 10-step agent run cost far more than ten times a single short call?

quick drill

Which change most directly cuts Tripmate's input-token bill?

Remember

  • You pay per token, input and output at different rates; output is usually pricier per token.
  • Shortcut: price the whole loop — sum every step's input, then every step's output.
  • Trap: pricing one call and forgetting that history is resent each step.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainPrice an agent run

A made-up model charges $2 per million input tokens and $8 per million output tokens. A Tripmate run takes 4 steps with input of 4,000, 6,000, 8,000 and 10,000 tokens and 400 output tokens each. Work out the cost of the run, and explain which part dominates and one way to reduce it.