Skip to content

feat: add MiniMax provider support#14

Open
octo-patch wants to merge 3 commits into
LING71671:mainfrom
octo-patch:octo/20260708-add-target-provider-model-to-existing-provider-registry-recvoNo9Tr8ZaA
Open

feat: add MiniMax provider support#14
octo-patch wants to merge 3 commits into
LING71671:mainfrom
octo-patch:octo/20260708-add-target-provider-model-to-existing-provider-registry-recvoNo9Tr8ZaA

Conversation

@octo-patch

@octo-patch octo-patch commented Jul 10, 2026

Copy link
Copy Markdown

Reason: add target provider/model to existing provider registry

  • Register MiniMax-M3 and MiniMax-M2.7 with context, tiered pricing, thinking defaults, and input-modality metadata.
  • Add global and China endpoint selection with both compatible base URL families retained in the registry.
  • Wire provider selection, authentication routing, model display, cost/context handling, and English setup documentation.

Checks:

  • git diff --check
  • Syntax-build all changed TypeScript files with Bun
  • Target coverage assertions
  • Provider registry assertions
  • node package/cli.js --version
  • Anthropic SDK request-path capture
  • Secret scan

Summary by CodeRabbit

  • New Features

    • Added MiniMax provider support, including regional endpoint configuration and supported model selection.
    • Added MiniMax model pricing, context-window details, model labels, and cost reporting.
    • Added MiniMax-specific thinking behavior and status information.
    • Documented MiniMax setup, environment variables, regions, and endpoint compatibility.
  • Bug Fixes

    • Prevented incompatible Anthropic preconnects, analytics, error reporting, and feedback actions when MiniMax is enabled.
    • Preserved MiniMax settings across managed environments and teammate sessions.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

MiniMax is added as an API provider with model mappings, regional endpoint selection, pricing, thinking behavior, runtime classification, status reporting, environment propagation, and setup documentation.

Changes

MiniMax provider integration

Layer / File(s) Summary
Provider registry, model contracts, and pricing
src/utils/model/providers.ts, src/utils/model/configs.ts, src/utils/model/deprecation.ts, src/utils/modelCost.ts
Defines MiniMax regions, endpoints, models, pricing tiers, provider selection, model mappings, deprecation metadata, and cost calculations.
Model selection and thinking behavior
src/utils/model/model.ts, src/utils/model/modelOptions.ts, src/utils/context.ts, src/utils/thinking.ts, src/services/api/claude.ts
Adds MiniMax model picker options, display names, context windows, thinking capability resolution, and request-time thinking handling.
Runtime routing and environment handling
src/services/api/client.ts, src/utils/auth.ts, src/utils/apiPreconnect.ts, src/utils/log.ts, src/services/analytics/config.ts, src/commands/feedback/index.ts, src/utils/managedEnvConstants.ts, src/utils/swarm/spawnUtils.ts
Routes MiniMax requests through selected endpoints and applies provider-specific authentication, telemetry, preconnect, managed-environment, command, and teammate-process behavior.
Status reporting and configuration documentation
src/utils/status.tsx, README.en.md
Reports MiniMax region and Anthropic base URL details and documents environment configuration, regions, endpoints, and protocol bridging.
Estimated code review effort: 4 (Complex) ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant getAPIProvider
  participant getMiniMaxEndpoint
  participant APIClient
  participant AnthropicMessagesAPI
  User->>getAPIProvider: Enable MiniMax with CLAUDE_CODE_USE_MINIMAX
  getAPIProvider-->>APIClient: Select minimax provider
  APIClient->>getMiniMaxEndpoint: Resolve MINIMAX_API_REGION
  getMiniMaxEndpoint-->>APIClient: Return Anthropic-compatible endpoint
  APIClient->>AnthropicMessagesAPI: Send Anthropic Messages request
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.48% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding MiniMax provider support.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

🧹 Nitpick comments (1)
src/utils/modelCost.ts (1)

90-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer modelId-based lookup over array index access for MiniMax cost constants.

MINIMAX_M3_COST and MINIMAX_M27_COST are built using MINIMAX_MODELS[0] and MINIMAX_MODELS[1]. If the array is reordered, the wrong pricing would be silently associated with the wrong model — TypeScript won't catch it because both elements satisfy ModelCosts. The MODEL_COSTS keys at lines 147–148 would also point to the wrong cost object.

