Skip to content

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

@ErcinDedeoglu

Description

@ErcinDedeoglu

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.

Metadata

Metadata

Assignees

Labels

zenRelates to Zen

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions