Skip to content

feat(amazon-bedrock): allow anthropicBeta through bedrock providerOptions in bedrock/anthropic#13054

Closed
sylviezhang37 wants to merge 6 commits intorelease-v5.0from
bedrock-anthropic-provider-options
Closed

feat(amazon-bedrock): allow anthropicBeta through bedrock providerOptions in bedrock/anthropic#13054
sylviezhang37 wants to merge 6 commits intorelease-v5.0from
bedrock-anthropic-provider-options

Conversation

@sylviezhang37
Copy link
Copy Markdown
Contributor

@sylviezhang37 sylviezhang37 commented Mar 4, 2026

Background

Bedrock requires anthropic_beta in its request body to enable extended capabilities like 1M context (context-1m-2025-08-07) and fine-grained tool streaming (fine-grained-tool-streaming-2025-05-14).

Summary

By design, bedrock/anthropic was ignoring providerOptions.bedrock.anthropicBeta.
Why not pass beta from anthropic back to bedrock?

  1. This is bedrock specific issue, and I think it might be better handled in bedrock
  2. For namespaces consistency and backward compatibility, I'm taking a similar approach to this PR which accepts vertex/google provider options for vertex provider.

Manual Verification

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

Related Issues

@tigent tigent bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider provider/anthropic Issues related to the @ai-sdk/anthropic provider labels Mar 4, 2026
@sylviezhang37 sylviezhang37 force-pushed the bedrock-anthropic-provider-options branch from c7ee050 to ad80936 Compare March 4, 2026 18:34
@sylviezhang37 sylviezhang37 changed the title feat(provider/bedrock/anthropic): bedrock anthropic provider options feat(amazon-bedrock): bedrock anthropic provider options Mar 4, 2026
@sylviezhang37 sylviezhang37 changed the title feat(amazon-bedrock): bedrock anthropic provider options feat(amazon-bedrock): allow anthropicBeta through bedrock providerOptions in bedrock/anthropic Mar 4, 2026
sylviezhang37 added a commit that referenced this pull request Mar 4, 2026
…m providers (#13059)

<!--
Welcome to contributing to AI SDK! We're excited to see your changes.

We suggest you read the following contributing guide we've created
before submitting:

https://github.com/vercel/ai/blob/main/CONTRIBUTING.md
-->

## Background

<!-- Why was this change necessary? -->

`amazon-bedrock/anthropic` requires `anthropic_beta` in its request body
to enable extended capabilities for anthropic models, like 1M context
(context-1m-2025-08-07) and fine-grained tool streaming
(fine-grained-tool-streaming-2025-05-14).

## Summary

<!-- What did you change? -->

- `anthropic`: added `anthropicBeta` and forwarded to downstream
providers via transformRequestBody
- `amazon-bedrock`: receive betas passed from upstream

I also explored handling this gap in `amazon-bedrock` instead (see this
[draft PR](#13054) if you're curious).
Ultimately I think this is the cleanest solution. If we want to allow
both `anthropic` and `bedrock` namespaces, we can handle this on the
Gateway / client side via better education.

## Manual Verification

<!--
For features & bugfixes.
Please explain how you *manually* verified that the change works
end-to-end as expected (excluding automated tests).
Remove the section if it's not needed (e.g. for docs).
-->

- added example scripts

## Checklist

<!--
Do not edit this list. Leave items unchecked that don't apply. If you
need to track subtasks, create a new "## Tasks" section

Please check if the PR fulfills the following requirements:
-->

- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

- Make these changes in v6 too

## Related Issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider provider/anthropic Issues related to the @ai-sdk/anthropic provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant