explainx.ainewsletter3.5k
TrendingNewsPathwaysSkills
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

custom AI agents

[email protected]

get started

Find your pathTake Free Evaluation

learn

pathways — start freeworkshopsbootcampscoursescertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcptoolsagentsllmsdesignsagi trackerranks

company

aboutvisionmissionteaminstructorscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource librarydemofor LLMs

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

More from us

InfloqInfluencer marketingBgBlurPrivacy-first blurOlly SocialSocial AI copilotCeptoryVideo intelligenceBgRemoverBackground removal

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportprivacytermsdata rightssubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

On this page

  • Context window vs training data vs “memory”
  • Snapshot table: how to read vendor claims
  • Long-context pricing reality
  • Summary
  • How vendors talk about it
  • Snapshot: context and max output (per published docs)
  • Why “million-token” class models are expensive to run
  • RAG vs long context: decision guide
  • Working inside a finite window
  • Read next
  • Summary
← Back to blog

explainx / blog

What is a context window? LLM 'working memory' and a 2026 snapshot of top models

The context window is how many tokens a model can condition on in one request—input plus the budget reserved for a reply. Here is a plain definition, how it differs from parameter count, and a comparison table for flagship 2026 models (GPT-5.4, Claude 4.7 family, Gemini 3.1 Pro, Meta Llama 4) with links to the canonical docs.

Apr 22, 2026·9 min read·Yash Thakker
LLM basicsContext windowAnthropicOpenAIGoogle GeminiMeta Llama2026 models
go deep
What is a context window? LLM 'working memory' and a 2026 snapshot of top models

The context window (context length) is the token budget a single request can use: the full prompt you send (system text, user message, prior turns, tool definitions, retrievals, tool results) plus the space allowed for the new completion, up to a max output cap. It is a limit on how much the model can attend to at once, not the same as parameter count or how usage is metered in tokens—though all three appear on the same pricing pages.

If the request does not fit, the system may return an error, truncate older content, or compress it—behavior depends on the client and API.

Weekly digest3.5k readers

Catch up on AI

Curated AI updates on agents, skills, and MCP — delivered to your inbox. Unsubscribe anytime.

Context window vs training data vs “memory”

Three ideas often collide in vendor marketing:

ConceptMeaning
Context windowMax tokens one forward pass can attend to right now
Training dataCorpus used during pre-training—not fully visible in any single prompt
Product “memory”Vendor features (projects, compaction, LLM wikis) that persist facts across sessions

A model “knowing Python” is weights, not context. Pasting your entire repo into chat is context. Confusing the two leads to under-pasting (missing files) or over-pasting (blowing the window on turn three).

Estimating tokens before you send

Rough planning (English prose):

  • ~4 characters per token for ballpark math on technical text.
  • Code often tokenizes denser than prose—measure with your provider’s tokenizer when billing matters.
  • Tool definitions in agent prompts consume window every turn unless cached—budget them explicitly.

When in doubt, log usage.prompt_tokens from API responses for a week and build an internal table of “typical task sizes.”

Agent builders: context budget worksheet

Before shipping an agent, fill in:

BucketYour estimateNotes
System + developer instructionsInclude tool JSON schemas
Retrieved chunks (RAG)Top-k × chunk size
Conversation historyTurns × avg turn size
Tool results (last turn)Often underestimated
Headroom for outputMax completion tokens

If the sum approaches the model window, plan compaction or external memory before launch—not after users hit truncation errors.

FAQ recap (body)

Is context the same as memory? No—memory products persist facts; context is per-request unless you re-inject stored state.

Does a bigger window replace RAG? Rarely. Retrieval scales to corpora larger than any window and keeps citations fresh.

What breaks first on long threads? Usually cost and latency, not the theoretical token cap—monitor both when enabling 1M-class models.

For coding agents specifically, see Claude Code large codebase tips and Headroom compression.

Snapshot table: how to read vendor claims

When a blog post says “1M context,” ask:

  • Is that input only or input + output combined?
  • Does multimodal content consume the same pool?
  • Are tool definitions counted every turn?
  • Does my host (Bedrock, Vertex, direct API) honor the full number?

The table in this guide is a starting point—your contract and region may differ.

Read next: What are tokens? · Parameters explained · Caveman token compression · Claude Opus 4.7

Treat context window as a hard budget in agent design reviews—the same way you cap cloud spend. Teams that skip this step discover truncation only when a long-running support thread silently drops the system prompt.

Long-context pricing reality

Even when a model advertises 1M tokens, vendors may charge premium rates above 272k input tokens or route long requests to slower queues. Budget owners should model p95 prompt size × price per million × daily requests before enabling “paste entire repo” workflows in internal tools.

Bottom line: Context window is the ceiling on one request’s working set—design agents assuming you will hit that ceiling weekly, not once a year.

When comparing Claude, GPT-5.4, and Gemini 3.1 Pro for an agent project, build a spreadsheet with your real prompts—not vendor maxima—as the input column.

For coding agents, tool JSON and MCP server definitions often consume tens of thousands of tokens before the user speaks—budget them in the same worksheet as chat history (MCP guide).

Summary

Context window = max tokens one request can use (prompt + completion budget). It is not parameter count, not training data, not vendor marketing alone. Size agents with real prompts, tool overhead, and compaction plans before you promise “unlimited chat” to users.

Re-check vendor model pages when upgrading—context and max output limits change independently of model name.

See also Headroom compression when prompts routinely exceed half your window.

Vendor numbers change; confirm on the model page for your API route.



