Skip to content

fix(zen): 1M context window beta not sent for Opus 4.6 and Sonnet 4.5 #12452

Closed as not planned

Description

@ruslan-kurchenko

The context-1m-2025-08-07 beta header is only applied to models matching claude-sonnet-*. Opus 4.6 and Sonnet 4.5 silently fall back to the default context limit despite supporting 1M tokens.

Affects both the direct Anthropic API path (anthropic-beta header) and Bedrock path (anthropic_beta body field).

Affected code: packages/console/app/src/routes/zen/util/provider/anthropic.ts

Activity

  1. github-actions commented on Feb 6, 2026

    @github-actions
    Contributor

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

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

  2. nabilfreeman commented on Mar 23, 2026

    @nabilfreeman
    Contributor

    @ruslan-kurchenko

    ✅ Confirmed Working Solution for Sonnet 4.5 on Amazon Bedrock

    Successfully enabled 1M context for Claude Sonnet 4.5 on Amazon Bedrock using a config-only approach. No plugins needed.

    Configuration

    Add this to your opencode.json:

    {
      "provider": {
        "amazon-bedrock": {
          "models": {
            "global.anthropic.claude-sonnet-4-5-20250929-v1:0": {
              "limit": {
                "context": 1000000,
                "output": 64000
              },
              "options": {
                "anthropicBeta": ["context-1m-2025-08-07"]
              }
            }
          }
        }
      }
    }

    Key Points

    1. anthropicBeta option: Gets translated to additionalModelRequestFields.anthropic_beta in the Bedrock Converse API (not an HTTP header)
    2. limit.context: 1000000: Tells OpenCode about the 1M capacity, preventing premature auto-compaction (~968K instead of ~168K)
    3. Model-specific: Only affects Sonnet 4.5, doesn't impact other models

    Tested & Working

    • ✅ Tested on Amazon Bedrock (us-east-1)
    • ✅ Confirmed 1M context window is active
    • ✅ Auto-compaction triggers at correct threshold
    • ✅ Works with global inference profiles (global.anthropic.*)

    Hope this helps! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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