Skip to content

fix: disable toolStreaming for all @ai-sdk/anthropic-backed providers#23766

Closed
kevinxinzhao wants to merge 2 commits intoanomalyco:devfrom
kevinxinzhao:fix/eager-input-streaming-custom-providers
Closed

fix: disable toolStreaming for all @ai-sdk/anthropic-backed providers#23766
kevinxinzhao wants to merge 2 commits intoanomalyco:devfrom
kevinxinzhao:fix/eager-input-streaming-custom-providers

Conversation

@kevinxinzhao
Copy link
Copy Markdown

@kevinxinzhao kevinxinzhao commented Apr 21, 2026

Issue for this PR

Closes #23767

Type of change

  • Bug fix

What does this PR do?

@ai-sdk/anthropic >=3.0.58 injects eager_input_streaming: true into every tool definition when the fine-grained-tool-streaming-2025-05-14 beta header is active. Proxies and API gateways that validate request schemas strictly (e.g. AWS Bedrock proxies, corporate LLM gateways) reject this unknown field with a 400 error.

Commit 81b7b58 already fixed this for the github-copilot provider by setting toolStreaming: false, but the guard was inside the providerID.includes("github-copilot") check, so custom providers configured with "npm": "@ai-sdk/anthropic" were not covered.

This PR moves the toolStreaming: false check ahead of the providerID guard, so it applies to all @ai-sdk/anthropic-backed providers. The Copilot-specific maxOutputTokens logic remains gated as before.

How did you verify your code works?

Tested with a custom @ai-sdk/anthropic provider pointing to an AWS Bedrock proxy — tool calls complete successfully without the eager_input_streaming error.

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

rekram1-node and others added 2 commits April 22, 2026 00:35
Proxies and API gateways (e.g. AWS Bedrock, corporate gateways) that use
@ai-sdk/anthropic perform strict JSON schema validation and reject the
eager_input_streaming field injected by @ai-sdk/anthropic >=3.0.58 when
the fine-grained-tool-streaming beta header is active.

The previous fix (81b7b58) only covered the github-copilot provider.
Move the toolStreaming: false guard ahead of the providerID check so it
applies to every @ai-sdk/anthropic-backed provider.
@kevinxinzhao kevinxinzhao force-pushed the fix/eager-input-streaming-custom-providers branch from cfa3407 to 6cc9df0 Compare April 22, 2026 04:52
@rekram1-node
Copy link
Copy Markdown
Collaborator

we dont want to disabel it across the board, also this isn't the correct location for it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eager_input_streaming field breaks custom @ai-sdk/anthropic providers (Bedrock proxies, corporate gateways)

2 participants