Context Windows, Tokens & Cost
Everything that goes into a model call costs tokens. Understanding how tokens are counted, how context windows work, and how cost accumulates is essential for making architecture decisions and writing accurate cost estimates in your specs.
What is a token?
A token is the unit of text that language models process. It's not exactly a word or a character — it's a subword unit determined by the model's tokenizer.
Rough rule of thumb: 1 token ≈ 4 characters ≈ ¾ of a word in English. A 500-word outreach draft is approximately 650–700 tokens. A 10-page research report is approximately 4,000–5,000 tokens.
Every model call has two token types:
Input tokens (prompt tokens) — everything you send to the model: the system prompt, any retrieved context, the conversation history, the user's current message. These are often the dominant cost in agent runs because they include all the context.
Output tokens (completion tokens) — the model's response. Output tokens are typically 2–3× more expensive per token than input tokens, but there are usually fewer of them.
Why this matters for PM: the system prompt is paid for on *every single call*. A 2,000-token system prompt that runs 10,000 times/day costs you 20 million input tokens per day in system prompt alone. A 500-token system prompt for the same volume costs 5 million. Prompt length is a cost lever.
For BuzzBoard's IRIS agent running against 5,000 SMB prospects daily, even a 1,000-token difference in prompt length is 5 million input tokens per day — at Claude Sonnet pricing ($3/1M tokens), that's $15/day or $5,475/year.
Points given to white to compensate for black's first-move advantage. Token costs are komi for AI products — a fixed tax on every call. You must build products that generate enough value to justify the ongoing cost overhead.
Context windows and their limits
The context window is the maximum number of tokens a model can process in a single call — both input and output combined.
Current production context windows:
- GPT-4o: 128K tokens (~96,000 words)
- Claude Sonnet/Opus: 200K tokens (~150,000 words)
- Gemini Pro 1.5: 1M tokens (for document-heavy tasks)
A 200K context window sounds enormous, but agents quickly fill it:
- IRIS researching an SMB from 10 web pages: ~15,000 tokens of raw content
- A conversation with 20 turns of research and refinement: ~30,000 tokens
- A system prompt + tools definition: 2,000–5,000 tokens
- Prior account history for Ember: 5,000–20,000 tokens
Context limits create hard failure modes: when the window fills, either the request fails, older context is truncated (quietly dropping important information), or you have to architect around the limit.
PM implications:
- Specify context window requirements in your feature specs: "this feature processes up to N documents; architect for N × avgdocsize tokens per call"
- Design for context overflow explicitly: what gets dropped first when context fills? (Usually: earlier conversation turns. Make sure they're either summarized or stored in memory before dropping.)
- Long-context models cost more per token. Don't default to the biggest context window; use the right-sized window for the task.
Cost modeling an agent run
Writing a feature spec without a cost estimate is incomplete. Here's the model:
```
Cost per run =
(systemprompttokens + contexttokens + userinputtokens) × inputpricepertoken
+ outputtokens × outputpricepertoken
Daily cost = costperrun × runsperday
Monthly cost = daily_cost × 30
```
Example: Zylo drafting outreach for a prospect
- System prompt: 1,500 tokens
- IRIS profile passed as context: 3,000 tokens
- User request: 100 tokens
- Total input: 4,600 tokens
- Output (outreach draft): 300 tokens
At Claude Sonnet pricing ($3/1M input, $15/1M output):
- Input cost: 4,600 × $3/1M = $0.0138 per draft
- Output cost: 300 × $15/1M = $0.0045 per draft
- Total: $0.018 per prospect
At 5,000 prospects/day: $90/day, $2,700/month, $32,400/year for Zylo's drafting alone.
This is a line item in the product's unit economics. If BuzzBoard charges $500/month per seat, and one seat generates 500 prospects/month, the model cost is $9/seat/month — that's a 1.8% COGS contribution from model costs alone, before engineering, infrastructure, or support.
PMs who can build this model earn credibility with finance and engineering. It also frames build-vs-buy decisions: a self-hosted open-source model might halve this cost, but adds engineering burden.
Select any text in the lesson to ask a question. Press Esc to close.