Add MiniMax as a first-class API model provider - #1968
Open
octo-patch wants to merge 1 commit into
Open
Conversation
MiniMax exposes an OpenAI-compatible chat completions API. Add MiniMax and AsyncMiniMax model classes and a from_minimax factory that wrap the openai SDK, alongside a MiniMaxTypeAdapter that formats text, image and video inputs and reuses the OpenAI response_format handling. - Register MiniMax/AsyncMiniMax in the models package and the BlackBoxModel / AsyncBlackBoxModel unions. - Expose both regional OpenAI-compatible endpoints via MINIMAX_BASE_URLS (global and cn). - Normalize MiniMax errors through the OpenAI SDK exception map. - Document MiniMax-M3 (1,000,000 token context; text, image, video input) and MiniMax-M2.7 (204,800 token context; text input). - Add unit tests for the model wrappers and the type adapter, plus docs.
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: Outlines has first-class API model adapters but no MiniMax adapter.
Summary
Adds MiniMax as a first-class API model provider. MiniMax exposes an
OpenAI-compatible chat completions API, so
MiniMax/AsyncMiniMaxwrap theopenaiSDK, mirroring the existingSGLangandOpenAIintegrations.Changes
src/outlines/models/minimax.py: newMiniMax,AsyncMiniMax,from_minimax, andMiniMaxTypeAdapter.MiniMaxTypeAdapterformats text, image and video inputs into the contentparts expected by the OpenAI-compatible endpoint, and reuses the OpenAI
response_formathandling for JSON schema / JSON mode structured outputs.MINIMAX_BASE_URLSexposes both regional OpenAI-compatible endpoints(global
https://api.minimax.io/v1and cnhttps://api.minimaxi.com/v1)so callers select the region on their
openaiclient.src/outlines/models/__init__.py: registerMiniMax/AsyncMiniMax/from_minimaxin the package and theBlackBoxModel/AsyncBlackBoxModelunions.
src/outlines/exceptions.py: route MiniMax through the OpenAI SDK exceptionmap (it uses the
openaiclient), matching vLLM and SGLang.MiniMax-M3(1,000,000 token context window;text, image and video input) and
MiniMax-M2.7(204,800 token contextwindow; text input).
tests/models/test_minimax.pyandtests/models/test_minimax_type_adapter.py: unit tests for the modelwrappers (mocked client) and the type adapter, including image and video
inputs and structured output formatting.
docs/features/models/minimax.md, mkdocs nav entry, README APIsupport line and the model index list.
Testing
ruff check --config=pyproject.toml(repo-pinned ruff 0.9.1) on all changedPython files: passes.
pytest tests/models/test_minimax.py tests/models/test_minimax_type_adapter.py:20 passed.
pytest tests/models/test_openai_type_adapter.py tests/models/test_sglang_type_adapter.py:passes (regression on the reused OpenAI formatting).