Bedrock: 1M context (context-1m beta) should auto-enable for capable models

Resolved 💬 3 comments Opened Mar 10, 2026 by KevinZhao Closed May 6, 2026

Summary

Opus 4.6 and Sonnet 4.6 natively support 1M token context windows, but on Bedrock this requires the context-1m-2025-08-07 beta flag in the anthropic_beta request body field. Currently, users must manually append [1m] to every model ID environment variable to enable this. Claude Code should auto-enable 1M context for models that support it when using Bedrock.

Current Workaround

Users must add [1m] suffix to every model ID config:

{
  "env": {
    "ANTHROPIC_MODEL": "global.anthropic.claude-opus-4-6-v1[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "global.anthropic.claude-opus-4-6-v1[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "global.anthropic.claude-sonnet-4-6-v1[1m]",
    "ANTHROPIC_SMALL_FAST_MODEL": "global.anthropic.claude-haiku-4-5-20251001-v1:0"
  }
}

Missing [1m] on any one of these variables silently limits that model to 200k context, with no warning or error — the request simply gets truncated.

Problems

  1. Easy to misconfigure: 4+ env vars need the suffix, forgetting one causes silent context truncation
  2. Subagent model selection: When Agent tool selects models by tier ("model": "sonnet"), the [1m] suffix handling depends on the default model config being correct. It's unclear if this propagates to all code paths
  3. No auto-detection: CC knows the model capabilities (Opus 4.6 and Sonnet 4.6 support 1M) and the provider (Bedrock). It has enough information to auto-enable the beta
  4. Undiscoverable: The [1m] suffix convention is not documented in Bedrock setup guides. Users may not know 1M context is available or how to enable it

Proposed Solution

Either:

  1. Auto-enable for capable models on Bedrock: When the model is Opus 4.6 or Sonnet 4.6 and the provider is Bedrock, automatically include context-1m-2025-08-07 in anthropic_beta — no user config needed
  2. Single env var: Add CLAUDE_CODE_ENABLE_1M_CONTEXT=1 that applies to all model configs at once
  3. Warn on misconfiguration: If some model IDs have [1m] but others don't, warn the user

Environment

  • Claude Code version: 2.1.76
  • Provider: AWS Bedrock
  • Models: Opus 4.6, Sonnet 4.6 (both support 1M context natively)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