Skip to content

feat: add MiniMax as a model provider (default M3)#2717

Open
octo-patch wants to merge 3 commits into
ModelEngine-Group:mainfrom
octo-patch:feature/add-minimax-provider
Open

feat: add MiniMax as a model provider (default M3)#2717
octo-patch wants to merge 3 commits into
ModelEngine-Group:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch

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

Copy link
Copy Markdown

Summary

Add MiniMax as a first-class model provider in nexent, with MiniMax-M3 as the default LLM.

What is MiniMax?

MiniMax is a leading AI company offering powerful LLM and embedding models:

  • MiniMax-M3 (default): Latest flagship model with 512K context, up to 128K output, image input support
  • MiniMax-M2.7 / MiniMax-M2.7-highspeed: 192K context window (previous generation, kept for back-compat)
  • embo-01: Embedding model with 1536 dimensions

All models are accessible via an OpenAI-compatible API at https://api.minimax.io/v1.

Changes

Backend (5 files):

  • backend/services/providers/minimax_provider.py — New MiniMaxModelProvider with model type classification (LLM, embedding, TTS, STT, reranker, VLM) and known context window sizes for M3 / M2.7 / M2.7-highspeed
  • backend/consts/provider.py — Add MINIMAX enum, base URL, and models endpoint
  • backend/services/providers/__init__.py — Export MiniMaxModelProvider
  • backend/services/model_provider_service.py — Wire MiniMax into factory
  • backend/services/model_management_service.py — Add MiniMax base URL for batch create

Frontend (5 files):

  • frontend/hooks/model/useMinimaxModelList.ts — Batch import hook (follows DashScope pattern)
  • frontend/app/[locale]/models/components/model/ModelAddDialog.tsx — Add MiniMax to provider dropdown
  • frontend/const/modelConfig.ts — Provider constants (icon, hint, link)
  • frontend/public/locales/{en,zh}/common.json — i18n translations
  • frontend/public/minimax.png — Provider icon

Tests (1 file):

  • test/backend/services/providers/test_minimax_provider.py — Unit tests covering all model types, known context windows (M3 / M2.7 / M2.7-highspeed), error handling, authorization header, and mixed type classification

Why

MiniMax-M3 is the latest model, with a 512K context window, up to 128K output, and image input support. M2.7 is retained as a back-compatibility alternative; older M2.5 entries have been removed.

Test Plan

  • Unit tests updated and passing (M3 / M2.7 / M2.7-highspeed)
  • All existing provider tests continue to pass
  • Manual verification: batch import MiniMax models with API key
  • Manual verification: MiniMax models appear in model list with correct types

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
30.3% Duplication on New Code (required ≤ 3%)
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@octo-patch octo-patch requested a review from Dallas98 as a code owner June 7, 2026 06:01
@octo-patch octo-patch changed the title feat: add MiniMax as a model provider feat: add MiniMax as a model provider (default M3) Jun 7, 2026

async with httpx.AsyncClient(verify=False) as client:
response = await client.get(url, headers=headers)
response.raise_for_status()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

安全风险:verify=False 禁用了 SSL 证书验证,生产环境下容易遭受中间人攻击。建议从配置读取或默认为 True

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch — fixed in c38ef2c. verify now comes from provider_config.get("ssl_verify", True), so it defaults to True and can only be disabled by explicit operator opt-in (matching the existing ssl_verify config flow elsewhere in the codebase).


async with httpx.AsyncClient(verify=False) as client:
response = await client.get(url, headers=headers)
response.raise_for_status()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

缺少 timeout 配置:httpx.AsyncClient(verify=False) 没有设置 timeout。如果 MiniMax API 响应缓慢或挂起,请求会无限等待。建议添加 timeout=15.0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in c38ef2c — added timeout=15.0 to httpx.AsyncClient. Also added a regression test (test_get_models_timeout already covered ConnectTimeout, the new test_get_models_ssl_verify_defaults_to_true asserts the timeout kwarg is set).

@WMC001

WMC001 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

LGTM. MiniMax provider integration follows the existing pattern. No issues found.

PR Bot and others added 3 commits June 24, 2026 16:31
Add MiniMax (https://www.minimaxi.com/) as a first-class model provider
alongside SiliconFlow, DashScope, and TokenPony. MiniMax offers LLM models
(M2.7 with 1M context, M2.5/M2.5-highspeed with 204K context) and the
embo-01 embedding model.

Backend:
- Add MiniMaxModelProvider with model type classification (LLM, embedding,
  TTS, STT, reranker, VLM) and known context window sizes
- Register provider in factory, enum, and base URL constants
- Wire into model_management_service for batch create flow

Frontend:
- Add useMinimaxModelList hook for batch import
- Add MiniMax option in ModelAddDialog provider dropdown
- Add provider constants (icon, hint, link) and i18n translations (en/zh)

Tests:
- Add 16 unit tests covering all model types, error handling, context
  windows, and auth header verification
- Add MiniMax-M3 to model context map and set as default
- Keep MiniMax-M2.7 and MiniMax-M2.7-highspeed (correct 192K context)
- Remove older M2.5/M2.5-highspeed models
- Update related unit tests to match the new model list
- Make SSL verification configurable via provider_config['ssl_verify'],
  defaulting to True (no more unconditional verify=False)
- Add a 15s request timeout to httpx.AsyncClient to prevent
  indefinite hangs if the MiniMax API is slow/stalled
- Add unit tests covering both behaviors

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
@octo-patch octo-patch force-pushed the feature/add-minimax-provider branch from c38ef2c to edf4330 Compare June 24, 2026 08:33
@octo-patch

Copy link
Copy Markdown
Author

Rebased onto the latest main and resolved the merge conflicts — they were all additive (the new volcengine provider entries alongside our minimax ones in the provider maps and locale files). Backend and frontend provider tests pass locally. Should be clean to merge now.

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.

3 participants