Skip to content

feat: add MiniMax M3 as default LLM provider, keep M2.7 - #1191

Open
octo-patch wants to merge 5 commits into
GaiZhenbiao:mainfrom
octo-patch:feature/add-minimax-m25-provider
Open

feat: add MiniMax M3 as default LLM provider, keep M2.7#1191
octo-patch wants to merge 5 commits into
GaiZhenbiao:mainfrom
octo-patch:feature/add-minimax-m25-provider

Conversation

@octo-patch

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

Copy link
Copy Markdown
Contributor

Summary

  • Add MiniMax-M3 as the new default LLM provider (replaces M2.7 as recommended default)
  • Add MiniMax-M3-highspeed with the same capabilities, faster throughput
  • M3 features: 512K context window (vs M2.7's 204K), 128K max output, image input support (multimodal)
  • All M3 models reuse the existing OpenAI-compatible API at https://api.minimax.io/v1 via OpenAIVisionClient
  • M2.7 models are preserved as a stable fallback (still listed in the model selector)
  • M2.5 and the legacy minimax-abab5-chat are removed
  • 23 unit tests + 10 integration tests covering M2.7 and M3

Changes

  • modules/presets.py:
    • Replaced MiniMax-M2.5 / MiniMax-M2.5-highspeed with MiniMax-M3 / MiniMax-M3-highspeed at the top of ONLINE_MODELS
    • Added metadata for M3 / M3-highspeed (524288 token limit, multimodal=True, model_type=MiniMaxM25)
    • Removed legacy minimax-abab5-chat entry from MODEL_METADATA
  • tests/test_minimax_provider.py: 23 unit tests for type detection, metadata, API host, defaults, and removal of M2.5/abab5
  • tests/test_minimax_integration.py: 10 integration tests for M2.7 and M3 chat completions, streaming, system messages, and usage info

Test Plan

  • All 23 unit tests pass
  • All M2.7 and M3 chat completion integration tests pass against api.minimax.io
  • Streaming, system message, and usage info verified for both M2.7 and M3
  • Old minimax-abab5-chat and MiniMax-M2.5 removed
  • M2.7 still available as a fallback

API Reference

- Add MiniMax-M2.5 and MiniMax-M2.5-highspeed to model list (204K context)
- Route M2.5 models through OpenAI-compatible client (api.minimax.io/v1)
- Add MiniMaxM25 model type enum for proper routing
- Add model metadata with API host, token limits, and descriptions
- Preserve backward compatibility with existing minimax-abab5-chat
- Add 22 unit tests and 5 integration tests
- Update README with M2.5 model info

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for MiniMax M2.5 models using MiniMax’s OpenAI-compatible /v1/chat/completions endpoint, integrating them into the existing model metadata/routing system.

Changes:

  • Added MiniMax-M2.5 and MiniMax-M2.5-highspeed to ONLINE_MODELS and MODEL_METADATA (204,800 token context).
  • Introduced ModelType.MiniMaxM25 and routed these models through OpenAIVisionClient using https://api.minimax.io.
  • Added unit/integration tests plus a README update describing the new MiniMax models.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
modules/presets.py Registers the new MiniMax M2.5 models and their metadata (host, token limits, descriptions, model_type).
modules/models/base_model.py Adds MiniMaxM25 to ModelType for metadata-based routing.
modules/models/models.py Routes MiniMaxM25 models through OpenAIVisionClient and reads MINIMAX_API_KEY.
tests/test_minimax_m25.py Adds unit tests for enum presence, metadata entries, host formatting, and routing assertions.
tests/test_minimax_m25_integration.py Adds integration tests that call the MiniMax OpenAI-compatible endpoint directly.
README.md Documents MiniMax M2.5 support in the supported-models table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_minimax_m25_integration.py Outdated
"""Integration tests for MiniMax M2.5 provider - requires MINIMAX_API_KEY."""

import os
import json
Comment thread tests/test_minimax_m25.py Outdated
Comment on lines +131 to +147
def test_m25_env_key_name(self):
"""MiniMax M2.5 routing should use MINIMAX_API_KEY env variable."""
# Verify the env var name used in models.py routing
import inspect
from modules.models import models
source = inspect.getsource(models.get_model)
assert 'os.environ.get("MINIMAX_API_KEY"' in source

def test_old_minimax_routing_preserved(self):
"""Old minimax routing code should still exist."""
import inspect
from modules.models import models
source = inspect.getsource(models.get_model)
assert "ModelType.Minimax" in source
assert "MiniMax_Client" in source


Comment thread modules/models/models.py Outdated
elif model_type == ModelType.MiniMaxM25:
logging.info(f"正在加载 MiniMax M2.5 模型: {model_name}")
from .OpenAIVision import OpenAIVisionClient
access_key = os.environ.get("MINIMAX_API_KEY", access_key)
Comment thread tests/test_minimax_m25.py Outdated
assert DEFAULT_METADATA["temperature"] == 1.0

def test_m25_uses_default_temperature(self):
"""M2.5 models should use default temperature of 1.0."""
Comment thread tests/test_minimax_m25.py Outdated
"""MiniMaxM25 enum value should exist in ModelType."""
from modules.models.base_model import ModelType
assert hasattr(ModelType, "MiniMaxM25")
assert ModelType.MiniMaxM25.value == 24
Comment on lines +127 to +130
from modules.models.base_model import ModelType
model_type = ModelType.get_type("MiniMax-M2.5")
assert model_type == ModelType.MiniMaxM25

Comment thread tests/test_minimax_m25.py Outdated
Comment on lines +4 to +6
import json
import pytest
from unittest.mock import patch, MagicMock
- Remove unused imports (json, MagicMock, os, patch) from test files
- Replace hard-coded enum value assertion with isinstance check
- Replace brittle inspect.getsource() tests with behavioral routing tests
- Fix env var override: use os.environ.get(MINIMAX_API_KEY) or access_key
  to prevent empty string from overriding a valid access_key
- Fix temperature test to handle config.py DEFAULT_METADATA merge correctly
@octo-patch

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review! Addressed all feedback:

  1. Removed unused imports (json, MagicMock, os, patch) from both test files
  2. Replaced brittle inspect.getsource() tests with behavioral routing tests that call ModelType.get_type() directly
  3. Fixed env var override: changed os.environ.get("MINIMAX_API_KEY", access_key) to os.environ.get("MINIMAX_API_KEY") or access_key so empty string does not override a valid key
  4. Removed hard-coded enum value assertion — now uses isinstance(value, int) instead of checking == 24
  5. Fixed temperature test to account for config.py DEFAULT_METADATA merge via .get() fallback

Please take another look!

Add MiniMax's latest M2.7 flagship models alongside existing M2.5
models. M2.7 offers enhanced reasoning capabilities via the same
OpenAI-compatible API. Listed before M2.5 as the recommended default.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
@octo-patch octo-patch changed the title feat: add MiniMax M2.5 model support via OpenAI-compatible API feat: add MiniMax M2.5/M2.7 as first-class LLM provider via OpenAI-compatible API Mar 18, 2026
PR Bot and others added 2 commits March 18, 2026 13:10
Add MiniMax's latest M2.7 flagship models alongside existing M2.5
models. M2.7 offers enhanced reasoning capabilities via the same
OpenAI-compatible API. Listed before M2.5 as the recommended default.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
@octo-patch octo-patch changed the title feat: add MiniMax M2.5/M2.7 as first-class LLM provider via OpenAI-compatible API feat: add MiniMax M3 as default LLM provider, keep M2.7 Jun 2, 2026
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.

2 participants