Skip to content

feat: add MiniMax as first-class LLM provider (OpenAI-compat, M2.7, 204K context)#18

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

feat: add MiniMax as first-class LLM provider (OpenAI-compat, M2.7, 204K context)#18
octo-patch wants to merge 1 commit into
BradMoonUESTC:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

Finite Monkey Engine is an AI-driven smart-contract audit platform. All LLM calls currently flow through src/openai_api/openai.py using OPENAI_API_BASE / OPENAI_API_KEY environment variables, which makes it straightforward to plug in any OpenAI-compatible provider.

This PR adds first-class MiniMax support by introducing automatic provider detection and a temperature-clamping helper, so users can switch to MiniMax's high-context-window models without changing any other code.

Changes

File What changed
src/openai_api/openai.py _init_llm_config() auto-detects MiniMax; _clamp_temperature() enforces (0.01, 1.0]
env.example New MINIMAX_API_KEY / LLM_PROVIDER section with model presets
README.md "Using MiniMax as LLM Provider" section with quickstart table
tests/test_minimax_provider.py 20 unit tests
tests/integration/test_minimax_integration.py 7 integration tests

How it works

Auto-detection (zero config change for existing users):

# Option A: explicit
LLM_PROVIDER=minimax
MINIMAX_API_KEY=your-key

# Option B: just set the key — if OPENAI_API_KEY is absent, MiniMax is auto-selected
MINIMAX_API_KEY=your-key

_init_llm_config() runs at module import time and writes OPENAI_API_BASE=api.minimax.io + OPENAI_API_KEY=<minimax_key> into the process environment. Every existing helper (ask_openai_common, detect_vulnerabilities, etc.) then routes to MiniMax automatically — no other code changes needed.

Supported MiniMax models (all with 204 K context):

Model Best for
MiniMax-M2.7 Flagship — vulnerability detection & reasoning
MiniMax-M2.7-highspeed Fast JSON extraction & summarization
MiniMax-M2.5 Previous generation
MiniMax-M2.5-highspeed Previous generation fast variant

Temperature safety: _clamp_temperature() enforces MiniMax's (0.0, 1.0] constraint (nudging 0 → 0.01) and is harmless for any other provider.

Testing

# Unit tests (20 tests)
python -m unittest discover -s tests -p "test_minimax_provider.py" -v

# Integration tests (7 tests)
python -m unittest discover -s tests/integration -p "test_minimax_integration.py" -v

All 27 tests pass.

Auto-detects MiniMax when MINIMAX_API_KEY is set (or LLM_PROVIDER=minimax),
routing all audit LLM calls to api.minimax.io/v1 transparently. Includes
temperature clamping helper for MiniMax's (0.0, 1.0] constraint, MiniMax
model presets in env.example and README, and 27 unit + integration tests.

Supported models (204K context): MiniMax-M2.7, MiniMax-M2.7-highspeed,
MiniMax-M2.5, MiniMax-M2.5-highspeed.
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.

1 participant