Two Kinds of Token
Token problems: 7 of 20
Token problems: the workbook
Two Kinds of Token
Are all tokens the same? No. There are two kinds: input tokens (what you send) and output tokens (what the model generates, one at a time). Both are counted the same way, but output tokens cost more. Every agent call produces both: the prompt is input, the reply is output.
Problem
An AI agent is sent the input why do cats purr? and returns the output a cat purrs when it feels happy!. Tokenize the input and the output, then count the tokens of each kind.
Tokenize the input
Tokenize the output
Count the tokens of each kind
Practice 1
An AI agent is sent the input how many moons does the planet Jupiter have? and returns the output the planet Jupiter has ninety five moons!. Tokenize the input and the output, then count the tokens of each kind.
Tokenize the input
Tokenize the output
Count the tokens of each kind
Practice 2
An AI agent is sent the input is the sun a star? and returns the output yes, the sun is a star.. Tokenize the input and the output, then count the tokens of each kind.
Tokenize the input
Tokenize the output
Count the tokens of each kind
Next:
8. Input or Output?