How vendors talk about it

  • “1M context” (typical 2026 flagship claim) is usually a ceiling on what you can pass in for one call, while max new tokens in the response may still be smaller (for example 64k–128k on sync APIs for some front-tier models).
  • “Max output tokens” is the cap on the assistant portion of the response for that call.
  • Long-context products often have separate rate limits or price for very long sessions. OpenAI’s GPT-5.4 guide discusses 272k-scale thresholds for rate limits and pricing; re-read the current pricing page before sizing a workload.
Tokens define both cost and context window size — this explainer covers both.

The table below is a 2026 documentation snapshot—always re-check the model page in your environment (direct API, Bedrock, Vertex, Foundry, etc.).


Snapshot: context and max output (per published docs)

Model (line)Context window (tokens)Max output (typical)Where to confirm
Claude Opus 4.71,000,000 (1M)128,000 (sync Messages)Anthropic models overview
Claude Sonnet 4.61,000,000 (1M)64,000same
Claude Haiku 4.5200,00064,000same
GPT-5.4 (API)1M long-context; see guide for 272K vs 1M behaviorup to 128,000 (see model page)Latest model, GPT-5.4
Gemini 3.1 Pro (Preview)1,000,000 input (1M)on the order of 64k output (varies)Google AI dev docs, DeepMind
Llama 4 Maverick (open)1,000,000 (1M) in model cardserver-dependentMeta model card
Llama 4 Scout (open)10,000,000 (10M) in model cardserver-dependentsame

Caveats: a large on-paper window does not force you to fill it; latency and cost usually grow with effective length. Multimodal inputs (images, video) use additional or separate budgets on many APIs. Hosted marketplaces can impose tighter caps than the base model card.


Why “million-token” class models are expensive to run

Standard transformer attention is heavy in memory for long sequences, so providers invest in kernels, sparsity, chunking, and user-facing compaction to make 1M-class products usable. That engineering is a major reason for long-context tiers and pricing rules—not only marketing.

Worked example: budgeting one request

Suppose you call Claude Opus 4.7 with a 1M context window and 128k max output (sync API, per Anthropic docs):

ComponentTokens (example)
System prompt + tools8,000
Retrieved RAG chunks (5 × 2k)10,000
Prior conversation (20 turns)120,000
User message2,000
Subtotal input140,000
Remaining for outputup to 128,000 (capped by max output, not “860k unused”)

You rarely “use the whole million.” Effective length drives latency and bill—see LLM tokens for pricing math.

Multi-turn trap: each turn re-sends prior messages (unless the client compacts). A 50-turn support thread can exceed a 200k window even if each message looked small in isolation.


RAG vs long context: decision guide

SituationPreferWhy
Static corpus (docs, wiki)RAG + small windowCheaper; fresher index without re-prompting everything
Single huge file (contract, log dump)Long context (if affordable)Cross-chunk reasoning without retrieval errors
Agent with toolsTools + compactionPass handles, not full payloads every turn (MCP)
Multimodal (many images)Check per-modality capsVision tokens often separate from text budget

Headroom context compression and Karpathy LLM wiki pattern are architectural answers when neither raw long context nor naive RAG alone scales.


Working inside a finite window

  • RAG and tools: pass pointers and retrieved chunks instead of whole corpora in every turn when possible (MCP patterns help).
  • Vendor compaction: Anthropic context window and OpenAI GPT-5.4 guidance both emphasize managing state rather than infinite raw history.
  • Shorter high-signal output: Caveman / brevity in agents reduces how fast the next turn’s input balloons.

Provider-specific gotchas (2026)

ProviderGotcha
Anthropic1M window on Opus/Sonnet but sync max output still capped—read Messages API limits
OpenAIGPT-5.4 documents 272k vs 1M behavior tiers for rate limits and pricing
GoogleGemini preview models change token accounting for multimodal inputs
Meta (Llama 4)Model card lists 10M for Scout—your host may impose a lower cap
Bedrock / VertexMarketplace wrappers often below vendor maximum

Always size workloads on the route you actually call, not the headline blog number.

Compaction vs truncation

When threads overflow, clients may truncate (drop oldest turns) or compact (summarize). Truncation silently loses facts; compaction loses nuance if summaries are poor. Prefer explicit compaction with stored summaries in an LLM wiki over blind tail dropping.


Read next

  • Claude Sonnet 5 "Fennec" leak — rumored 2M context window
  • What are tokens?
  • What are parameters?
  • Caveman: token economics in agents
  • Claude Opus 4.7: full Anthropic comparison

Vendor numbers change; re-check the model and pricing page for the exact route you use.


Summary

The context window caps how much text (and often multimodal input) a model can condition on in one request—distinct from parameter count and token billing. 2026 flagships advertise 1M-class windows, but max output, hosting route, and compaction behavior still bound real workflows.

Practical rule: prefer RAG + tools + compaction for unbounded corpora; use long context when you need cross-chunk reasoning on a single artifact and can afford latency and cost. Re-read vendor docs before sizing agent memory or support thread limits.

Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

Related posts

Apr 22, 2026

What are parameters in a large language model? Billions, MoE, and what 2026 model cards really say

Bigger is not a synonym for smarter, but parameter count is still the first axis people use to compare scale. This guide explains what parameters are, how mixture-of-experts changes the math, and which flagship models still publish size—and which do not.

Apr 22, 2026

What are tokens? A plain guide to how LLMs count (and charge for) text

If you have ever seen

Jul 29, 2026

Pacing the Frontier: 1,178 AI Employees Ask US to Build Slowdown Tools

Not a pause petition — a request for the option to buy time. Staff across OpenAI, Anthropic, Google, Meta, and Thinking Machines published Pacing the Frontier; Anthropic’s company account backed it with its RSI research.