Skip to content

fix: update AWS Bedrock Anthropic model specs to latest official documentation#12056

Open
nangsontay wants to merge 1 commit intoRooCodeInc:mainfrom
nangsontay:feat/fix-bedrock
Open

fix: update AWS Bedrock Anthropic model specs to latest official documentation#12056
nangsontay wants to merge 1 commit intoRooCodeInc:mainfrom
nangsontay:feat/fix-bedrock

Conversation

@nangsontay
Copy link
Copy Markdown

@nangsontay nangsontay commented Apr 4, 2026

Related GitHub Issue

Closes: #

Roo Code Task Context (Optional)

N/A

Description

Updates AWS Bedrock Anthropic model specifications to match the latest official AWS documentation.

Key changes:

  • Updated maxTokens for Claude Sonnet 4 (anthropic.claude-sonnet-4-20250514-v1:0) from 8,192 to 64,000
  • Updated maxTokens for Claude Opus 4 (anthropic.claude-opus-4-20250514-v1:0) from 8,192 to 64,000
  • Updated Claude Sonnet 4.6 and Claude Opus 4.6 to use native 1M context window (removed beta flag requirement and tiered pricing)
  • Updated guessModelInfoFromId heuristics for Claude 4 family in bedrock provider
  • Updated related test expectations

Files changed:

  • packages/types/src/providers/bedrock.ts – Primary model definitions
  • src/api/providers/bedrock.ts – Provider implementation (guessModelInfoFromId)
  • src/api/providers/__tests__/bedrock.spec.ts – Test updates

Source: https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards-anthropic.html

Test Procedure

  • All 87 existing bedrock tests pass (57 bedrock + 30 bedrock-reasoning/inference-profiles)
  • No new tests needed — existing tests were updated to reflect corrected values

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A — no UI changes.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required.

Additional Notes

This is a data-only fix aligning the model specs with the latest AWS Bedrock documentation for Anthropic Claude models.

Interactively review PR in Roo Code Cloud

Copilot AI review requested due to automatic review settings April 4, 2026 10:13
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates AWS Bedrock Anthropic model metadata so the app’s model selection, token limits, and pricing calculations align with the latest Bedrock model-card documentation.

Changes:

  • Increased maxTokens for Claude Sonnet 4 / Opus 4 family entries to 64,000.
  • Marked Claude Sonnet 4.6 and Opus 4.6 as having a native 1M context window (removed 1M beta/tier behavior in type definitions and updated test expectations).
  • Adjusted Bedrock provider heuristics for Claude 4 in guessModelInfoFromId.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/types/src/providers/bedrock.ts Updates Bedrock Anthropic model definitions (token limits, 1M context handling, tiers).
src/api/providers/bedrock.ts Updates heuristic defaults for Claude 4 model IDs when a model isn’t in the static table.
src/api/providers/tests/bedrock.spec.ts Updates expectations for Claude Sonnet 4.6 native 1M context behavior and pricing.
Comments suppressed due to low confidence (4)

src/api/providers/bedrock.ts:299

  • guessModelInfoFromId patterns for Claude 4 won’t match the AWS Bedrock Anthropic model IDs used elsewhere in this repo (e.g. anthropic.claude-sonnet-4-20250514-v1:0 contains claude-sonnet-4, not claude-4). As a result, unknown Claude 4 Sonnet IDs will fall back to the default model info rather than a Claude 4-specific guess. Consider matching claude-sonnet-4 (and/or using a regex for claude-.*-4) in addition to claude-4.
		// Define a mapping for model ID patterns and their configurations
		const modelConfigMap: Record<string, Partial<ModelInfo>> = {
			"claude-4": {
				maxTokens: 64_000,
				contextWindow: 200_000,
				supportsImages: true,
				supportsPromptCache: true,
			},
			"claude-3-7": {

src/api/providers/bedrock.ts:316

  • The Claude 4 Opus heuristic key claude-4-opus doesn’t match AWS Bedrock Anthropic Opus IDs (they are claude-opus-4-..., e.g. anthropic.claude-opus-4-20250514-v1:0). This makes the heuristic ineffective for unknown Opus 4 IDs and can cause incorrect pricing/capability defaults. Consider also matching claude-opus-4 (and claude-opus-4-6 if maxTokens differs).
			"claude-4-opus": {
				maxTokens: 64_000,
				contextWindow: 200_000,
				supportsImages: true,
				supportsPromptCache: true,
			},

packages/types/src/providers/bedrock.ts:39

  • In this model entry the pricing comments still refer to “≤200K context”, but contextWindow is now set to a native 1,000,000. This is confusing/misleading documentation—either update the comments to reflect native 1M pricing semantics or remove the context qualifier.
		maxTokens: 64_000,
		contextWindow: 1_000_000, // Native 1M context window
		supportsImages: true,
		supportsPromptCache: true,
		supportsReasoningBudget: true,
		inputPrice: 3.0, // $3 per million input tokens (≤200K context)
		outputPrice: 15.0, // $15 per million output tokens (≤200K context)
		cacheWritesPrice: 3.75, // $3.75 per million tokens
		cacheReadsPrice: 0.3, // $0.30 per million tokens

packages/types/src/providers/bedrock.ts:145

  • This Opus 4.6 entry sets contextWindow to native 1,000,000, but the pricing comments still say “≤200K context”. Please update/remove those qualifiers so the entry is self-consistent.
		maxTokens: 128_000,
		contextWindow: 1_000_000, // Native 1M context window
		supportsImages: true,
		supportsPromptCache: true,
		supportsReasoningBudget: true,
		inputPrice: 5.0, // $5 per million input tokens (≤200K context)
		outputPrice: 25.0, // $25 per million output tokens (≤200K context)
		cacheWritesPrice: 6.25, // $6.25 per million tokens
		cacheReadsPrice: 0.5, // $0.50 per million tokens

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})

it("should apply 1M tier pricing when awsBedrock1MContext is true for Claude Sonnet 4.6", () => {
it("should have native 1M context window for Claude Sonnet 4.6 without needing beta flag", () => {
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description still contains the placeholder Closes: # <!-- Replace with the issue number --> instead of an actual linked issue number. Please update the PR description to reference the approved issue so it can be tracked/auto-closed correctly.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants