Beta header context-1m-2025-08-07 not sent for Claude Opus 4.6, causing 200k hard limit #8729

Open
opened 2026-02-16 18:10:40 -05:00 by yindo · 2 comments
Owner

Originally created by @ErcinDedeoglu on GitHub (Feb 6, 2026).

Originally assigned to: @thdxr on GitHub.

Problem

Claude Opus 4.6 supports a 1M token context window, but the Anthropic API requires the beta header context-1m-2025-08-07 to unlock it. Without this header, the API enforces a hard 200k input token limit.

OpenCode currently sends this beta header for claude-sonnet-* models but does not include claude-opus-4-6. This causes the API to reject requests exceeding 200k tokens:

prompt is too long: 201965 tokens > 200000 maximum

Root Cause

The beta header logic only matches Sonnet model IDs. Opus 4.6 is the first Opus-class model with 1M context support and needs to be added to the header inclusion check.

Impact

  • Config overrides setting limit.context: 1000000 have no effect — the limit is enforced server-side by the Anthropic API
  • The status bar shows usage against 1M (e.g., 11% at 109k tokens), but the API rejects at 200k
  • Auto compaction doesn't trigger in time because OpenCode believes the model has 1M of headroom

Expected Behavior

OpenCode should send anthropic-beta: context-1m-2025-08-07 header for claude-opus-4-6 requests, matching the behavior already in place for Sonnet models.

Originally created by @ErcinDedeoglu on GitHub (Feb 6, 2026). Originally assigned to: @thdxr on GitHub. ## Problem Claude Opus 4.6 supports a 1M token context window, but the Anthropic API requires the beta header `context-1m-2025-08-07` to unlock it. Without this header, the API enforces a hard 200k input token limit. OpenCode currently sends this beta header for `claude-sonnet-*` models but does not include `claude-opus-4-6`. This causes the API to reject requests exceeding 200k tokens: ``` prompt is too long: 201965 tokens > 200000 maximum ``` ## Root Cause The beta header logic only matches Sonnet model IDs. Opus 4.6 is the first Opus-class model with 1M context support and needs to be added to the header inclusion check. ## Impact - Config overrides setting `limit.context: 1000000` have no effect — the limit is enforced server-side by the Anthropic API - The status bar shows usage against 1M (e.g., 11% at 109k tokens), but the API rejects at 200k - Auto compaction doesn't trigger in time because OpenCode believes the model has 1M of headroom ## Expected Behavior OpenCode should send `anthropic-beta: context-1m-2025-08-07` header for `claude-opus-4-6` requests, matching the behavior already in place for Sonnet models.
yindo added the zen label 2026-02-16 18:10:40 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 6, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #12452: fix(zen): 1M context window beta not sent for Opus 4.6 and Sonnet 4.5
  • #12438: Claude Opus 4.6 context window limits still 200k

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 6, 2026): This issue might be a duplicate of existing issues. Please check: - #12452: fix(zen): 1M context window beta not sent for Opus 4.6 and Sonnet 4.5 - #12438: Claude Opus 4.6 context window limits still 200k Feel free to ignore if none of these address your specific case.
Author
Owner

@ItsWendell commented on GitHub (Feb 16, 2026):

Here's a workaround that worked for me: https://github.com/anomalyco/opencode/issues/12338#issuecomment-3909808717

@ItsWendell commented on GitHub (Feb 16, 2026): Here's a workaround that worked for me: https://github.com/anomalyco/opencode/issues/12338#issuecomment-3909808717
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8729