feat: add MiniMax provider support - #596
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe gateway adds direct MiniMax planner support with configurable regions, protocols, endpoints, model aliases, pricing metadata, AI SDK clients, context-window handling, environment overrides, dependency wiring, tests, and operator documentation. ChangesMiniMax provider support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PlannerConfig
participant envOverrides
participant ProviderIndex
participant MiniMaxCatalog
participant AISDKClient
PlannerConfig->>envOverrides: read MiniMax environment values
envOverrides-->>ProviderIndex: provider.minimax configuration
ProviderIndex->>MiniMaxCatalog: resolve region, protocol, and model ID
MiniMaxCatalog-->>ProviderIndex: endpoint and canonical model
ProviderIndex->>AISDKClient: create OpenAI or Anthropic client
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
867d1fc to
1d2bbce
Compare
Add direct MiniMax model registration, regional endpoint selection, and OpenAI-compatible and Anthropic-compatible adapters for the gateway. Signed-off-by: octo-patch <266937838+octo-patch@users.noreply.github.com>
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
gateway/src/session/overflow.ts (1)
61-64: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAvoid relying on hardcoded array indices for model lookups.
Relying on specific array indices (
[0]and[1]) makes the mapping brittle if the order ofMINIMAX_MODELSincatalog.tschanges or new models are inserted. Consider extracting the context window dynamically by matching the model ID.🛠️ Proposed refactor
// MiniMax - "minimax/MiniMax-M3": MINIMAX_MODELS[0].contextWindow, - "minimax/MiniMax-M2.7": MINIMAX_MODELS[1].contextWindow, + "minimax/MiniMax-M3": MINIMAX_MODELS.find(m => m.id === "MiniMax-M3")?.contextWindow ?? 1_000_000, + "minimax/MiniMax-M2.7": MINIMAX_MODELS.find(m => m.id === "MiniMax-M2.7")?.contextWindow ?? 204_800,🤖 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 `@gateway/src/session/overflow.ts` around lines 61 - 64, Update the MiniMax entries in the context-window mapping to find each model in MINIMAX_MODELS by its model ID and use the matched model’s contextWindow, instead of relying on fixed indices. Preserve the existing keys and ensure both minimax/MiniMax-M3 and minimax/MiniMax-M2.7 resolve dynamically.
🤖 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 `@gateway/.env.example`:
- Line 35: Add the required “# pragma: allowlist secret” annotation to the
MINIMAX_API_KEY placeholder in the environment example, preserving the existing
variable and empty-value format.
In `@gateway/src/provider/index.ts`:
- Around line 177-184: Update the Anthropic branch in the provider resolution
flow to fall back from providerCfg.anthropicBaseURL to the generic
providerCfg.baseURL before endpoints.anthropicBaseURL. Preserve the existing
/anthropic suffix validation and createAnthropic behavior.
---
Nitpick comments:
In `@gateway/src/session/overflow.ts`:
- Around line 61-64: Update the MiniMax entries in the context-window mapping to
find each model in MINIMAX_MODELS by its model ID and use the matched model’s
contextWindow, instead of relying on fixed indices. Preserve the existing keys
and ensure both minimax/MiniMax-M3 and minimax/MiniMax-M2.7 resolve dynamically.
🪄 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: 15abbaca-a976-4416-b0de-edad1ce1d6f2
⛔ Files ignored due to path filters (1)
gateway/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (10)
gateway/.env.examplegateway/README.mdgateway/package.jsongateway/src/config/loader.tsgateway/src/config/schema.tsgateway/src/provider/catalog.tsgateway/src/provider/index.tsgateway/src/session/overflow.tsgateway/tests/provider/minimax.test.tsgateway/tests/session/overflow-threshold.test.ts
1d2bbce to
5e8d9e7
Compare
|
Updated the MiniMax provider metadata to match the target model pricing and regional docs roots, added the generic baseURL fallback for the Anthropic-compatible endpoint, and refreshed the related tests/docs. I ran |
Reason: add target provider/model to existing provider registry.
Summary
MiniMax-M3andMiniMax-M2.7with context, pricing, cache, modality, thinking, aliases, and overflow metadata.global_enandcn_zh.Change Type
User-Visible Behavior
Configure the planner with
minimax/MiniMax-M3orminimax/MiniMax-M2.7, select a region, and select the OpenAI-compatible or Anthropic-compatible protocol. Existing configuration remains supported.Security Impact
MINIMAX_API_KEY.Verification
npm install --ignore-scripts(pass)npm test -- --run tests/provider/minimax.test.ts tests/session/overflow-threshold.test.ts(pass, 19 tests)npm test -- --run tests/api/plan-route-filter.test.ts(pass, 2 tests)npm run typecheck(fails at unrelated existingsrc/planner/index.ts:328assistant metadata typing)npm test(29 test files passed; unrelated timing-sensitivetests/api/plan-route-filter.test.tsfailure)Compatibility
Failure Recovery
Remove the MiniMax provider configuration and restore the gateway files in this PR.
Summary by CodeRabbit
New Features
Documentation