[PR #13324] fix(provider): split Bedrock 1M context models into explicit 200K and… #14614

Open
opened 2026-02-16 18:19:23 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13324

State: open
Merged: No


Summary

  • Split Bedrock Claude Opus 4.6 and Sonnet 4.5 into explicit 200K (default) and
    1M Experimental variants at models.dev ingestion time
  • The 1M variant sends the required anthropicBeta: ["context-1m-2025-08-07"] flag
    via the AI SDK provider options, which Bedrock requires to unlock the 1M context window
  • The 200K default is the safe path — without the beta flag, Bedrock hard-rejects
    requests above 200K tokens
  • Custom user-configured models are not affected by the split

Why

Bedrock enforces a 200K token hard limit on Claude Opus 4.6 and Sonnet 4.5 unless the
anthropic_beta: ["context-1m-2025-08-07"] flag is included in the request body
(AWS docs).
Previously, OpenCode listed these models with a 1M context limit but never sent the beta
flag, causing failures when context exceeded 200K.

Testing

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13324 **State:** open **Merged:** No --- ## Summary - Split Bedrock Claude Opus 4.6 and Sonnet 4.5 into explicit `200K` (default) and `1M Experimental` variants at models.dev ingestion time - The 1M variant sends the required `anthropicBeta: ["context-1m-2025-08-07"]` flag via the AI SDK provider options, which Bedrock requires to unlock the 1M context window - The 200K default is the safe path — without the beta flag, Bedrock hard-rejects requests above 200K tokens - Custom user-configured models are **not** affected by the split ## Why Bedrock enforces a 200K token hard limit on Claude Opus 4.6 and Sonnet 4.5 unless the `anthropic_beta: ["context-1m-2025-08-07"]` flag is included in the request body ([AWS docs](https://repost.aws/questions/QU636ll_JOQxmoTp9kQblG2Q/how-do-i-enable-the-1m-context-window-for-claude-sonnet-4-5-on-amazon-bedrock)). Previously, OpenCode listed these models with a 1M context limit but never sent the beta flag, causing failures when context exceeded 200K. ## Testing - `bun test test/provider/provider.test.ts` — 71 tests pass (5 new) - `bun run typecheck` — clean Closes #13199
yindo added the pull-request label 2026-02-16 18:19:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14614