Context Window Errors Across All AI Providers — 2026 Guide
Context window errors get worse with model tier — moving from GPT-4 (128K) to GPT-5.6 (400K) to Gemini 3.5 Pro (1M) doesn't eliminate the problem, it just shifts where it fires. Every model has a ceiling; every workload hits it eventually. This is the cross-provider directory: every context window failure pattern grouped by provider and layer.
Context window errors get worse with model tier — moving from GPT-4 (128K) to GPT-5.6 (400K) to Gemini 3.5 Pro (1M) doesn't eliminate the problem, it just shifts where it fires. Every model has a ceiling; every workload hits it eventually. Long conversations accumulate. System prompts and tool definitions count. Structured output schemas count. Extended thinking counts. This page is the cross-provider directory: every context window failure pattern we've documented across every provider, IDE tool, and gateway, grouped so you can find your specific error in seconds.
For architectural patterns to prevent context errors in the first place, see the context window chapter of the Cost Optimization Playbook. For rate limit patterns often triggered by large-context requests, see the Rate Limits category hub. For related failure modes, see the Authentication category hub.
2026 context windows at a glance
Context windows have grown 8x since 2023. Here's the 2026 landscape at a glance.
| Model | Max input | Max output | Cache mechanism | Streaming |
|---|---|---|---|---|
| Claude Sonnet 4.7 | 200K tokens | 16K tokens | cache_control (5 breakpoints) | Yes |
| Claude Sonnet 5 | 1M tokens | 16K tokens | cache_control (5 breakpoints) | Yes |
| Claude Opus 4.7 | 200K tokens | 16K tokens | cache_control (5 breakpoints) | Yes |
| Claude Haiku 4.5 | 200K tokens | 16K tokens | cache_control (5 breakpoints) | Yes |
| GPT-5.6 Terra | 400K tokens | 16K tokens | Automatic (≥1024 tokens) | Yes |
| GPT-5.6 Sol | 400K tokens | 16K tokens | Automatic (≥1024 tokens) | Yes |
| GPT-5.6 Luna | 128K tokens | 16K tokens | Automatic (≥1024 tokens) | Yes |
| Gemini 3.5 Pro | 1M tokens | 65K tokens | Explicit context caching | Yes |
| Gemini 3.5 Flash | 1M tokens | 8K tokens | Explicit context caching | Yes |
| Bedrock (varies) | Model-specific | Model-specific | Model-specific | Yes |
| Azure OpenAI (varies) | Deployment-specific | Deployment-specific | Automatic (≥1024 tokens) | Yes |
Anthropic Claude
Claude has two context windows in production in 2026 — 200K (Sonnet 4.7, Opus 4.7, Haiku 4.5) and 1M (Sonnet 5). Output is capped at 16K on all variants. The most common Claude context errors involve input overflow, extended thinking budget conflicts, and prompt caching breakpoint limits.
- Input tokens exceeds context windowPrompt + system + tools + history combined
- max_tokens exceeds model output limit16K ceiling on all Claude 4.x models
- Extended thinking budget conflicts contextbudget_tokens counted against context
- cache_control breakpoint limit exceededMax 5 cache breakpoints per request
- Vision image size exceeds 5MB limitImages count toward context via tokens
OpenAI
GPT-5.6 Terra and Sol offer 400K context; Luna is 128K. Reasoning tokens (from reasoning_effort) count against output — they're invisible in the response but consume budget. Structured output schemas beyond a certain size can push you over the context limit indirectly.
Google Gemini
Gemini 3.5 Pro's 1M-token context is real — needle-in-a-haystack testing shows reliable recall at that scale. Gemini 3.5 Flash also carries 1M input but only 8K output. File API uploads count toward context via automatic tokenization; large PDFs and videos consume proportionally.
AWS Bedrock
Bedrock context varies per model — Claude models inherit Anthropic's limits, Titan and Llama have their own. Cross-region inference profiles don't change context size but do affect payload routing. Streaming responses have separate payload size limits that can fire even within context.
Azure OpenAI
Azure OpenAI context follows the underlying OpenAI model but with per-deployment configuration. Global deployments and regional deployments can have different context handling. PTU deployments enforce context limits identically to Standard.
Context management at other layers of the stack
Context management isn't only a provider-layer concern. IDE tools compact aggressively, gateways normalize context parameters, frameworks accumulate state — each layer has its own failure modes.
IDE Tools
IDE tools (Cursor, Claude Code, GitHub Copilot) manage context differently than raw API calls — they use aggressive compaction, workspace indexing, and file-scoped context. Context errors in IDE tools manifest as quality degradation more often than hard failures. The tool 'keeps working' but with less context than you expect.
- Cursor agent mode context compaction drops rulesLong sessions silently compact .cursor/rules
- Cursor indexing stuck / .cursorignore blocking codebasePrevents @codebase from finding files
- Claude Code auto-compact thrashingRepeated large-file reads refill context
- Copilot Agent Mode max files in context hitgithub.copilot.chat.agent.maxFilesInContext
Gateway Layer
Gateways add their own context handling on top of the underlying provider. OpenRouter normalizes max_tokens across providers (some providers use max_tokens, others max_completion_tokens). LiteLLM's context_window_fallbacks route to larger-context models on overflow. Portkey configs can inline system prompts that push you over limits.
Framework Layer
Frameworks generate more tokens per user turn than direct API calls do. LangChain conversation memory accumulates. LangGraph state can grow unboundedly if not pruned. LlamaIndex node reranking window controls how many chunks feed the LLM. Framework context errors are almost always state-management errors.
Frequently asked questions
Why do I still hit context errors on 1M-token models?
What actually counts toward my context window?
How do I reduce input tokens without losing information?
What's the difference between max_tokens and context window?
Why does my Claude request fail with 'input too long' but Sonnet 5 has 1M context?
How does Gemini's 1M context compare to Claude's 1M context in practice?
Should I upgrade to a larger-context model to fix context errors?
How do I handle context errors in agent workloads?
What does 'auto-compact thrashing' mean?
How do I test whether my model handles long context well?
Related resources
Deep dives, comparisons, and pillar guides related to context window management:
- Category Hub: Rate Limits (companion category)
- Category Hub: Authentication (companion category)
- Pillar Guide: AI API Cost Optimization Playbook
- Pillar Guide: Handling Rate Limits in AI APIs
- Pillar Guide: Claude API Errors
- Pillar Guide: OpenAI API Errors
- Pillar Guide: Gemini API Errors
- Blog: Frontier Model Comparison (context section)
- Blog: The AI Errors Nobody Talks About
- Full errors library (330+ pages)
- Weekly digest — new context patterns