Token problems: 20 of 20

By Prof. Tom Yeh

Published: 2026-05-28

URL: https://www.byhand.ai/p/library-agents-tokens-tokens-from-the-bill


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

Given a bill, how do you work out how many tokens were used? A real model bill lists input and output on separate lines, each priced per million tokens. Divide each line's cost by that side's price per million, then scale up to tokens. Agent operators use this to audit usage after the fact, confirming that the bill matches what the logs show.

Problem

An agent task's bill shows $12 for input and $30 for output. Input is priced at $3 per million tokens, output at $15 per million. How many tokens did the task process in total?

Input tokens from the input charge

Output tokens from the output charge

Add for the total tokens

Practice 1

An agent task's bill shows $35 for input and $45 for output. Input is priced at $5 per million tokens, output at $15 per million. How many tokens did the task process in total?

Input tokens from the input charge

Output tokens from the output charge

Add for the total tokens

Practice 2

An agent task's bill shows $6 for input and $50 for output. Input is priced at $2 per million tokens, output at $10 per million. How many tokens did the task process in total?

Input tokens from the input charge

Output tokens from the output charge

Add for the total tokens