♻️ Proposed refactor: lookup by modelId
+const minimaxM3 = MINIMAX_MODELS.find(m => m.modelId === 'MiniMax-M3')!
+const minimaxM27 = MINIMAX_MODELS.find(m => m.modelId === 'MiniMax-M2.7')!
+
 const MINIMAX_M3_COST = {
-  inputTokens: MINIMAX_MODELS[0].pricingUsdPerMillionTokens.input,
-  outputTokens: MINIMAX_MODELS[0].pricingUsdPerMillionTokens.output,
+  inputTokens: minimaxM3.pricingUsdPerMillionTokens.input,
+  outputTokens: minimaxM3.pricingUsdPerMillionTokens.output,
   promptCacheWriteTokens:
-    MINIMAX_MODELS[0].pricingUsdPerMillionTokens.cacheWrite,
+    minimaxM3.pricingUsdPerMillionTokens.cacheWrite,
   promptCacheReadTokens:
-    MINIMAX_MODELS[0].pricingUsdPerMillionTokens.cacheRead,
+    minimaxM3.pricingUsdPerMillionTokens.cacheRead,
   webSearchRequests: 0,
 } as const satisfies ModelCosts

 const MINIMAX_M27_COST = {
-  inputTokens: MINIMAX_MODELS[1].pricingUsdPerMillionTokens.input,
-  outputTokens: MINIMAX_MODELS[1].pricingUsdPerMillionTokens.output,
+  inputTokens: minimaxM27.pricingUsdPerMillionTokens.input,
+  outputTokens: minimaxM27.pricingUsdPerMillionTokens.output,
   promptCacheWriteTokens:
-    MINIMAX_MODELS[1].pricingUsdPerMillionTokens.cacheWrite,
+    minimaxM27.pricingUsdPerMillionTokens.cacheWrite,
   promptCacheReadTokens:
-    MINIMAX_MODELS[1].pricingUsdPerMillionTokens.cacheRead,
+    minimaxM27.pricingUsdPerMillionTokens.cacheRead,
   webSearchRequests: 0,
 } as const satisfies ModelCosts

Also applies to: 147-148

🤖 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/modelCost.ts` around lines 90 - 108, Replace positional
MINIMAX_MODELS[0] and MINIMAX_MODELS[1] access in MINIMAX_M3_COST and
MINIMAX_M27_COST with lookups by the corresponding modelId, preferably using a
shared helper that finds and validates the expected model. Update the
MODEL_COSTS entries to reference costs by explicit model IDs so reordering
MINIMAX_MODELS cannot associate incorrect pricing.
🤖 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/status.tsx`:
- Around line 324-333: Update the MiniMax branch in the status-building logic to
ignore an empty ANTHROPIC_BASE_URL override by using a truthy fallback check
instead of nullish coalescing, matching neighboring provider branches and
preserving endpoint.anthropicBaseUrl when the environment value is blank.
- Line 373: Regenerate the inline source map at the end of src/utils/status.tsx
so its embedded sourcesContent and mappings match the current implementations,
especially buildAPIProviderProperties and related provider-label logic; use the
project’s standard TypeScript build or source-map generation workflow rather
than editing the base64 payload manually.

---

Nitpick comments:
In `@src/utils/modelCost.ts`:
- Around line 90-108: Replace positional MINIMAX_MODELS[0] and MINIMAX_MODELS[1]
access in MINIMAX_M3_COST and MINIMAX_M27_COST with lookups by the corresponding
modelId, preferably using a shared helper that finds and validates the expected
model. Update the MODEL_COSTS entries to reference costs by explicit model IDs
so reordering MINIMAX_MODELS cannot associate incorrect pricing.
🪄 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

Run ID: 0532de8e-e6fb-4f60-9a72-0d4d3ac50a2e

📥 Commits

Reviewing files that changed from the base of the PR and between e54c5af and 9967251.

📒 Files selected for processing (19)
  • README.en.md
  • README.md
  • src/commands/feedback/index.ts
  • src/services/analytics/config.ts
  • src/services/api/client.ts
  • src/utils/apiPreconnect.ts
  • src/utils/auth.ts
  • src/utils/context.ts
  • src/utils/log.ts
  • src/utils/managedEnvConstants.ts
  • src/utils/model/configs.ts
  • src/utils/model/deprecation.ts
  • src/utils/model/model.ts
  • src/utils/model/modelOptions.ts
  • src/utils/model/providers.ts
  • src/utils/modelCost.ts
  • src/utils/status.tsx
  • src/utils/swarm/spawnUtils.ts
  • src/utils/thinking.ts

Comment thread src/utils/status.tsx
Comment thread src/utils/status.tsx Outdated
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