claude-code - 💡(How to fix) Fix Opus 4.6/4.7 context window incorrectly detected as 200K instead of 1M [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
anthropics/claude-code#52537Fetched 2026-04-24 06:04:32
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×4cross-referenced ×2closed ×1commented ×1

Root Cause

Duplicate of #23432 — root cause analysis posted there.

RAW_BUFFERClick to expand / collapse

Duplicate of #23432 — root cause analysis posted there.

Bug Description

Claude Code's context window detection function (zG in cli.js) always returns 200,000 for Opus models, even though claude-opus-4-6 and claude-opus-4-7 natively support 1,000,000 tokens (no beta header required).

See #23432 for tracking.

extent analysis

TL;DR

The issue may be resolved by updating the zG function in cli.js to correctly handle the context window detection for Opus models.

Guidance

  • Review the root cause analysis in #23432 to understand the underlying issue with the zG function.
  • Verify the native token support for claude-opus-4-6 and claude-opus-4-7 models to confirm the expected behavior.
  • Check the cli.js file for any hardcoded values or assumptions that may be causing the zG function to return an incorrect context window size.
  • Consider updating the zG function to account for the varying token support of different models.

Notes

The issue seems to be related to a specific implementation detail in the cli.js file, and resolving it may require a targeted code change.

Recommendation

Apply workaround: Update the zG function in cli.js to correctly handle the context window detection for Opus models, as the root cause analysis in #23432 may provide valuable insights into the necessary changes.

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