Learn · beginner

Context windows for beginners

The context window is short-term memory for a chat—measured in tokens.

Reviewed:

Short answer

A context window is the maximum span of tokens a model can consider at once—including system prompts, history, retrieved docs, and the new reply.

Why it matters

Context length shapes architecture choices between RAG, summarization, and long-context models—and directly drives cost.

Article

Practice

Long pastes can push out earlier instructions; keep important rules near the top and summarize history.

Examples

Contract review session

A lawyer’s assistant can fit a long agreement in-window, but the best prompts point the model to specific clauses and ask for excerpted quotes to verify.

Coding repo map

An IDE assistant retrieves only the auth module and failing test instead of pasting the entire monorepo into one request.

FAQ

Does the context window include the model’s answer?
Usually yes—output tokens consume part of the available context budget. Check provider accounting rules for each model.
Why did the assistant forget what I said earlier?
Earlier turns may have dropped out of the active window, or the product summarized them lossily. External memory features differ by app.
Is a larger context window always better?
It can help for long documents, but costs rise and irrelevant tokens can hurt quality. Prefer focused context and retrieval.

Related tools

  • OpenAI API Platform — Developer platform for GPT models, embeddings, tools, and multimodal APIs used to build AI products.
  • Anthropic API — Claude API for developers building apps with Anthropic models, tool use, and enterprise controls.
  • Gemini — Google’s multimodal AI assistant for chat, planning, creative drafting, and integration with Google’s consumer…

Related rankings

  • Best AI API Platforms in 2026 — AI API platforms are for builders calling models in products. This ranking is distinct from coding IDEs and from…
  • Best AI Developer Tools in 2026 — Developer tools cover IDEs, app builders, and engineer search — adjacent to but broader than “best AI for coding”…

Related topics

  • Tokens — Tokens are the discrete units language models read and generate—commonly subword pieces—used for context limits…
  • RAG vs Long Context — Long-context models can read large prompts directly; RAG selectively retrieves relevant snippets so the model is not…
  • Prompt Engineering — Prompt engineering is the practice of designing instructions, examples, and context so generative models produce more…
  • Retrieval-Augmented Generation — Retrieval-augmented generation (RAG) combines a language model with a search or retrieval step so answers can cite or…

Sources