Skip to content

provider: split Bedrock Claude into 200K and 1M catalog entries#25186

Closed
jackmazac wants to merge 1 commit intoanomalyco:devfrom
jackmazac:pr/upstream-3-bedrock-1m-split
Closed

provider: split Bedrock Claude into 200K and 1M catalog entries#25186
jackmazac wants to merge 1 commit intoanomalyco:devfrom
jackmazac:pr/upstream-3-bedrock-1m-split

Conversation

@jackmazac
Copy link
Copy Markdown

Summary

Amazon Bedrock exposes several Claude models that can use a very large context window, but only when you opt in with the right headers and product choice. Today those models often appear as a single option, which makes it easy to pick the wrong one or miss the beta header entirely. This change splits each supported Bedrock Claude model into a clear 200K default and a separate 1M variant so people can choose deliberately.

Problem (plain language)

Users want either “normal” long context or the experimental million-token mode. When both behaviors share one catalog entry, the app cannot label limits honestly, and the wrong beta flag may be attached—or omitted—so requests fail or behave unexpectedly. Native 1M support on newer models must not be forced through the older beta path.

Technical breakdown

  1. Models.dev / custom provider ingestion builds a flat map of Bedrock models in fromModelsDevProvider.
  2. Specific Claude Opus/Sonnet API ids support a 1M context with header context-1m-2025-08-07, while the same logical model should still be available at 200K without that beta.
  3. Opus 4.7 is treated as native 1M: keep existing anthropicBeta from upstream data instead of injecting the 1M beta on the 1M row.

Solution

  • Add splitBedrock1m for provider id amazon-bedrock: for matching model.api.id substrings, clone into a -1m model id.
  • Base row: cap context at 200K, strip anthropicBeta from options, normalize display name to (200K).
  • -1m row: 1M context; merge beta array—native Opus 4.7 keeps existing betas only; others add the 1M beta when missing.

Files

  • packages/opencode/src/provider/provider.ts

How to test

From packages/opencode:

bun typecheck

Manual: open model picker for Bedrock and confirm paired (200K) / (1M) entries for supported Claude ids.

Merge order

Independent of PR #25184 and PR #25185. Recommended before or with any Bedrock transform follow-up that assumes distinct -1m ids.

splitBedrock1m duplicates supported Opus/Sonnet rows with -1m suffix,
200K default without anthropicBeta, 1M row with context-1m beta except
native Opus 4.7 which keeps existing betas.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Hey! Your PR title provider: split Bedrock Claude into 200K and 1M catalog entries doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@jackmazac
Copy link
Copy Markdown
Author

Closing to reopen with a linked issue and the repo PR template per CONTRIBUTING.

@jackmazac jackmazac closed this May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:title

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant