feat: add MiniMax provider support - #106
Open
octo-patch wants to merge 2 commits into
Open
Conversation
Add MiniMax as a new PREFERRED_PROVIDER option alongside OpenAI, Google, and Anthropic. MiniMax exposes an OpenAI-compatible endpoint, so models prefixed with minimax/ are routed through LiteLLM's openai provider using a configurable api_base and api_key. - Add MINIMAX_API_KEY and MINIMAX_BASE_URL environment variables - Default MINIMAX_BASE_URL to the global endpoint (https://api.minimax.io/v1); the CN endpoint (https://api.minimaxi.com/v1) is selectable via env - Add MiniMax-M3 and MiniMax-M2.7 to the known model list - Map haiku/sonnet to SMALL_MODEL/BIG_MODEL with the minimax/ prefix when PREFERRED_PROVIDER=minimax - Prefix bare MiniMax models with minimax/ in both message and token-count validators - Select the MiniMax API key and base URL for minimax/ models in create_message and count_tokens - Update .env.example and README with the new configuration
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.
Reason: Add MiniMax provider support — the current model mapping supports only OpenAI, Gemini, and Anthropic; MiniMax-M3/MiniMax-M2.7 and the global/CN endpoints are absent.
Changes
MINIMAX_API_KEYandMINIMAX_BASE_URLenvironment variables.MINIMAX_BASE_URLto the global endpoint (https://api.minimax.io/v1); the CN endpoint (https://api.minimaxi.com/v1) is selectable via env.MiniMax-M3andMiniMax-M2.7to the known model list (MINIMAX_MODELS).PREFERRED_PROVIDER=minimaxsupport:haiku/sonnetmap toSMALL_MODEL/BIG_MODELprefixed withminimax/.minimax/in bothMessagesRequestandTokenCountRequestvalidators.convert_anthropic_to_litellm, translate theminimax/prefix toopenai/for the LiteLLM call so MiniMax's OpenAI-compatible endpoint is used with the configuredapi_baseandapi_key.create_messageandcount_tokens, select the MiniMax API key and base URL forminimax/models..env.exampleandREADME.mdwith the new configuration.Checks
python3 -m py_compile server.py— syntax check passed.uv run python -c "import server; ..."— import and model-mapping assertions passed (sonnet→minimax/MiniMax-M3,haiku→minimax/MiniMax-M2.7, bareMiniMax-M3→minimax/MiniMax-M3, andconvert_anthropic_to_litellmtranslatesminimax/→openai/for the LiteLLM call).