Skip to content

feat: add MiniMax M2.5 as a provider option#1338

Open
octo-patch wants to merge 1 commit intothedotmack:mainfrom
octo-patch:feat/add-minimax-provider
Open

feat: add MiniMax M2.5 as a provider option#1338
octo-patch wants to merge 1 commit intothedotmack:mainfrom
octo-patch:feat/add-minimax-provider

Conversation

@octo-patch
Copy link

@octo-patch octo-patch commented Mar 12, 2026

Summary

Adds MiniMax as a fourth AI provider alongside Claude, Gemini, and OpenRouter.

  • New MiniMaxAgent using OpenAI-compatible REST API via fetch(), modeled after OpenRouterAgent
  • Supports models MiniMax-M2.5 (default) and MiniMax-M2.5-highspeed with 204K token context
  • Multi-turn conversation, context truncation, token tracking, and fallback to Claude on retriable errors (429/500)
  • Settings: CLAUDE_MEM_MINIMAX_API_KEY, CLAUDE_MEM_MINIMAX_MODEL, CLAUDE_MEM_MINIMAX_BASE_URL, CLAUDE_MEM_MINIMAX_MAX_CONTEXT_MESSAGES, CLAUDE_MEM_MINIMAX_MAX_TOKENS
  • Credential isolation via ~/.claude-mem/.env (MINIMAX_API_KEY)
  • Provider selection integrated in worker-service.ts, SessionRoutes.ts, SettingsRoutes.ts

MiniMax API constraints handled

  • Temperature defaults to 1.0 (MiniMax requires (0.0, 1.0], cannot be 0)
  • Default base URL: https://api.minimax.io/v1 (overseas)
  • No response_format support (uses prompt engineering + XML parsing)

Files changed (8)

File Change
src/services/worker/MiniMaxAgent.ts New provider implementation
tests/minimax_agent.test.ts 6 unit tests (all passing)
src/services/worker-service.ts Provider initialization & fallback chain
src/services/worker-types.ts Added 'minimax' to provider union type
src/services/worker/http/routes/SessionRoutes.ts Provider selection logic
src/services/worker/http/routes/SettingsRoutes.ts Valid provider list
src/shared/EnvManager.ts MINIMAX_API_KEY credential management
src/shared/SettingsDefaultsManager.ts MiniMax config defaults

Test plan

  • Unit tests pass (6/6) via bun test tests/minimax_agent.test.ts
  • Set CLAUDE_MEM_PROVIDER=minimax and CLAUDE_MEM_MINIMAX_API_KEY in settings
  • Verify MiniMax provider is selectable and processes observations
  • Verify fallback to Claude on MiniMax API errors (429/500)
  • Verify non-retriable errors (401) are thrown without fallback

Add MiniMax as a fourth AI provider alongside Claude, Gemini, and
OpenRouter. MiniMax uses OpenAI-compatible REST API via fetch() with
support for models MiniMax-M2.5 and MiniMax-M2.5-highspeed (204K
context window).

Key changes:
- New MiniMaxAgent with multi-turn conversation, context truncation,
  token tracking, and fallback to Claude on retriable errors (429/500)
- Settings: CLAUDE_MEM_MINIMAX_API_KEY, MODEL, BASE_URL, MAX_CONTEXT_MESSAGES, MAX_TOKENS
- Credential isolation via ~/.claude-mem/.env (MINIMAX_API_KEY)
- Provider selection in worker-service, SessionRoutes, SettingsRoutes
- Unit tests (6 passing) covering API calls, multi-turn, observations,
  fallback behavior, and base URL configuration

MiniMax API constraints handled:
- Temperature defaults to 1.0 (must be >0)
- Default base URL: https://api.minimax.io/v1 (overseas)
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