Skip to content

Add MiniMax provider support - #14

Open
octo-patch wants to merge 1 commit into
tanbiralam:mainfrom
octo-patch:octo/20260802-provider-add-recvqGlousdeKL
Open

Add MiniMax provider support#14
octo-patch wants to merge 1 commit into
tanbiralam:mainfrom
octo-patch:octo/20260802-provider-add-recvqGlousdeKL

Conversation

@octo-patch

@octo-patch octo-patch commented Aug 2, 2026

Copy link
Copy Markdown

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

  • New Features
    • Added support for MiniMax as an Anthropic-compatible model provider.
    • Added MiniMax M3 and M2.7 model names and display labels.
    • MiniMax Anthropic endpoints are now recognized and labeled correctly.
    • Standard and staging Anthropic endpoints continue to be supported, while malformed URLs remain invalid.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

MiniMax Anthropic provider support

Layer / File(s) Summary
Provider type and endpoint detection
src/utils/model/providers.ts
Adds the minimax provider, shared base-URL parsing, MiniMax endpoint detection, and MiniMax support in first-party URL validation.
MiniMax model resolution
src/utils/model/configs.ts, src/utils/model/deprecation.ts, src/utils/model/model.ts, src/utils/model/modelStrings.ts
Adds MiniMax model identifiers, retirement metadata, public names, marketing names, and MiniMax configuration selection for matching first-party endpoints.
MiniMax status labeling
src/utils/status.tsx
Adds MiniMax provider and base-URL labels and updates the generated source map.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% 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 title clearly and concisely describes the pull request's main change: adding MiniMax provider support.
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6f6f12b and 30341e5.

📒 Files selected for processing (6)
  • src/utils/model/configs.ts
  • src/utils/model/deprecation.ts
  • src/utils/model/model.ts
  • src/utils/model/modelStrings.ts
  • src/utils/model/providers.ts
  • src/utils/status.tsx

Comment on lines +31 to +36
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]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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.

Comment on lines +8 to +17
function getAnthropicBaseUrlHost(): string | null {
const baseUrl = process.env.ANTHROPIC_BASE_URL
if (!baseUrl) {
return null
}
try {
return new URL(baseUrl).host
} catch {
return null
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

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