Skip to content

providers: plumb anthropic base_url + surface MiniMax-M3#220

Open
szmickhuang wants to merge 3 commits into
andrewyng:mainfrom
szmickhuang:fix/anthropic-base-url-and-minimax-m3
Open

providers: plumb anthropic base_url + surface MiniMax-M3#220
szmickhuang wants to merge 3 commits into
andrewyng:mainfrom
szmickhuang:fix/anthropic-base-url-and-minimax-m3

Conversation

@szmickhuang

Copy link
Copy Markdown

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)

  1. b967e4f providers: make Anthropic endpoint configurable via base_url — constructor accepts optional base_url; the lazy SDK client forwards it to Anthropic(**kwargs). When unset, behavior is identical to stock Anthropic.

  2. d0eaa81 providers: plumb anthropic base_url through descriptor, _build, and verify — descriptor field, _build_anthropic plumbing, and the settings UI now expose an Endpoint (optional) input.

  3. c4ad00a providers: surface MiniMax-M3 in the curated model matrix — adds minimax:MiniMax-M3 alongside minimax:MiniMax-M2.5 so 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/messages with a valid Code Plan key:

✓ GET  /v1/models             → 200 (8 models listed)
✓ POST /v1/messages M3        → 200 (stop_reason=end_turn, "我是 MiniMax-M3")
✓ POST /v1/messages M2.7      → 200
✓ POST /v1/chat/completions M3 → 200 (with thinking block)

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.py and /tmp/smoke_curl2.sh for repro.

Risk

  • Anthropic stock path: untouched. _client = Anthropic(api_key=key) runs unchanged when no base_url is set, so existing Claude-API users see no difference.
  • Other providers: registry.py change is scoped to _build_anthropic only; OpenAI / Gemini builders untouched.

Notes for reviewer

  • The Endpoint field is optional in the Settings UI; placeholder is https://your-anthropic-protocol-gateway.example/anthropic.
  • Model additions go through the curated MATRIX (minimax:MiniMax-M3) — no auto-discovery, so no surprise models leaking into the picker.

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.
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.

1 participant