providers: plumb anthropic base_url + surface MiniMax-M3#220
Open
szmickhuang wants to merge 3 commits into
Open
providers: plumb anthropic base_url + surface MiniMax-M3#220szmickhuang wants to merge 3 commits into
szmickhuang wants to merge 3 commits into
Conversation
Mirror the OpenAIProvider pattern: the constructor accepts an optional `base_url` and the lazy SDK client forwards it to `Anthropic(**kwargs)`. When unset, behavior is identical to stock Anthropic (api.anthropic.com). This unlocks Anthropic-protocol-compatible gateways (third-party Claude or MiniMax endpoints) without forking the provider class. The change is strictly additive — no model or call-payload semantics shift.
…erify Three coordinated changes so the new AnthropicProvider.base_url is actually reachable end-to-end from the GUI: 1. `anthropic` ProviderDescriptor gains an optional `base_url` field with a stock-api.anthropic.com placeholder, so Settings renders the input. 2. `_build_anthropic` reads `base_url` from the SecretStore profile and forwards it to AnthropicProvider, matching the OpenAIProvider pattern. 3. `verify_provider_key`'s anthropic branch stops hardcoding api.anthropic.com and instead probes the user-configured endpoint so Settings → Test can validate a third-party gateway. Untouched: gemini, ollama, openai branches (already configurable) and the OpenAI-compatible vendor slots (already honor user-edited base_url).
The 'add model' suggestion list (COMPAT_MODELS in server/manager.py) already lists `MiniMax-M3`, but the picker wouldn't show it because the curated matrix was the source of truth for label + capability and had no row for it. Add `minimax:MiniMax-M3` next to `MiniMax-M2.5` with the same agentic capabilities (tools + parallel + streaming; vision left off, matching M2.5). Capabilities stay symmetric with M2.5 on purpose — until M3's vision/PDF support is probed via a real probe, the matrix should not advertise features that would degrade gracefully into pdf_support fallback at runtime.
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.
Why
The Anthropic-compatible provider was hardcoded to
api.anthropic.com, which made it impossible to route through any Anthropic-protocol gateway (e.g. minimax's CN endpoint, AWS Bedrock's anthropic adapter, Azure AI Foundry's Anthropic endpoint).This blocks anyone whose account is on a non-Anthropic-fronted Claude service — most notably minimax's China Code Plan customers who already have a paid subscription but no way to point coworker at
https://api.minimaxi.com/anthropic.What (3 commits)
b967e4fproviders: make Anthropic endpoint configurable via base_url— constructor accepts optionalbase_url; the lazy SDK client forwards it toAnthropic(**kwargs). When unset, behavior is identical to stock Anthropic.d0eaa81providers: plumb anthropic base_url through descriptor, _build, and verify— descriptor field,_build_anthropicplumbing, and the settings UI now expose anEndpoint (optional)input.c4ad00aproviders: surface MiniMax-M3 in the curated model matrix— addsminimax:MiniMax-M3alongsideminimax:MiniMax-M2.5so the picker offers the current top-tier model.Total diff: +31/-3 across
coworker/providers/{anthropic_provider.py,registry.py,matrix.py}. All additive; no behavior change for stock Anthropic users.Verification
End-to-end smoke test against
api.minimaxi.com/anthropic/v1/messageswith a valid Code Plan key:Also confirmed by OpenClaw gateway log:
provider=minimax-cn api=anthropic-messages model=MiniMax-M3 status=200 elapsedMs=4161.The smoke test scripts live at
/tmp/smoke_m3_v3.pyand/tmp/smoke_curl2.shfor repro.Risk
_client = Anthropic(api_key=key)runs unchanged when nobase_urlis set, so existing Claude-API users see no difference.registry.pychange is scoped to_build_anthropiconly; OpenAI / Gemini builders untouched.Notes for reviewer
Endpointfield is optional in the Settings UI; placeholder ishttps://your-anthropic-protocol-gateway.example/anthropic.minimax:MiniMax-M3) — no auto-discovery, so no surprise models leaking into the picker.