feat: add MiniMax provider support#14
Conversation
📝 WalkthroughWalkthroughMiniMax is added as an API provider with model mappings, regional endpoint selection, pricing, thinking behavior, runtime classification, status reporting, environment propagation, and setup documentation. ChangesMiniMax provider integration
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
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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
🧹 Nitpick comments (1)
src/utils/modelCost.ts (1)
90-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer modelId-based lookup over array index access for MiniMax cost constants.
MINIMAX_M3_COSTandMINIMAX_M27_COSTare built usingMINIMAX_MODELS[0]andMINIMAX_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 satisfyModelCosts. TheMODEL_COSTSkeys 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 ModelCostsAlso 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
📒 Files selected for processing (19)
README.en.mdREADME.mdsrc/commands/feedback/index.tssrc/services/analytics/config.tssrc/services/api/client.tssrc/utils/apiPreconnect.tssrc/utils/auth.tssrc/utils/context.tssrc/utils/log.tssrc/utils/managedEnvConstants.tssrc/utils/model/configs.tssrc/utils/model/deprecation.tssrc/utils/model/model.tssrc/utils/model/modelOptions.tssrc/utils/model/providers.tssrc/utils/modelCost.tssrc/utils/status.tsxsrc/utils/swarm/spawnUtils.tssrc/utils/thinking.ts
Reason: add target provider/model to existing provider registry
Checks:
git diff --checknode package/cli.js --versionSummary by CodeRabbit
New Features
Bug Fixes