fix(anthropic): omit tool-streaming beta on MiniMax endpoints#6861
Merged
Conversation
MiniMax's Anthropic-compatible endpoints reject requests that include the fine-grained-tool-streaming beta header — every tool-use message triggers a connection error (~18s timeout). Regular chat works fine. Add _common_betas_for_base_url() that filters out the tool-streaming beta for Bearer-auth (MiniMax) endpoints while keeping all other betas. All four client-construction branches now use the filtered list. Based on #6528 by @HiddenPuppy. Original cherry-picked from PR #6688 by kshitijk4poor. Fixes #6510, fixes #6555.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvage of #6688 by @kshitijk4poor (based on #6528 by @HiddenPuppy). Fixes #6510, #6555.
Problem
MiniMax's Anthropic-compatible endpoints (
api.minimax.io/anthropic,api.minimaxi.com/anthropic) reject thefine-grained-tool-streaming-2025-05-14beta header. Regular chat works fine, but any tool-use request triggers an ~18s timeout connection error.Fix
Adds
_common_betas_for_base_url()that filters out the tool-streaming beta for Bearer-auth (MiniMax) endpoints. All four client-construction branches inbuild_anthropic_client()now use the filtered list. Other betas (interleaved-thinking) are kept — MiniMax ignores unrecognized betas harmlessly.Tests
140/140 tests pass across
test_anthropic_adapter.py+test_minimax_provider.py, including 12 new tests covering both MiniMax domains, trailing slashes, non-MiniMax keeps full betas, and direct_common_betas_for_base_url()unit tests.