Skip to content

feat(anthropic): migrate 1M context from beta to GA #45550

@JonathanJing

Description

@JonathanJing

Summary

Anthropic has officially moved the 1M context window from Beta to GA (General Availability). This issue tracks the migration to align OpenClaw with the new Anthropic API behavior.

Background

Per Anthropic's announcement (https://www.cnbeta.com.tw/articles/tech/1553412.htm), the following changes are now in effect:

  1. No beta header required - The context-1m-2025-08-07 header is no longer needed
  2. Rate limits unified - 1M requests now share the same rate limits as standard requests
  3. OAuth support - OAuth tokens (sk-ant-oat-*) now support 1M context (previously rejected)
  4. Media quota increased - Images/PDFs per request increased from 100 to 600

Current Behavior

OpenClaw currently requires explicit opt-in via params.context1m: true:

{
  agents: {
    defaults: {
      models: {
        "anthropic/claude-opus-4-6": {
          params: { context1m: true }
        }
      }
    }
  }
}

This injects anthropic-beta: context-1m-2025-08-07 and automatically skips the beta header for OAuth tokens.

Proposed Changes (Minimal/Backward-Compatible)

Phase 1: Remove Beta Header (This Issue)

  • Stop injecting context-1m-2025-08-07 when context1m: true
  • Remove OAuth token skip logic for 1M beta
  • Keep context1m parameter for backward compatibility
  • Update documentation to reflect GA status

Phase 2: Default Enable (Future Consideration)

  • Consider defaulting Opus/Sonnet 4.6+ to 1M context without explicit config

Affected Files

File Change
src/agents/pi-embedded-runner/anthropic-stream-wrappers.ts Remove beta header injection logic
src/agents/pi-embedded-runner/anthropic-stream-wrappers.ts Simplify OAuth skip logic
docs/providers/anthropic.md Update 1M context documentation
src/agents/pi-embedded-runner-extraparams.test.ts Update test assertions

Backward Compatibility

Fully backward compatible - Existing context1m: true configurations will continue to work, just without sending the unnecessary beta header.

Related

  • Original 1M beta support: commit c90b09c
  • OAuth skip logic: commit f03ff39
  • Documentation: commit 063c4f0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions