← Back to Glossary

Context Window

Context Window refers to the maximum number of tokens that a large language model (LLM) can process in a single request. This limit encompasses everything the model "sees" during an interaction — the system prompt, conversation history, input documents, the user's query, and the generated response all count toward the context window. Once the window is exceeded, the model either truncates older content or rejects the request entirely.

How have context windows evolved?

Context window sizes have grown dramatically as model architectures and hardware have advanced:

  • 2020–2022 (GPT-3 era): Early LLMs typically supported 2,048 to 4,096 tokens, roughly equivalent to 3–6 pages of text. Applications had to be carefully designed around these tight limits.
  • 2023 (GPT-4, Claude 2): Context windows expanded to 8K, 32K, and even 100K tokens, enabling use cases like document summarization and long-form analysis.
  • 2024–2025 (Gemini 1.5, Claude 3): Models now support 128K to 200K tokens as standard, with some models reaching 1 million tokens or more — enough to process an entire novel or codebase.
  • 2026 and beyond: The frontier continues to push upward, with research into effectively unlimited context through techniques like ring attention and hierarchical memory.

Why do larger context windows increase costs?

LLM pricing is overwhelmingly token-based: you pay per input token and per output token. A larger context window means more tokens can be sent per request, and this directly drives up costs. For example, sending a 50-page document in every API call costs 10–20x more than sending just a query. At enterprise scale — where thousands of employees or automated agents make requests continuously — even small increases in average token count per request translate into dramatic cost growth. Models with larger context windows also tend to have higher per-token pricing to cover the increased compute overhead.

What is the difference between context window and effective context?

While a model may advertise a 128K-token context window, its effective use of that context is often significantly less reliable. Research has documented the "lost in the middle" problem: LLMs tend to attend most strongly to information at the beginning and end of the context, while content in the middle receives less attention and may be effectively ignored. This means that simply stuffing a long context window with documents does not guarantee the model will use all the information accurately. Retrieval-augmented generation (RAG) and context-aware chunking are common strategies to place the most relevant information where the model will attend to it most effectively.

How does Shakudo address context window challenges?

Shakudo tackles the cost and effectiveness challenges of large context windows through multiple layers. Kaji, Shakudo's enterprise AI agent, uses continuous context compaction — intelligently summarizing and restructuring context as conversations progress so that only the most decision-relevant information is retained. This reduces total token volume without losing critical information, turning what would be an expensive 100K-token interaction into a streamlined 15K-token exchange with equivalent output quality. Additionally, Shakudo's AI Gateway enables smart model routing: requests that require large context (such as document analysis) can be directed to cost-effective models with large context windows, while simpler queries are routed to smaller, faster models. This combination of context compaction and intelligent routing transforms a large context window from a cost multiplier into a strategic advantage — enabling enterprises to process more data, at lower cost, with better results.