openclaw - ✅(Solved) Fix Update Anthropic Claude Opus 4.6 / Sonnet 4.6 context window to 1M tokens [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49939Fetched 2026-04-08 01:01:02
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×1cross-referenced ×1referenced ×1subscribed ×1

Anthropic announced on March 13, 2026 that the 1M token context window is now generally available for Claude Opus 4.6 and Claude Sonnet 4.6 at standard pricing.

However, OpenClaw's internal model registry still uses DEFAULT_CONTEXT_TOKENS = 2e5 (200K), which caps all sessions at 200K regardless of the model's actual capability.

Root Cause

Anthropic announced on March 13, 2026 that the 1M token context window is now generally available for Claude Opus 4.6 and Claude Sonnet 4.6 at standard pricing.

However, OpenClaw's internal model registry still uses DEFAULT_CONTEXT_TOKENS = 2e5 (200K), which caps all sessions at 200K regardless of the model's actual capability.

Fix Action

Fixed

PR fix notes

PR #49941: feat: update default context window to 1M tokens for Claude Opus/Sonnet 4.6

Description (problem / solution / changelog)

Summary

Update DEFAULT_CONTEXT_TOKENS from 200K to 1M to match Anthropic's March 13, 2026 GA announcement that the 1M token context window is now generally available for Claude Opus 4.6 and Sonnet 4.6 at standard pricing.

Changes

  • src/agents/defaults.ts: DEFAULT_CONTEXT_TOKENS from 200_0001_000_000

Context

  • Announcement: https://claude.com/blog/1m-context-ga
  • Currently all Anthropic sessions are capped at 200K regardless of actual model capability
  • Venice provider already has Claude models at 1M (src/agents/venice-models.ts)

Note

This changes the fallback default. Models that already specify their own contextWindow in their registry entry are not affected. This only impacts models where contextWindow is not explicitly set (which includes the default Anthropic provider).

Closes #49939

Changed files

  • src/agents/defaults.ts (modified, +4/-2)
RAW_BUFFERClick to expand / collapse

Summary

Anthropic announced on March 13, 2026 that the 1M token context window is now generally available for Claude Opus 4.6 and Claude Sonnet 4.6 at standard pricing.

However, OpenClaw's internal model registry still uses DEFAULT_CONTEXT_TOKENS = 2e5 (200K), which caps all sessions at 200K regardless of the model's actual capability.

Current Behavior

  • DEFAULT_CONTEXT_TOKENS = 2e5 in auth-profiles-*.js
  • All Claude Opus/Sonnet 4.6 sessions show xxx/200k token limit
  • No user-configurable override available (contextWindow is not accepted in agents.defaults.models.*.params)

Expected Behavior

  • Claude Opus 4.6 and Sonnet 4.6 should have contextWindow: 1000000 in the model registry
  • Ideally, also expose contextWindow as a user-configurable field in the model config schema so users can override per-model limits

Environment

  • OpenClaw version: 2026.3.13
  • Model: anthropic/claude-opus-4-6, anthropic/claude-sonnet-4-6
  • Auth: token (Claude Max 20x)

References

extent analysis

Fix Plan

To fix the issue, we need to update the DEFAULT_CONTEXT_TOKENS value and add a user-configurable override.

Step 1: Update DEFAULT_CONTEXT_TOKENS

Update the DEFAULT_CONTEXT_TOKENS value in auth-profiles-*.js to 1e6 (1M) for Claude Opus 4.6 and Sonnet 4.6 models.

// auth-profiles-*.js
const DEFAULT_CONTEXT_TOKENS = {
  'anthropic/claude-opus-4-6': 1e6,
  'anthropic/claude-sonnet-4-6': 1e6,
  // ... other models ...
};

Step 2: Add User-Configurable Override

Add a contextWindow field to the model config schema and update the code to use this value if provided.

// model-config-schema.js
const modelConfigSchema = {
  // ... other fields ...
  contextWindow: {
    type: 'integer',
    minimum: 1,
    maximum: 1e6,
  },
};

// model-registry.js
const getModelContextWindow = (model, config) => {
  if (config.contextWindow) {
    return config.contextWindow;
  }
  // ... use DEFAULT_CONTEXT_TOKENS if no override ...
};

Step 3: Update Model Registry

Update the model registry to use the new contextWindow value.

// model-registry.js
const models = {
  'anthropic/claude-opus-4-6': {
    // ... other fields ...
    contextWindow: 1e6,
  },
  'anthropic/claude-sonnet-4-6': {
    // ... other fields ...
    contextWindow: 1e6,
  },
};

Verification

Verify that the fix worked by checking the token limit for Claude Opus 4.6 and Sonnet 4.6 sessions. It should now show xxx/1M instead of xxx/200k.

Extra Tips

  • Make sure to update the documentation to reflect the new contextWindow field in the model config schema.
  • Consider adding validation to ensure that the contextWindow value is within the allowed range.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING