feat: add MiniMax as LLM provider (global + China)#1637
Open
kapelame wants to merge 1 commit into
Open
Conversation
Adds MiniMax as two first-class chat providers in `conf/model_providers.yaml`: - `minimax` → https://api.minimax.io/v1 (international) - `minimax-cn` → https://api.minimaxi.com/v1 (China domestic) Both use the OpenAI-compatible litellm provider with `api_base` override (same pattern as `a0_venice`, `nebius`, `ollama_cloud`, etc. in the same file). `models_list.endpoint_url` is set so the Model Configuration plugin can list available models dynamically. Adds a small temperature clamp in `models.py:_adjust_call_args` because MiniMax's API rejects `temperature <= 0` and `> 1` with HTTP 400. Without the clamp, callers passing the LiteLLM/OpenAI default of 0 (deterministic mode) would hit a confusing error. The clamp fires when: - the resolved provider name is `minimax` or `minimax-cn`, OR - the api_base URL contains "minimax" (covers users who set up MiniMax via the generic "openai" provider with custom api_base), OR - the model name contains "minimax" (extra safety) Adds `tests/test_minimax_provider.py` with 10 tests covering YAML registration of both providers and the temperature clamp's positive + negative cases. Recommended models: `MiniMax-M2.7`, `MiniMax-M2.7-highspeed`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds MiniMax as two first-class chat providers:
minimax→https://api.minimax.io/v1(international)minimax-cn→https://api.minimaxi.com/v1(China domestic)Both use the OpenAI-compatible litellm provider with
api_baseoverride — same pattern asa0_venice,nebius, andollama_cloudalready in the file.models_list.endpoint_urlis set so the Model Configuration plugin can list available models dynamically.Why two entries
MiniMax ships separate global (
api.minimax.io) and China (api.minimaxi.com) endpoints with separate accounts and API keys — users on one side don't have credentials for the other. Two entries lets each user pick the one they signed up for without manually editingapi_base.Temperature clamp
MiniMax's API rejects
temperature <= 0and> 1with HTTP 400. Without a clamp, callers passing the LiteLLM/OpenAI default of0(deterministic mode) hit a confusing error from the upstream API. Added a small clamp inmodels.py:_adjust_call_argsthat fires when:minimaxorminimax-cn, ORapi_baseURL containsminimax(catches users who set up MiniMax via the genericopenaiprovider + customapi_base), ORminimax(extra safety net)In-range values (
0 < temp <= 1) are passed through unchanged.Tests
tests/test_minimax_provider.pyadds 10 tests:api_basein the YAMLAll 10 pass locally with the pinned
requirements.txtenv.Recommended models
MiniMax-M2.7(latest flagship) andMiniMax-M2.7-highspeed(lower-latency variant). Users select the provider in Settings, then enter the model name.Notes
A previous bot-generated PR (#1275) added the global
minimaxprovider only and went stale (now has merge conflicts, no maintainer review). This PR supersedes it: covers both regions, includes the temp-clamp safety, and the test file uses the same minimal-stubbing style astests/test_model_config_api_keys.py.