Skip to content

feat: add MiniMax (MiniMax) provider#626

Open
octo-patch wants to merge 1 commit into
vitali87:mainfrom
octo-patch:octo/add-minimax-provider
Open

feat: add MiniMax (MiniMax) provider#626
octo-patch wants to merge 1 commit into
vitali87:mainfrom
octo-patch:octo/add-minimax-provider

Conversation

@octo-patch

Copy link
Copy Markdown

Summary

Add MiniMax as a new LLM provider, compatible with the existing provider architecture.

Changes

  • Add MiniMaxProvider class in providers/base.py (modeled after OllamaProvider, uses OpenAIChatModel + PydanticOpenAIProvider with MiniMax OpenAI-compatible endpoint)
  • Add Provider.MINIMAX enum value in constants.py
  • Add MINIMAX_DEFAULT_ENDPOINT and ENV_MINIMAX_API_KEY constants
  • Add MINIMAX_NO_KEY error message in exceptions.py
  • Register MiniMaxProvider in PROVIDER_REGISTRY
  • Add unit tests in test_provider_classes.py (configuration, validation, model creation, env key resolution, registry integration)
  • Add MiniMax configuration example in docs/getting-started/configuration.md

Testing

  • All changed files pass syntax validation
  • Unit tests added covering provider instantiation, validation, model creation, and registry integration
  • Relies on CI for full test suite execution (pymgclient build dependency requires system libraries)

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds MiniMax as a new OpenAI-compatible LLM provider. The main changes are:

  • New minimax provider enum value, default endpoint, and API key constant.
  • New MiniMaxProvider using PydanticAI OpenAIChatModel with PydanticOpenAIProvider.
  • Provider registry wiring and unit tests for MiniMax configuration and model creation.
  • MiniMax configuration example in the getting started docs.
  • Editable package version update in uv.lock.

Confidence Score: 4/5

The MiniMax provider wiring is mostly localized, but the global environment key path needs attention before merge.

The changed provider implementation and tests are focused, and the main remaining risk is a concrete configuration validation gap for MiniMax users who rely on the documented environment variable.

codebase_rag/constants.py and the configuration validation path that handles provider-level API key environment variables.

T-Rex T-Rex Logs

What T-Rex did

  • The focused Python harness against ModelConfig.validate_api_key reproduced the early ValueError indicating MINIMAX_API_KEY was not set before provider resolution.
  • Post-change wiring shows MINIMAX being recognized as 'minimax', the provider registry mapping minimax to MiniMaxProvider, validation succeeding with an explicit key, a MiniMax-specific missing-key error when key is absent, and create_model returning a pydantic OpenAI model backed by AsyncOpenAI with the provided environment key.
  • Documentation and config validation were updated to reflect the MiniMax provider; after the changes, the doc shows MiniMax lines and a resulting ACCEPTED status, and a harness script was used for both revisions.
  • Artifacts were collected to support review, including the focused repro harness, provider-state logs from before and after changes, and the minimax doc-config validation script used for both revisions.

View all artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
codebase_rag/constants.py:145
**Wire global key validation**
`MINIMAX_API_KEY` is added as a supported fallback here and in `MINIMAX_NO_KEY`, but `ModelConfig.validate_api_key()` only checks provider-level env keys for Anthropic and Azure before rejecting configs with no role-specific `api_key`. When a user sets only `MINIMAX_API_KEY`, CLI startup fails in `validate_models_early()` before `MiniMaxProvider` can resolve the key.

### Agentic Framework
-... ([source](https://app.greptile.com/graph-code/github/vitali87/code-graph-rag/-/custom-context?memory=d4240b05-b763-467a-a6bf-94f73e8b6859))

Reviews (1): Last reviewed commit: "feat: add MiniMax (MiniMax) provider" | Re-trigger Greptile

Comment thread codebase_rag/constants.py
ENV_AZURE_API_KEY = "AZURE_API_KEY"
ENV_AZURE_ENDPOINT = "AZURE_OPENAI_ENDPOINT"
ENV_AZURE_API_VERSION = "AZURE_API_VERSION"
ENV_MINIMAX_API_KEY = "MINIMAX_API_KEY"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Wire global key validation
MINIMAX_API_KEY is added as a supported fallback here and in MINIMAX_NO_KEY, but ModelConfig.validate_api_key() only checks provider-level env keys for Anthropic and Azure before rejecting configs with no role-specific api_key. When a user sets only MINIMAX_API_KEY, CLI startup fails in validate_models_early() before MiniMaxProvider can resolve the key.

Rule Used: ## Technical Requirements

Agentic Framework

-... (source)

Artifacts

Repro: focused MiniMax global API key validation harness

  • Contains supporting evidence from the run (text/x-python; charset=utf-8).

Stack trace captured during the T-Rex run

  • Keeps the raw stack trace available without making the summary code-heavy.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: codebase_rag/constants.py
Line: 145

Comment:
**Wire global key validation**
`MINIMAX_API_KEY` is added as a supported fallback here and in `MINIMAX_NO_KEY`, but `ModelConfig.validate_api_key()` only checks provider-level env keys for Anthropic and Azure before rejecting configs with no role-specific `api_key`. When a user sets only `MINIMAX_API_KEY`, CLI startup fails in `validate_models_early()` before `MiniMaxProvider` can resolve the key.

**Rule Used:** ## Technical Requirements

### Agentic Framework
-... ([source](https://app.greptile.com/graph-code/github/vitali87/code-graph-rag/-/custom-context?memory=d4240b05-b763-467a-a6bf-94f73e8b6859))

How can I resolve this? If you propose a fix, please make it concise.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for MiniMax as a new model provider. It adds the MiniMax provider class, registers it in the provider registry, defines necessary constants and exceptions, includes comprehensive unit tests, and updates the configuration documentation. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@vitali87

vitali87 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

hey @octo-patch thanks for the PR. Please clear the Greptile comment and re-trigger it. I will review only when it reaches 5/5. Thanks.

@vitali87 vitali87 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

read my comment above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants