So, what’s a token?
I’m glad you asked! This will come up when you’re interacting with ChatGPT (or other language models and services). In the context of ChatGPT, a token is the smallest unit of text that the model processes. It could be as small as a single character, commonly used groups of letters, prefixes, and suffixes, or even whole words, depending on how the model is configured.
From a cost and billing perspective, models typically charge you based on how many tokens you’re submitting and how many tokens you’re getting back as a response. Let’s use the example prompt featured in Figure 3.2 – What are three side dishes I can serve with pizza?
Using a tool such as OpenAI’s Tokenizer, you can figure out how much this request is going to cost to send:
Figure 3.3 – Viewing the Tokenizer’s result
As you can see, this request costs 11 tokens. The area at the bottom shows how OpenAI...