feat: add MiniMax provider support#27
Conversation
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
📝 WalkthroughWalkthroughSupport 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.Change the |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/provider/registry_test.go (1)
102-107: Either includeopencodehere or rename the test.
TestSupported_KnownProviderssounds 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
⛔ Files ignored due to path filters (2)
docs/plans/033_minimax_implement.mdis excluded by!docs/**docs/plans/033_minimax_provider_spec.mdis excluded by!docs/**
📒 Files selected for processing (5)
internal/config/config.gointernal/config/config_test.gointernal/provider/minimax.gointernal/provider/registry.gointernal/provider/registry_test.go
jrswab
left a comment
There was a problem hiding this comment.
Looks great, thanks for the work!
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.
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