fix(auxiliary): explicit_base_url path now respects api_mode=anthropic_messages - #17360
fix(auxiliary): explicit_base_url path now respects api_mode=anthropic_messages#17360konsisumer wants to merge 1 commit into
Conversation
|
Rebased onto latest main (4 upstream commits merged cleanly, no conflicts). All 7 tests in |
4146264 to
b71f52b
Compare
|
Rebased onto latest main (41 upstream commits, no conflicts). All 7 tests in |
b71f52b to
ab877e8
Compare
|
Rebased onto origin/main. All 7 tests in |
0ab4838 to
2e3f475
Compare
|
Rebased onto origin/main (27 upstream commits, no conflicts). All 7 tests in |
|
Rebased onto origin/main (1 upstream commit: docs(tts) — no conflicts). All 7 tests in |
2e3f475 to
8cff874
Compare
|
Rebased onto origin/main (no new upstream commits since last update). All 7 tests in |
8cff874 to
b6a9288
Compare
|
Rebased onto origin/main (no new upstream commits since last update). All 7 tests in |
b4590df to
cc7500f
Compare
|
Rebased onto origin/main (no new upstream commits since last update). All 7 tests in |
|
Rebased onto origin/main (already current — no new upstream commits since last update). All 7 tests in |
cc7500f to
2681016
Compare
|
Rebased onto origin/main (12 upstream commits, no conflicts). All 7 tests in |
2681016 to
be2f04b
Compare
be2f04b to
62eb258
Compare
|
Closing — deferring to #16256 which addresses the same explicit_base_url/api_mode path. Reopen if that PR stalls. |
What changed and why
When
resolve_provider_client()was called with bothexplicit_base_urlandapi_mode=anthropic_messages, the URL was silently mangled:_to_openai_base_url()rewrote any/anthropicsuffix to/v1beforeAnthropicAuxiliaryClientwas constructed, so the Anthropic SDK hit the wrong endpoint surface (e.g.https://api.minimax.io/v1/messagesinstead ofhttps://api.minimax.io/anthropic/messages).PR #7648 fixed this for paths 1 (_try_custom_endpoint) and 2 (named custom providers). This PR fixes the remaining path 3 — the
explicit_base_urlbranch — by adding an explicit early-return forapi_mode=anthropic_messagesthat:/anthropic → /v1URL rewrite (needed only for OpenAI-wire).AnthropicAuxiliaryClientdirectly, matching the other two paths.anthropicSDK is not installed.Per the collaborator comment on #7661 (alt-glitch, 2026-04-29) mapping the three code paths.
How to test
New tests:
test_explicit_base_url_anthropic_messages_builds_anthropic_wrapper— correct wrapper type returnedtest_explicit_base_url_anthropic_messages_url_not_mangled—/anthropicsuffix preservedtest_explicit_base_url_anthropic_messages_falls_back_when_sdk_missing— graceful OpenAI-wire fallbacktest_explicit_base_url_chat_completions_still_uses_openai_wire— regression: default path unchangedWhat platforms tested on
macOS Darwin 24.6.0, Python 3.x
Fixes #7661