Token Efficiency
local graph
Chapter 2 — Token Efficiency
Section titled “Chapter 2 — Token Efficiency”There are two reasons to care about token efficiency: cost, and a quality problem called context rot — the way AI grows less reliable as a conversation runs longer. This chapter covers the cost. Chapter 8 covers context rot in detail.
Tokens
Section titled “Tokens”You may already know what tokens are. If not, here is a quick explanation.
AI models do not process text the way you read it. They break text into small pieces called tokens. A token is roughly four characters, or about three quarters of a word in English. You do not need to understand how tokenization works internally. For the methods in this book, all you need to know is that tokens exist and that they cost money.
Large language models are priced by the token. You pay for every token you send to the model — the input — and for every token the model sends back — the output. You pay in both directions.
As of May 2026, Claude Opus 4.7 costs five dollars per million input tokens and twenty-five dollars per million output tokens.
Do not assume the bill matches what you see on screen. The tokens you are billed for go far beyond the prompt you typed and the answer you read. Conversation history, project rules, skill files, internal tool activity, and other components all travel with every turn. Together, they are usually the bulk of the input. The next few chapters cover the main contributors. The picture shifts quickly as new AI products ship and as you add tools and skills inside your agent.
A practical consequence: do not install tools or skills just because they look interesting. If you do not understand how a given tool or skill affects your AI sessions and how much it will cost, leave it alone and use whatever your agent ships with. And even when you do understand the costs, the bigger win often comes from disabling the tools you never use, not from adding new ones — at least for specification work.
If, like me, you prefer the latest and most capable model for specification work, the bill climbs quickly when you are not careful. Token efficiency is not optional. The cost is real.
A note on switching models. Cheaper models exist — Sonnet, Haiku, and others. Using them is justified when their capabilities match the task. But switching to a cheaper model purely to save money during specification work is usually the wrong call — you want the best reasoning model available. Mistakes from a weaker model cost you more in wasted time than you save in tokens. Choose a model for what it can do, not for what it costs.
File Formats
Section titled “File Formats”Not all files cost the same to process. The format you use determines how many tokens it consumes when reading your content. The difference is larger than you might expect.
The cheapest format is plain text. Its close cousin, Markdown (.md files), is nearly as cheap — it is text with basic formatting. Both are efficient to read and easy for AI to edit. When AI reads a text file, it processes the characters directly. No overhead, no conversion. This is the baseline.
At the opposite extreme are images. When AI processes an image, it uses vision capabilities that consume far more tokens than reading the same information as text. A single page of plain text is roughly 500 tokens. The same page scanned and sent to Claude Opus 4.7 starts at about 1,200 tokens (at 100 dpi — dots per inch, a measure of scan resolution) and hits the model’s per-image cap of around 4,800 tokens (at 200 dpi and above). That is a 2-10x penalty per page, depending on scan quality. With multiple pages, the cost grows fast.
PDFs fall somewhere in between. If a PDF contains extractable text, AI can pull it out and process it relatively cheaply. If the PDF is a scanned document — essentially images of pages — it hits the same expensive vision path as any other image file.
The cost difference applies to editing, too, not just reading. Plain text is relatively cheap to edit. Non-text files — images, PDFs, spreadsheets — are expensive on both sides: feeding the file content to AI costs many more tokens, and the machinery used to apply the change is heavier. Chapter 8 explains how that machinery works.
The point is not to avoid images or PDFs entirely. Sometimes you need them. A mockup, a diagram, a signed contract — when these come from a third party, you do not control the format. The problem starts when you add such a file to your project and AI reads the file again and again, every time it needs the information inside. Each read repeats the 2-10x penalty and the cost adds up.
Here is the recommendation. Keep the originals — images, PDFs, scans, anything in an expensive format — in the directory outside AI’s reach that you set up in Chapter 1. Convert each one to Markdown once, and place only the Markdown file inside the project folder. From then on, every time AI needs the information, it reads a cheap text file instead of an expensive image or PDF. The conversion itself is mechanical work; do it outside your project with whatever is convenient — a separate temporary project, a non-project chat, a cheaper model, or non-agentic software such as OCR (optical character recognition) or format-specific exports. The savings come from doing the conversion once, not from how you do it. One-time cost versus repeated cost.