Token problems: 16 of 20

By Prof. Tom Yeh

Published: 2026-05-28

URL: https://www.byhand.ai/p/library-agents-tokens-tokens-on-a-budget


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 budget, how many tokens can one call afford? The earlier pricing problems ran forward: tokens in, cost out. This one runs backward: cost in, tokens out. Divide the budget by the price per block, then scale up to tokens. Agents with per-call cost limits use this calculation to set a maximum context size before each turn.

Problem

You have a budget of 50 cents for one call. The model is priced at 2 cents per 100 tokens. How many tokens can the call use?

How many 100-token blocks the budget buys

Convert the blocks to tokens

Practice 1

You have a budget of 90 cents for one call. The model is priced at 3 cents per 100 tokens. How many tokens can the call use?

How many 100-token blocks the budget buys

Convert the blocks to tokens

Practice 2

You have a budget of 60 cents for one call. The model is priced at 4 cents per 100 tokens. How many tokens can the call use?

How many 100-token blocks the budget buys

Convert the blocks to tokens


Next: 17. How Long Will It Take?