Skip to content

feat(providers): add MiniMax provider support#265

Merged
SantiagoDePolonia merged 1 commit into
ENTERPILOT:mainfrom
octo-patch:feature/add-minimax-provider
Apr 23, 2026
Merged

feat(providers): add MiniMax provider support#265
SantiagoDePolonia merged 1 commit into
ENTERPILOT:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch

@octo-patch octo-patch commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add MiniMax chat model provider using the OpenAI-compatible API (https://api.minimax.io/v1)
  • Implement temperature clamping: MiniMax requires temperature in (0.0, 1.0] — zero values are automatically remapped to the default 1.0
  • Add MINIMAX_API_KEY and MINIMAX_BASE_URL environment variable support
  • Add unit tests covering auth headers, chat endpoint routing, temperature clamping, and interface assertions
  • Register MiniMax provider in main.go and document in CLAUDE.md and .env.template

Supported Models

Model ID Description
MiniMax-M2.7 Peak Performance. Ultimate Value. Master the Complex
MiniMax-M2.7-highspeed Same performance, faster and more agile

API Reference

Configuration

MINIMAX_API_KEY=your-api-key
# Optional, defaults to https://api.minimax.io/v1
MINIMAX_BASE_URL=https://api.minimax.io/v1

Summary by CodeRabbit

Release Notes

  • New Features

    • Added MiniMax as a newly supported AI model provider with OpenAI-compatible API integration.
  • Documentation

    • Updated configuration guides to document MiniMax provider setup and required environment variables (MINIMAX_API_KEY and MINIMAX_BASE_URL).
  • Chores

    • Added environment variable templates for MiniMax configuration.

- Add MiniMax chat model provider using OpenAI-compatible API
- Clamp temperature to (0.0, 1.0] range (MiniMax rejects temperature=0)
- Add MINIMAX_API_KEY and MINIMAX_BASE_URL environment variable support
- Add unit tests for provider, temperature clamping, and interface assertions
- Register MiniMax provider in main.go and document in CLAUDE.md and .env.template
@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

MiniMax provider support is being integrated into the application. Changes include adding environment variable templates, updating documentation, registering the provider in the main application, implementing a new MiniMax provider that wraps an OpenAI-compatible client with temperature handling logic, and adding comprehensive test coverage.

Changes

Cohort / File(s) Summary
Configuration & Documentation
.env.template, CLAUDE.md
Added MiniMax environment variable templates (MINIMAX_API_KEY, MINIMAX_BASE_URL) and updated provider documentation to include MiniMax in the supported providers list.
Provider Registration
cmd/gomodel/main.go
Imported and registered the MiniMax provider with the provider factory; updated API description to list MiniMax among supported LLM providers.
MiniMax Provider Implementation
internal/providers/minimax/minimax.go
Introduced new Provider type wrapping an OpenAI-compatible client, with custom temperature clamping logic (defaults to 1.0 for non-positive values), Bearer token authorization, and delegation of chat completions, streaming, model listing, embeddings, and passthrough operations.
Provider Tests
internal/providers/minimax/minimax_test.go
Added comprehensive test suite verifying correct API path usage, authorization headers, temperature clamping behavior, and provider interface conformance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new provider hops into our warren,
MiniMax arrives with API keen,
Temperature clamps and headers gleaming bright,
From config to tests, all patterns lean—
Our LLM garden grows once more!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat(providers): add MiniMax provider support' directly and clearly summarizes the main change—adding MiniMax provider support to the application.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Apr 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds MiniMax as a new OpenAI-compatible provider, closely following the established ZAI provider pattern. The implementation is clean and well-structured, with correct registration, environment variable support, and documentation updates. The notable addition over other compatible providers is clampTemperature, which remaps disallowed zero temperatures to 1.0 per MiniMax's API constraint.

Key changes:

  • internal/providers/minimax/minimax.go — New provider wrapping openai.CompatibleProvider; adds clampTemperature to enforce MiniMax's (0.0, 1.0] temperature range
  • internal/providers/minimax/minimax_test.go — Tests for auth header, chat endpoint routing, zero-temperature clamping, and interface assertions
  • cmd/gomodel/main.go — MiniMax registered in the provider factory
  • .env.template / CLAUDE.md — Env vars and provider list updated

Issue to resolve:

  • clampTemperature only guards against temperature ≤ 0 but allows values > 1.0 to pass through unmodified. Since MiniMax explicitly rejects temperatures outside (0.0, 1.0], a request with temperature = 1.5 would reach the API and fail. The upper bound should be clamped to 1.0, and a test covering that case should be added.

Confidence Score: 4/5

Safe to merge after fixing the missing upper-bound temperature clamp.

The implementation is otherwise complete and correct — it mirrors the well-tested ZAI provider pattern, registration is wired up properly, and the lower-bound temperature fix is tested. The one concrete gap (no upper-bound clamp despite an explicit API constraint of (0.0, 1.0]) would cause API-level failures for callers who pass temperature > 1.0, but is a targeted, easy fix before merge.

internal/providers/minimax/minimax.go — clampTemperature needs an upper-bound guard; minimax_test.go needs a matching test case.

Important Files Changed

Filename Overview
internal/providers/minimax/minimax.go New MiniMax provider following the ZAI pattern; temperature clamping only handles the lower bound (0 → 1.0) but not the upper bound (> 1.0), which contradicts the stated API constraint of (0.0, 1.0].
internal/providers/minimax/minimax_test.go Good coverage for auth, endpoint routing, nil/zero temperature clamping, and interface assertions; missing a test case for temperature > 1.0.
cmd/gomodel/main.go MiniMax registration added correctly in the factory chain.
.env.template MINIMAX_API_KEY and MINIMAX_BASE_URL entries added correctly.
CLAUDE.md MiniMax added to provider list and env-var documentation; accurate and complete.

Sequence Diagram

sequenceDiagram
    participant Client
    participant GoModel Gateway
    participant MiniMax Provider
    participant MiniMax API

    Client->>GoModel Gateway: POST /v1/chat/completions (temperature may be 0 or >1)
    GoModel Gateway->>MiniMax Provider: ChatCompletion(req)
    MiniMax Provider->>MiniMax Provider: clampTemperature(req)<br/>0 → 1.0  |  >1.0 → (not clamped ⚠️)
    MiniMax Provider->>MiniMax API: POST /chat/completions<br/>Authorization: Bearer {MINIMAX_API_KEY}
    MiniMax API-->>MiniMax Provider: JSON response
    MiniMax Provider-->>GoModel Gateway: *core.ChatResponse
    GoModel Gateway-->>Client: OpenAI-compatible response
Loading

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

Comment thread internal/providers/minimax/minimax.go

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/providers/minimax/minimax_test.go`:
- Around line 54-94: Add a new test mirroring
TestChatCompletion_ClampsZeroTemperature that verifies temperatures >1 are
clamped to 1; create e.g. TestChatCompletion_ClampsAboveOne that uses
NewWithHTTPClient and provider.ChatCompletion with Temperature set to 1.5 and
asserts the captured request body (gotBody) does not contain `"temperature":1.5`
and does contain `"temperature":1`; reference the same test server handler
pattern and core.ChatRequest/ChatCompletion call to locate where to insert this
complementary upper-bound assertion for clampTemperature.

In `@internal/providers/minimax/minimax.go`:
- Around line 69-79: clampTemperature currently only maps non-positive
temperatures to defaultTemperature but does not enforce the documented upper
bound; update clampTemperature (in minimax.go) to ensure any req.Temperature >
1.0 is set to 1.0 (keep using defaultTemperature when nil or <= 0), e.g. copy
req into cloned := *req, compute t := *req.Temperature with bounds t =
max(min(t, 1.0), smallestPositive) or set to defaultTemperature when <= 0,
assign cloned.Temperature = &t and return &cloned; also add a unit test in
minimax_test.go for Temperature > 1.0 to verify clamping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4909225d-9a6b-4d37-9bdc-f66dbb472944

📥 Commits

Reviewing files that changed from the base of the PR and between 92283fe and 8ba6c64.

📒 Files selected for processing (5)
  • .env.template
  • CLAUDE.md
  • cmd/gomodel/main.go
  • internal/providers/minimax/minimax.go
  • internal/providers/minimax/minimax_test.go

Comment thread internal/providers/minimax/minimax_test.go
Comment thread internal/providers/minimax/minimax.go
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 46.66667% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/providers/minimax/minimax.go 47.72% 23 Missing ⚠️
cmd/gomodel/main.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@SantiagoDePolonia

Copy link
Copy Markdown
Contributor

@octo-patch Thank you! That's a good increment!

Feel free to message me about any suggestion or any issues you encounter. Merging!

@SantiagoDePolonia SantiagoDePolonia merged commit af9d31b into ENTERPILOT:main Apr 23, 2026
12 checks passed
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.

3 participants