Token problems: 19 of 20

By Prof. Tom Yeh

Published: 2026-05-28

URL: https://www.byhand.ai/p/library-agents-tokens-pricing-per-million-tokens


Token problems: the workbook

  1. Count the Tokens
  1. Subword Splitting
  1. Punctuation Counts
  1. Tokens per Word
  1. Will It Fit?
  1. The Price of a Call
  1. Two Kinds of Token
  1. Input or Output?
  1. The Two-Part Bill
  1. End-to-End Call Cost
  1. Comparing Three Calls
  1. The Average Call
  1. The System Prompt
  1. The System Prompt Tax
  1. Calls in a Budget
  1. Tokens on a Budget
  1. How Long Will It Take?
  1. The Split Matters
  1. Pricing per Million Tokens
  1. Tokens from the Bill

How does real model pricing work? Every major API quotes its price per million tokens, with input and output on separate lines. Output costs several times more than input. To find the total cost, price each side on its own, then add. When comparing models for an agent, these two numbers together determine the real cost per call.

Problem

A model charges $3 per million input tokens and $15 per million output tokens. A task processes 2,000,000 input tokens and 1,000,000 output tokens. What does the task cost?

Cost of the input tokens

Cost of the output tokens

Add for the total cost

Practice 1

A model charges $4 per million input tokens and $12 per million output tokens. A task processes 3,000,000 input tokens and 2,000,000 output tokens. What does the task cost?

Cost of the input tokens

Cost of the output tokens

Add for the total cost

Practice 2

A model charges $2 per million input tokens and $10 per million output tokens. A task processes 4,000,000 input tokens and 1,000,000 output tokens. What does the task cost?

Cost of the input tokens

Cost of the output tokens

Add for the total cost


Next: 20. Tokens from the Bill