OpenClaw 1M Context Window: When You Need It and How to Enable It
OpenClaw 1M Context Window: When You Need It and How to Enable It
What Is the 1M Context Window?
Anthropic's 1M context beta allows Claude Opus and Sonnet models to process up to 1 million tokens in a single conversation — roughly 750,000 words, or the equivalent of several full-length novels. For most conversational AI use cases, you'll never come close to this limit. But for specific agent workloads, it's a genuine capability unlock.
OpenClaw v2026.2.17 added opt-in support for this beta via a new model param: context1m: true. This guide explains when to use it and how to configure it correctly.
When You Actually Need 1M Context
The honest answer is: most OpenClaw users don't need it. OpenClaw's prompt caching and compaction system is specifically designed to keep agents running efficiently within normal context limits. But there are real use cases where 1M context matters:
- Large codebase analysis — If you're using OpenClaw with an exec or GitHub skill to analyze an entire repository in one session, the context can get very large very quickly.
- Long-running research agents — Deep research tasks that accumulate hundreds of search results, web pages, and synthesized notes across many tool calls.
- Document processing pipelines — Agents that read and cross-reference multiple long PDFs, reports, or transcripts in a single session.
- Conversation archives — If you use OpenClaw's memory system to inject large conversation histories for continuity, 1M context gives you room to work with months of prior context.
- Multi-agent coordination — Orchestrator agents that need to hold the full context of multiple sub-agent outputs simultaneously.
How to Enable It
Enabling the 1M context beta requires adding a param to your model configuration:
model:
primary: anthropic/claude-sonnet-4-6
params:
context1m: true
Or for Opus:
model:
primary: anthropic/claude-opus-4-6
params:
context1m: true
Under the hood, this adds the anthropic-beta: context-1m-2025-08-07 header to API requests. OpenClaw handles this automatically — you don't need to modify any headers manually.
Important: The v2026.2.17 release includes a bug fix that ensures the pi-ai default OAuth beta headers are preserved when context1m injects the anthropic-beta header. If you're on an older version, enabling context1m could cause 401 auth failures for certain token types. Always run the latest version.
Token Costs: What to Expect
Using 1M context doesn't automatically mean you'll use 1M tokens — it just means the ceiling is higher. But you should be aware of how costs work:
- You're billed per token as usual, based on what's actually in the context window
- OpenClaw's prompt caching system can significantly reduce costs for long sessions — cached tokens are substantially cheaper than uncached tokens
- The
/statuscommand (updated in v2026.2.17) now shows cached token counts, so you can see your cache hit rate in real time
For most users enabling 1M context, the real cost driver is whether your use case actually needs to hold all that context in a single session, or whether compaction (OpenClaw's built-in context summarization) would work just as well at lower cost.
Per-Agent Context Configuration
The v2026.2.17 release also exposed Pi compaction tuning values that work alongside the 1M context option:
agents:
defaults:
compaction:
reserveTokens: 8000 # Reserve this many tokens at context limit
keepRecentTokens: 2000 # Always keep the most recent N tokens
These settings control how OpenClaw's automatic compaction behaves when context gets long. For agents using 1M context, you may want to raise these values to ensure the model doesn't compact too aggressively on very long sessions.
The Realistic Use Case: Long-Running Research Agents
The most compelling use case for 1M context in OpenClaw is deep research agents. Consider this scenario:
- You task your agent with researching a complex topic across 50+ web sources
- Each web_fetch call returns 2,000-5,000 tokens of content
- After 30 tool calls, you're approaching 150,000 tokens in context
- Without 1M context, OpenClaw's compaction kicks in and summarizes earlier sources
- With 1M context, the agent retains all 30 sources verbatim for its final synthesis
The quality difference in the final output can be significant — especially for tasks where exact quotes, specific data points, or cross-source comparisons matter.
Should You Enable It by Default?
No. Enable 1M context only for specific agents or sessions where you know context length will be a limiting factor. For most daily-use workflows — morning briefs, customer service, quick lookups — standard context with prompt caching is more cost-efficient and equally capable.
A good approach is to enable it for specific cron jobs or agent sessions that you know are context-intensive, while keeping your primary model config at standard settings.
Need help configuring 1M context for your specific use case? Model configuration, compaction tuning, and cost optimization require understanding your specific workload. We can set this up correctly as part of your OpenClaw deployment.
Book a free consultation or learn about our 1M Context Window Setup add-on.
Need Help with OpenClaw?
Our experts handle the entire setup — installation, configuration, integrations, and ongoing support. Get your AI assistant running in 24 hours.
Related Articles
OpenClaw PDF Analysis Tool: Native Document Processing at Scale
OpenClaw PDF Analysis Tool: Native Document Processing at Scale
9 min read
OpenClaw Secrets Management: Secure Credential Configuration Guide
OpenClaw Secrets Management: Secure Credential Configuration Guide
11 min read
OpenClaw Production Monitoring: Health Check Endpoints & Best Practices
OpenClaw Production Monitoring: Health Check Endpoints & Best Practices
10 min read