Skip to content

feat: add MiniMax provider support#27

Merged
jrswab merged 1 commit intojrswab:masterfrom
snichme:master
Mar 14, 2026
Merged

feat: add MiniMax provider support#27
jrswab merged 1 commit intojrswab:masterfrom
snichme:master

Conversation

@snichme
Copy link
Contributor

@snichme snichme commented Mar 13, 2026

Adds MiniMax as a new provider that wraps the Anthropic provider with a different base URL. MiniMax provides an Anthropic-compatible API, so the implementation reuses all Anthropic logic.

  • Add MiniMax to knownAPIKeyEnvVars (MINIMAX_API_KEY)
  • Add NewMiniMax constructor returning *Anthropic
  • Add minimax to supportedProviders in registry
  • Add tests for config, registry, and provider

Summary

This update adds MiniMax as a new provider to the codebase. MiniMax exposes an Anthropic-compatible API, so the implementation wraps the existing Anthropic provider with a custom base URL and endpoint configuration. The changes include new configuration support for the MINIMAX_API_KEY environment variable, a new constructor function, provider registration, and comprehensive test coverage.

Changelog

Added

  • MiniMax provider support with NewMiniMax constructor function
  • MINIMAX_API_KEY environment variable mapping in config
  • MiniMax provider registration in the supported providers registry
  • Test coverage for MiniMax API key configuration and resolution
  • Test coverage for MiniMax provider instantiation with and without custom base URL
  • Test coverage for MiniMax provider error handling (missing API key)
  • Test verification that MiniMax is reported as a supported provider

Adds MiniMax as a new provider that wraps the Anthropic provider with a
different base URL. MiniMax provides an Anthropic-compatible API, so the
implementation reuses all Anthropic logic.

- Add MiniMax to knownAPIKeyEnvVars (MINIMAX_API_KEY)
- Add NewMiniMax constructor returning *Anthropic
- Add minimax to supportedProviders in registry
- Add tests for config, registry, and provider
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

Support for the "minimax" provider is integrated across configuration, registry, and provider packages. Changes include adding API key environment variable mapping, creating a NewMiniMax constructor with HTTP client configuration, registering the provider in the dispatcher, and comprehensive test coverage for all provider interactions.

Changes

Cohort / File(s) Summary
Configuration
internal/config/config.go, internal/config/config_test.go
Added MINIMAX_API_KEY environment variable mapping with tests verifying env var precedence and fallback to config values.
Provider Implementation
internal/provider/minimax.go
Introduced NewMiniMax constructor that initializes an Anthropic instance with API key validation, custom HTTP client (no redirects), and support for functional options.
Provider Registry
internal/provider/registry.go, internal/provider/registry_test.go
Registered minimax in the supported providers map, added dispatch logic for provider instantiation with baseURL option handling, and extended test coverage with four new test cases validating creation, configuration, and error scenarios.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

✨ A new provider joins the fold,
MiniMax marches bold and bright,
With API keys mapped just right,
And HTTP clients tuned just so—
The registry now lets it flow! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add MiniMax provider support' clearly and concisely summarizes the main change—adding a new provider to the codebase.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
internal/provider/registry_test.go (1)

102-107: Either include opencode here or rename the test.

TestSupported_KnownProviders sounds like the full canonical list, but this slice still skips one supported provider.

🧹 Tiny cleanup
-	for _, name := range []string{"anthropic", "openai", "ollama", "google", "minimax"} {
+	for _, name := range []string{"anthropic", "openai", "ollama", "opencode", "google", "minimax"} {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/provider/registry_test.go` around lines 102 - 107, The test
TestSupported_KnownProviders lists supported provider names but omits
"opencode", causing the test name to be misleading; update the slice in
TestSupported_KnownProviders to include "opencode" (or alternatively rename the
test to indicate it's a partial list) so the list accurately reflects all
providers that Supported(name) should accept; edit the test function
TestSupported_KnownProviders and the string slice used there to add "opencode"
(or rename the test) so Supported is validated consistently.
🤖 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/provider/minimax.go`:
- Around line 15-16: The error returned when apiKey == "" in
internal/provider/minimax.go is not actionable; update the error message to tell
callers exactly how to fix it (e.g., which env var or config key to set) by
changing the fmt.Errorf(...) to include a provider-specific hint referencing the
expected credential name (mention the apiKey variable and the Minimax provider),
for example instructing to set MINIMAX_API_KEY or the appropriate config field
when creating the Minimax client so callers know which "knob" to turn.

In `@internal/provider/registry_test.go`:
- Around line 206-224: Update the two tests to assert the provider's baseURL
rather than only successful construction: after calling New("minimax", ...)
type-assert the returned p to *Anthropic (or fail the test if the assertion
fails), then check the internal baseURL field equals the expected default
MiniMax URL in TestNew_MiniMax and equals "http://custom:8080" in
TestNew_MiniMaxWithBaseURL; update test failure messages to include the actual
baseURL when it differs. Ensure you reference the New function and the
*Anthropic type and its baseURL field when making these assertions.

---

Nitpick comments:
In `@internal/provider/registry_test.go`:
- Around line 102-107: The test TestSupported_KnownProviders lists supported
provider names but omits "opencode", causing the test name to be misleading;
update the slice in TestSupported_KnownProviders to include "opencode" (or
alternatively rename the test to indicate it's a partial list) so the list
accurately reflects all providers that Supported(name) should accept; edit the
test function TestSupported_KnownProviders and the string slice used there to
add "opencode" (or rename the test) so Supported is validated consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0a1e8dd0-3749-4fc5-9b68-cf3975c263eb

📥 Commits

Reviewing files that changed from the base of the PR and between b9fa17d and e4f80ff.

⛔ Files ignored due to path filters (2)
  • docs/plans/033_minimax_implement.md is excluded by !docs/**
  • docs/plans/033_minimax_provider_spec.md is excluded by !docs/**
📒 Files selected for processing (5)
  • internal/config/config.go
  • internal/config/config_test.go
  • internal/provider/minimax.go
  • internal/provider/registry.go
  • internal/provider/registry_test.go

Copy link
Owner

@jrswab jrswab left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the work!

@jrswab jrswab merged commit ac24302 into jrswab:master Mar 14, 2026
4 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.

2 participants