Tokens are pieces of text, not words
Give Claude the system prompt "You are a scientist" and the message "Hello, Claude", and Anthropic's token counting page documents a count of 14 input tokens for those six words.
Before the model sees your text, a tokenizer cuts it into these units, the smallest a language model works with. Short common words are usually one token each, and a word's first token typically starts with the space before it.
An English rule of thumb doesn't carry over to Chinese or German, and even in English the vendors differ. Claude's newest models use a new tokenizer that cuts the same text into about 30 percent more tokens than the Claude models before them.
| Models | About one token per | Source |
|---|---|---|
| OpenAI models | 4 characters, or 0.75 words | OpenAI API concepts page |
| Claude models before Claude 4.7 | 3.5 characters | Anthropic glossary |
| Claude 4.7 and later | About 30 percent more tokens than earlier Claude models for the same text | Anthropic glossary and token counting page |
How to count tokens before you send a request
That count came from Anthropic's token counting endpoint, which returns the input tokens a request would use without sending it. The count is an estimate and can differ from the real request by a small amount. Tokens Anthropic adds for system optimizations can show up in the count, and those aren't billed. Anthropic lists counting itself as free to use. It has its own requests-per-minute limit, set by your usage tier and separate from the limit on creating messages, so it doesn't eat into your sending allowance.
curl https://api.anthropic.com/v1/messages/count_tokens \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "content-type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-opus-5-5",
"system": "You are a scientist",
"messages": [{
"role": "user",
"content": "Hello, Claude"
}]
}'- Build the request exactly as you plan to send it: the model ID, the system prompt, the messages and every tool definition.
- Post it to
/v1/messages/count_tokensinstead of/v1/messages. The reply is one number,{ "input_tokens": 14 }for the request above. - Send images and PDFs as base64, since the endpoint refuses blocks that point to a URL or an uploaded file.
- Count again before you switch models: Anthropic suggests counting the same request on both and comparing the two
input_tokensvalues. - In Claude Code, run
/contextfor a live breakdown of the session by category./usagelists the input, output and cache tokens each model has used in the session.
Input tokens, output tokens and the context window
On the Claude API, input means the system prompt, every message with its tool results, images and documents, and your tool definitions. Extended thinking counts as output, and each response reports both in a usage field.
Input and output share the context window: all the text the model can refer to while it writes a response, the response included.
Chats grow because the history goes out again on every turn. One turn's reply becomes the next turn's input, and Claude Code sends your full conversation with every request. A one-line question at the end of a day-long session still draws usage for everything before it.
1M
tokens of context in Claude Opus 5.5 and the other current models Anthropic lists
Source: Claude Platform docs: Context windows (read November 3, 2026)
128k
output tokens at most in one request to those models
Source: Claude Platform docs: Context windows (read November 3, 2026)
200k
tokens of context in the other Claude models
Source: Claude Platform docs: Context windows (read November 3, 2026)
More context isn't automatically better. As token count grows, accuracy and recall degrade, a phenomenon known as context rot. This makes curating what's in context just as important as how much space is available.
Both X posts on this page are screenshots of X's own embeds, taken on 3 November 2026, with times in US Pacific time.
Prompt caching, for the part of a prompt that repeats
Most of the opening of an agent's request is the same every time: the system prompt, the tool definitions, the instruction file and the start of the conversation. Prompt caching lets the API resume from that stored prefix instead of processing it again, which Anthropic says cuts processing time and cost. The window doesn't grow, though: a cached prefix still takes its place there, and only the price of those tokens changes.
The prefix is built in a fixed order: tools first, then the system prompt, then messages, and it has to match exactly. Change one level and that level is invalidated along with every level after it, so editing a single tool definition clears the whole cache. An entry lives 5 minutes by default. Each hit refreshes it, and a 1-hour lifetime is also offered.
The "You are a scientist" request is far too short to be cached. A request under the model's minimum length runs without the cache even when it's marked for caching, and no error says so. Claude Haiku 4.5 has one of the highest minimums.
In Claude Code v2.1.251 or later, the Session block of /usage adds a Prompt cache line: the share of input tokens served from cache, and the number of misses.
Do installed skills and MCP servers cost tokens?
Yes, even in a session where none of them runs.
Every installed Agent Skill keeps its name and description in context from the start, so the agent knows it exists. The Agent Skills specification puts that at about 100 tokens a skill, and the body loads only when a task matches. In Claude Code, each agent and command Claude can call on its own has its name and description in context on every turn too.
Claude Code caps that list. Each skill's description, with its when_to_use text, is cut at 1,536 characters, and the whole listing gets a budget of 1% of the model's context window. Past that budget, Claude Code drops the descriptions of the skills you call least, and with them the words that would have triggered those skills. A rarely used skill can stop firing that way while it's still installed. /doctor estimates what the listing costs, and /skill-doctor finds skills worth turning off.
An MCP server adds tools, and each tool definition is input like any message. Claude Code defers them by default, so only tool names and server instructions enter context until Claude uses a specific tool. On the API, tool search does the same job: instead of 50 tool schemas up front, you send one tool_search tool and Claude looks up the rest on demand. Anthropic suggests it once a toolset grows past roughly 20 tools.
A CLAUDE.md loads whole at the start of every Claude Code session, which is why Anthropic suggests keeping it under 200 lines.
| CLAUDE.md | Agent Skill Our pick | MCP server | |
|---|---|---|---|
| In context in a session where none of it runs | Yes | Yes | Yes |
| What sits there | The whole file, from the start of every session | Each skill's name and description, about 100 tokens | Tool names and server instructions, in Claude Code |
| The rest loads only when a task needs it | No | Yes | In Claude Code by default, on the API with tool search |
| Anthropic's size advice | Keep it under 200 lines | A description is cut at 1,536 characters | Add tool search past roughly 20 tools |
Our pick: Agent Skill. Anthropic suggests moving workflow-specific instructions out of CLAUDE.md and into skills that load only when used.
Sources: Claude Code docs: Manage costs effectively (read November 3, 2026), Claude Code docs: Skills (read November 3, 2026), Claude Platform docs: Manage tool context (read November 3, 2026), Agent Skills specification (read November 3, 2026)
From token counts to a monthly estimate
Anthropic prices input, output and cache reads separately per million tokens, so a monthly estimate needs all three counts. Writing a cached part the first time costs more, which the calculator's page says makes the real saving a little lower.
| Field | Where to find the number |
|---|---|
| AI sessions a day, days a month | Your own routine |
| Tokens read per session (thousands) | /usage or /context in Claude Code, or input_tokens from the API |
| Tokens written per session (thousands) | The output figure in /usage, thinking included |
| Share of what it reads that repeats (%) | The Prompt cache line in /usage |
| Output you cut with shorter answers (%) | A target you set, not a measurement |
| Sessions moved to the cheapest model (%) | Your guess at the simple sessions a smaller model could take |
Reference: the cache fields in usage, and each model's minimum
Each response's usage block splits the input three ways:
cache_read_input_tokens: tokens served from the cache on this request.cache_creation_input_tokens: tokens written to the cache to create a new entry.input_tokens: the rest, the tokens after the last cache breakpoint.
Source: Claude Platform docs: Prompt caching (read November 3, 2026)
We read the pages under Sources on November 2, 2026, and four of them again the next day, without testing anything hands-on. Model names, limits and Claude Code versions change often.
Frequently asked questions
How many words is 1,000 tokens?
About 750 English words, going by OpenAI's rule of thumb.
Do thinking tokens from earlier turns count again later?
On recent models, yes. They keep earlier thinking blocks in the conversation, where those blocks count as input on later turns, while older models strip them out. Thinking also comes out of your max_tokens and counts toward rate limits, since Anthropic bills it as output.
What happens when a conversation outgrows the context window?
The API refuses a request whose input alone is too long, with a 400 "prompt is too long" error. On Claude 4.5 models and newer, a request whose input fits but whose max_tokens would overflow is accepted. It stops with model_context_window_exceeded if it reaches the limit. Claude Code summarizes older history on its own as a session nears the limit.
Do CLI tools use fewer tokens than MCP servers?
Usually, yes. Tools such as gh, aws and gcloud add no per-tool listing, so Anthropic's Claude Code cost guide rates them as more context-efficient than MCP servers. Claude can run them in the shell, and /mcp lets you turn off servers you aren't using.
Sources
- Claude Platform docs: Glossary https://platform.claude.com/docs/en/about-claude/glossary
- Claude Platform docs: Token counting https://platform.claude.com/docs/en/build-with-claude/token-counting
- Claude Platform docs: Context windows https://platform.claude.com/docs/en/build-with-claude/context-windows
- Claude Platform docs: Prompt caching https://platform.claude.com/docs/en/build-with-claude/prompt-caching
- Claude Platform docs: Manage tool context https://platform.claude.com/docs/en/agents-and-tools/tool-use/manage-tool-context
- OpenAI API docs: Key concepts https://developers.openai.com/api/docs/concepts
- Claude Code docs: Manage costs effectively https://code.claude.com/docs/en/costs
- Claude Code docs: Explore the context window https://code.claude.com/docs/en/context-window
- Claude Code docs: Skills https://code.claude.com/docs/en/skills
- Claude Code docs: Plugins overview https://code.claude.com/docs/en/plugins
- Agent Skills specification https://agentskills.io/specification


