Files
hzhang e44936990c feat: Plexum-minimax-provider v0.1 — MiniMax via Anthropic-compat endpoint
Plexum ProviderPlugin that serves MiniMax models through MiniMax's
Anthropic-compatible HTTP endpoint
(https://api.minimax.io/anthropic, or CN api.minimaxi.com). Inspired
by openclaw's extensions/minimax provider-registration, but rewritten
in Go for Plexum's SDK.

internal/anthropic/ (~210 LOC + 6 tests):
- minimal HTTP+SSE Anthropic Messages client (POST /v1/messages,
  stream:true, parses event:/data: SSE frames)
- handles non-2xx as HTTP error; stream errors land as Event{Type:"error"}
- 1 MiB SSE line cap; per-conn 5min timeout

internal/translate/ (~220 LOC):
- CanonicalToAnthropic: canonical.TurnRequest → MessagesRequest
- blockToAnthropic: TextBlock / ToolUseBlock / ToolResultBlock /
  ThinkingBlock → loose ContentBlock map; preserves signatures + cache
  control
- Translator: per-turn state machine; consumes anthropic.Event stream
  and emits canonical.TurnEvent stream (handles thinking blocks +
  tool_use input_json_delta accumulation + signature_delta capture)

cmd/plexum-minimax-provider-plugin/:
- Plugin manifest declares provider.models = [MiniMax-M2.7,
  MiniMax-M2.7-highspeed]
- Backend fixed to "api" (per scope); region "global"|"cn" + base_url
  override supported via config
- HostConfig from <profile>/plugins/plexum-minimax-provider/config.json
  {api_key, region?, base_url?, max_tokens_default?}

scripts/install.sh: build + manifest emit; operator writes config.json
+ allows plugin + adds an agent + restarts.

End-to-end verified against the real key:
1. plexum say --agent-id mini ... → "Hi, I'm MiniMax!"
2. Multi-turn continuity: agent recalled the prior reply
3. Via gateway socket: {"outcome":"text","text":"\n\npong"}
4. Via Fabric channel (alice posts → plugin inbound → mini agent
   → MiniMax → outbound REST → reply visible in bt2-clean seq=11):
     "Hi there! 👋 Fun fact: Octopuses have three hearts, blue blood,
      and neurons distributed throughout their arms—so their tentacles
      can 'think'"

The MiniMax-M2.7-highspeed variant works the same way but hit a
Code Plan rate-limit ceiling during testing (not a plugin issue).

Deferred:
- OAuth (Code Plan portal) — not in v1 scope per request
- MiniMax Portal provider (separate provider id minimax-portal)
- Image / TTS / video / music providers (separate plugins later)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 16:01:38 +01:00

2.3 KiB
Executable File