Add MiniMax provider support - #14
Conversation
📝 WalkthroughWalkthroughThe model utilities add MiniMax as an API provider, detect MiniMax Anthropic endpoints, resolve MiniMax model identifiers for Claude configurations, and display MiniMax-specific provider and base-URL labels. ChangesMiniMax Anthropic provider support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant getBuiltinModelStrings
participant isMiniMaxAnthropicBaseUrl
participant ClaudeModelConfig
Client->>getBuiltinModelStrings: request built-in model strings
getBuiltinModelStrings->>isMiniMaxAnthropicBaseUrl: check configured base URL
isMiniMaxAnthropicBaseUrl-->>getBuiltinModelStrings: return endpoint match
getBuiltinModelStrings->>ClaudeModelConfig: select minimax configuration
ClaudeModelConfig-->>Client: return MiniMax model identifier
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/utils/model/modelStrings.ts`:
- Around line 31-36: Centralize the first-party MiniMax-to-minimax mapping in a
shared effective-provider helper, then reuse it in the model configuration
lookup, deprecation handling, and provider metadata lookup so `minimax: null`
retirement entries and the `minimax` status label are reachable. Preserve the
raw provider for first-party transport and base-URL decisions, and add coverage
for both MiniMax hosts.
In `@src/utils/model/providers.ts`:
- Around line 8-17: Update getAnthropicBaseUrlHost and
isFirstPartyAnthropicBaseUrl so an unset ANTHROPIC_BASE_URL retains the default
first-party behavior, while configured values that URL parsing rejects return
false rather than being treated as first-party. Add tests covering unset,
malformed, allowed, and disallowed URLs.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 898c9da6-46b2-45ca-8623-f6d2500ec79b
📒 Files selected for processing (6)
src/utils/model/configs.tssrc/utils/model/deprecation.tssrc/utils/model/model.tssrc/utils/model/modelStrings.tssrc/utils/model/providers.tssrc/utils/status.tsx
| const resolvedProvider = | ||
| provider === 'firstParty' && isMiniMaxAnthropicBaseUrl() | ||
| ? 'minimax' | ||
| : provider | ||
| for (const key of MODEL_KEYS) { | ||
| out[key] = ALL_MODEL_CONFIGS[key][provider] | ||
| out[key] = ALL_MODEL_CONFIGS[key][resolvedProvider] |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Centralize effective-provider resolution.
This branch correctly maps a first-party MiniMax endpoint to the minimax model configuration. However, the conversion is local. getAPIProvider() still returns firstParty, so src/utils/model/deprecation.ts never selects the new minimax: null retirement entries, and the minimax provider label in src/utils/status.tsx is unreachable.
Extract a shared effective-provider helper and use it for model, deprecation, and provider metadata lookup. Keep the raw provider where the first-party transport and base-URL branch are required. Add tests covering both MiniMax hosts.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/utils/model/modelStrings.ts` around lines 31 - 36, Centralize the
first-party MiniMax-to-minimax mapping in a shared effective-provider helper,
then reuse it in the model configuration lookup, deprecation handling, and
provider metadata lookup so `minimax: null` retirement entries and the `minimax`
status label are reachable. Preserve the raw provider for first-party transport
and base-URL decisions, and add coverage for both MiniMax hosts.
| function getAnthropicBaseUrlHost(): string | null { | ||
| const baseUrl = process.env.ANTHROPIC_BASE_URL | ||
| if (!baseUrl) { | ||
| return null | ||
| } | ||
| try { | ||
| return new URL(baseUrl).host | ||
| } catch { | ||
| return null | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reject malformed configured URLs.
getAnthropicBaseUrlHost() returns null when ANTHROPIC_BASE_URL is unset and when new URL(baseUrl) fails. isFirstPartyAnthropicBaseUrl() then returns true for both cases. A value such as ANTHROPIC_BASE_URL=not-a-url is accepted instead of rejected.
Treat only an unset value as the default API. Return false for a configured value that cannot be parsed. Add tests for unset, malformed, allowed, and disallowed URLs.
Proposed fix
export function isFirstPartyAnthropicBaseUrl(): boolean {
+ if (!process.env.ANTHROPIC_BASE_URL) {
+ return true
+ }
const host = getAnthropicBaseUrlHost()
if (!host) {
- return true
+ return false
}Also applies to: 44-47
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/utils/model/providers.ts` around lines 8 - 17, Update
getAnthropicBaseUrlHost and isFirstPartyAnthropicBaseUrl so an unset
ANTHROPIC_BASE_URL retains the default first-party behavior, while configured
values that URL parsing rejects return false rather than being treated as
first-party. Add tests covering unset, malformed, allowed, and disallowed URLs.
Reason: Wire MiniMax model strings and base URL handling into the registry so MiniMax endpoints resolve correctly.
Updated the provider map, model string selection, display labels, and deprecation metadata for MiniMax.
Checked with
npx -y -p typescript@5.7.3 tsc --noEmit.Summary by CodeRabbit