Hero Barua
All articles
Nov 26, 20265 min readAI workflowTokensContext windowHow AI counts

Context window explained: how much AI can remember

The context window is the most an AI can work with in one go. See what fills it, why a 20-turn chat bills almost 100,000 input tokens, and how to keep it small.

Ask an AI something at the start of a long chat, and an hour later it still remembers. Keep going, and at some point it starts to slow down, cost more, or stop with an error. All of that comes from one limit: the context window. This is part 3 of the series; part 1 explains tokens and part 2 explains the price.

What is a context window?

The context window is the most text a model can work with in one request, counted in tokens. Think of it as the model's desk. Everything it needs for this answer has to fit on the desk at once: your instructions, the conversation so far, attached files, tool results and the answer it's writing.

The model has no memory between requests. A chat app only feels like it remembers because it sends the whole conversation again with every new message.

How big is the window today?

As of 24 November 2026, Anthropic's docs list a 1M-token context window for current models such as Claude Sonnet 5.5 and Claude Haiku 5.5, and say 1M is the default, with no special header needed. Older models, such as Claude Sonnet 4.5, have 200,000 tokens.

A million tokens is roughly 750,000 English words, using the rule of thumb from part 1. In Bangla, as we saw, the same content can need many more tokens, so the window holds less.

What fills the window

  • The system prompt: your app's standing instructions.
  • Every earlier message in the conversation, yours and the model's.
  • Files and images you attach.
  • Tool definitions and tool results: a search tool that returns ten long pages adds all of them.
  • Thinking: when a model thinks before answering, those tokens count toward the window too.
  • The answer itself, as it's written.

Why long chats get expensive

Because the whole conversation is sent again each turn, the input grows with every message. I ran a simple example: a 500-token system prompt, 60-token questions and 400-token answers.

  • Turn 1: 560 input tokens.
  • Turn 10: 4,700 input tokens for that one message.
  • Turn 20: 9,300 input tokens for that one message.
  • All 20 turns together: 98,600 input tokens billed, for a chat whose final text is only about 9,000 tokens long.

The cost doesn't grow in a straight line. It grows faster and faster, because every new turn pays again for everything before it. Prompt caching (see part 2) softens this, because the earlier part of the conversation can be read from cache at a much lower price.

Subscription apps feel this too. Claude's help center says longer conversations use more of your usage limit. We'll come back to that in part 5.

What happens when the window is full

Anthropic describes two cases (context windows docs):

  • If your input alone is bigger than the window, the API refuses the request with a "prompt is too long" error.
  • On Claude 4.5 and newer, if the input fits but the answer runs out of room while being written, generation stops with the stop reason model_context_window_exceeded.

Chat apps usually hide this from you. They summarise or drop older parts of the conversation, which is why a very long chat can "forget" something you said near the start.

A note on thinking

What happens to earlier thinking depends on the model. Anthropic's docs say older Opus and Sonnet models, and Haiku models up to Haiku 4.5, automatically strip previous thinking blocks from the history, while current models keep them by default. If you build on the API, check this for your model, because kept thinking takes up room in later turns.

How I keep context small in my apps

  1. Send only what the task needs. To fix a paragraph, send that paragraph and a short summary of the article, not the whole site.
  2. Start fresh for a new task. In chat apps, a new conversation is cheaper and often gives better answers than a 50-message thread.
  3. Summarise long histories. Replace old turns with a short summary once they're no longer needed word for word.
  4. Put the stable part first. Instructions and reference documents at the start can be cached.
  5. Trim tool results. Return the five fields you need from a database row, not the whole JSON.

Quick summary

  • The context window is how many tokens a model can handle in one request: input plus output.
  • Current Claude models have 1M tokens; older ones 200,000.
  • Chats resend everything each turn, so long chats cost more and more.
  • Too much input gives an error; running out while writing stops the answer.
  • Send less, start fresh, summarise and cache.

Next: rate limits, and what a 429 error is really telling you.

References

  1. Context windows, Claude Platform Docs, Anthropic, accessed 24 November 2026.
  2. Understanding usage and length limits, Claude Help Center, Anthropic, accessed 24 November 2026.
  3. Prompt caching, Claude Platform Docs, Anthropic, accessed 24 November 2026.

Questions people ask

What is a context window in AI?

It is the most text, counted in tokens, that a model can work with in one request: your instructions, the conversation, files, tool results and the answer.

How big is the Claude context window?

As of November 2026, current Claude models such as Sonnet 5.5 and Haiku 5.5 have a 1M-token context window by default. Older models such as Sonnet 4.5 have 200,000 tokens.

Why do long AI chats cost more?

Each new message resends the whole conversation, so every turn pays again for everything before it.

What happens when the context window is full?

If the input is too long the API returns a "prompt is too long" error. If the answer runs out of room while being written, it stops with model_context_window_exceeded.

How useful was this article?

Tap a star

Written by Hero Barua

Full-stack SaaS engineer, 12+ years and Top Rated Plus on Upwork. AI builds the structure; I give it life.

Work with me