feat: document MiniMax provider setup - #1338
Conversation
📝 WalkthroughWalkthrough新增 MiniMax 双区域、双协议供应商配置指南,补充快速开始入口,并为 MiniMax 模型供应商识别及区域化代理 URL 拼接增加测试覆盖。 ChangesMiniMax 供应商支持
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Code Review
This pull request introduces a comprehensive integration guide for the MiniMax provider, detailing global and regional endpoints, model catalog specifications (for MiniMax-M3 and MiniMax-M2.7), and routing configurations. It also updates model vendor mapping tests and adds unit tests to verify that regional MiniMax protocol base paths are correctly preserved during URL proxy building. The reviewer noted that the link to the new guide was added to the English README but not the Chinese README, and recommended updating both to keep them in sync.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| - **API Docs (Scalar UI)**: `http://localhost:23000/api/actions/scalar` | ||
| - **API Docs (Swagger UI)**: `http://localhost:23000/api/actions/docs` | ||
|
|
||
| For a dual-region, dual-protocol provider setup, see the [MiniMax provider guide](docs/providers/minimax.md). |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/app/v1/url.test.ts (1)
19-47: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value建议使用
test.each编写参数化测试。当前的
for...of循环测试是没问题的。不过,使用 Vitest 原生的test.each可以让测试运行器单独报告每一个用例的执行状态;如果某一条数据断言失败,测试日志中能够更精准地指出是哪一组baseUrl出了问题。♻️ 建议的重构
- test("preserves regional MiniMax protocol base paths", () => { - const cases = [ - { - baseUrl: "https://api.minimax.io/v1", - requestPath: "/v1/chat/completions", - expectedUrl: "https://api.minimax.io/v1/chat/completions", - }, - { - baseUrl: "https://api.minimaxi.com/v1", - requestPath: "/v1/chat/completions", - expectedUrl: "https://api.minimaxi.com/v1/chat/completions", - }, - { - baseUrl: "https://api.minimax.io/anthropic", - requestPath: "/v1/messages", - expectedUrl: "https://api.minimax.io/anthropic/v1/messages", - }, - { - baseUrl: "https://api.minimaxi.com/anthropic", - requestPath: "/v1/messages", - expectedUrl: "https://api.minimaxi.com/anthropic/v1/messages", - }, - ]; - - for (const { baseUrl, requestPath, expectedUrl } of cases) { - expectBuiltUrl(baseUrl, requestPath, expectedUrl); - } - }); + test.each([ + { + baseUrl: "https://api.minimax.io/v1", + requestPath: "/v1/chat/completions", + expectedUrl: "https://api.minimax.io/v1/chat/completions", + }, + { + baseUrl: "https://api.minimaxi.com/v1", + requestPath: "/v1/chat/completions", + expectedUrl: "https://api.minimaxi.com/v1/chat/completions", + }, + { + baseUrl: "https://api.minimax.io/anthropic", + requestPath: "/v1/messages", + expectedUrl: "https://api.minimax.io/anthropic/v1/messages", + }, + { + baseUrl: "https://api.minimaxi.com/anthropic", + requestPath: "/v1/messages", + expectedUrl: "https://api.minimaxi.com/anthropic/v1/messages", + }, + ])("preserves regional MiniMax protocol base paths for $baseUrl", ({ baseUrl, requestPath, expectedUrl }) => { + expectBuiltUrl(baseUrl, requestPath, expectedUrl); + });🤖 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 `@tests/unit/app/v1/url.test.ts` around lines 19 - 47, 将 preserves regional MiniMax protocol base paths 测试中的 cases 数组与 for...of 循环改为 Vitest 的 test.each 参数化测试,使每组 baseUrl、requestPath 和 expectedUrl 作为独立用例执行并单独报告;保持现有四组输入及 expectBuiltUrl 断言行为不变。
🤖 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.
Nitpick comments:
In `@tests/unit/app/v1/url.test.ts`:
- Around line 19-47: 将 preserves regional MiniMax protocol base paths 测试中的 cases
数组与 for...of 循环改为 Vitest 的 test.each 参数化测试,使每组 baseUrl、requestPath 和 expectedUrl
作为独立用例执行并单独报告;保持现有四组输入及 expectBuiltUrl 断言行为不变。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0f52d004-0f50-4726-9cac-c7e5eeb26d50
📒 Files selected for processing (5)
README.en.mddocs/providers/minimax.mdsrc/lib/model-vendor-icons.test.tssrc/lib/model-vendor/vendor-inference.test.tstests/unit/app/v1/url.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a49b2e328
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| ## Request Routing | ||
|
|
||
| Use `MiniMax-M3` or `MiniMax-M2.7` as the requested model ID. If the provider's allowed model list is configured, use exact-match entries for both IDs and keep both models available for routing. Existing model redirect rules can still map an application-specific name to either target model without changing the upstream provider URL. |
There was a problem hiding this comment.
Include redirect source models in allowlists
With the setup described here, a provider allowlist containing only MiniMax-M3/MiniMax-M2.7 prevents redirect aliases from ever selecting the provider: providerSupportsModel checks the original requested model against allowedModels before redirects, and modelRedirects are applied only after provider selection (src/app/v1/_lib/proxy/provider-selector.ts:70-88). In any deployment that maps an application-specific name such as claude-sonnet -> MiniMax-M3, the MiniMax provider is filtered out as model_not_allowed, so this guidance should say to leave allowedModels empty or add the source alias/rule too.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Code Review Summary
This PR adds a MiniMax provider setup guide (docs/providers/minimax.md), a README link to it, and regression tests covering vendor inference, icon resolution, and proxy URL building for the two target model IDs. No production source code changes; the diff is documentation plus test-only additions. All new assertions were traced against the current implementations and hold.
PR Size: S
- Lines changed: 87 (87 additions, 0 deletions)
- Files changed: 5
Issues Found
| Category | Critical | High | Medium | Low |
|---|---|---|---|---|
| Logic/Bugs | 0 | 0 | 0 | 0 |
| Security | 0 | 0 | 0 | 0 |
| Error Handling | 0 | 0 | 0 | 0 |
| Types | 0 | 0 | 0 | 0 |
| Comments/Docs | 0 | 0 | 0 | 0 |
| Tests | 0 | 0 | 0 | 0 |
| Simplification | 0 | 0 | 0 | 0 |
No significant issues identified.
Verification Notes
inferVendorFromModelName("MiniMax-M3")and("MiniMax-M2.7")both resolve tominimaxvia the keyword rule/minimax|\\babab/(src/lib/model-vendor/vendor-inference.ts:150), so the vendor-inference and icon tests pass.- URL assertions match
buildProxyUrl(src/app/v1/_lib/url.ts:108):.../v1+/v1/chat/completionscollapses via the prefix branch (line 117), while.../anthropic+/v1/messagesfalls through to standard concatenation (line 168) yielding.../anthropic/v1/messages. This is consistent with the routing behavior described in the guide. - Docs claims about endpoint construction (OpenAI base includes
/v1, Anthropic base ends at/anthropic) are consistent with the code.
Note: the test suite could not be executed in this environment (dependency install blocked by a read-only filesystem), so results are based on manual tracing against source rather than a live run.
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean (no secrets in docs; guide explicitly directs keys to the provider secret field)
- Error handling - Clean (no new runtime code)
- Type safety - Clean (no new types)
- Documentation accuracy - Consistent with code behavior
- Test coverage - Adequate for the added model IDs
- Code clarity - Good
Automated review by Claude AI
| test("preserves regional MiniMax protocol base paths", () => { | ||
| const cases = [ | ||
| { | ||
| baseUrl: "https://api.minimax.io/v1", | ||
| requestPath: "/v1/chat/completions", | ||
| expectedUrl: "https://api.minimax.io/v1/chat/completions", | ||
| }, | ||
| { | ||
| baseUrl: "https://api.minimaxi.com/v1", | ||
| requestPath: "/v1/chat/completions", | ||
| expectedUrl: "https://api.minimaxi.com/v1/chat/completions", | ||
| }, | ||
| { | ||
| baseUrl: "https://api.minimax.io/anthropic", | ||
| requestPath: "/v1/messages", | ||
| expectedUrl: "https://api.minimax.io/anthropic/v1/messages", | ||
| }, | ||
| { | ||
| baseUrl: "https://api.minimaxi.com/anthropic", | ||
| requestPath: "/v1/messages", | ||
| expectedUrl: "https://api.minimaxi.com/anthropic/v1/messages", | ||
| }, | ||
| ]; | ||
|
|
||
| for (const { baseUrl, requestPath, expectedUrl } of cases) { | ||
| expectBuiltUrl(baseUrl, requestPath, expectedUrl); | ||
| } | ||
| }); |
There was a problem hiding this comment.
English test name in otherwise Chinese-named file
All surrounding tests in this file use Chinese names (e.g. "标准拼接:baseUrl 无路径时使用 requestPath + search", "避免重复拼接:…"), while the new test uses an English name. This creates a naming inconsistency. Additionally, the four sub-cases are bundled inside a single test() with a for…of loop; if one fails, Vitest only reports a single test failure without identifying which of the four cases was the culprit. The vendor-inference.test.ts sibling file uses it.each(cases) for the same kind of parametrized scenario, which gives one named result per case.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/unit/app/v1/url.test.ts
Line: 19-46
Comment:
**English test name in otherwise Chinese-named file**
All surrounding tests in this file use Chinese names (e.g. `"标准拼接:baseUrl 无路径时使用 requestPath + search"`, `"避免重复拼接:…"`), while the new test uses an English name. This creates a naming inconsistency. Additionally, the four sub-cases are bundled inside a single `test()` with a `for…of` loop; if one fails, Vitest only reports a single test failure without identifying which of the four cases was the culprit. The `vendor-inference.test.ts` sibling file uses `it.each(cases)` for the same kind of parametrized scenario, which gives one named result per case.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| ## Provider Entries | ||
|
|
||
| Create one `claude` provider entry and one `openai-compatible` provider entry for each region. Set the provider URL to the matching value from the endpoint matrix and set the provider's allowed model list to the exact model IDs below. |
There was a problem hiding this comment.
[HIGH] [COMMENT-INACCURATE] The provider setup treats MiniMax-M3 as valid for the Anthropic-compatible entry.
Why this is a problem: MiniMax's Anthropic-compatible API currently documents the M2.x model family, while MiniMax-M3 is documented for the OpenAI-compatible text-generation API. Following this instruction creates a claude provider that allows MiniMax-M3, but requests sent to /anthropic/v1/messages can be rejected by the upstream service because that protocol does not support the model.
Suggested fix:
Create one `openai-compatible` provider entry per region for `MiniMax-M3`.
Create `claude` provider entries only for Anthropic-compatible models such as `MiniMax-M2.7`.
Set each provider's allowed model list to only the model IDs supported by that protocol.|
|
||
| ## Request Routing | ||
|
|
||
| Use `MiniMax-M3` or `MiniMax-M2.7` as the requested model ID. If the provider's allowed model list is configured, use exact-match entries for both IDs and keep both models available for routing. Existing model redirect rules can still map an application-specific name to either target model without changing the upstream provider URL. |
There was a problem hiding this comment.
[HIGH] [COMMENT-INACCURATE] The redirect guidance conflicts with provider selection's allowlist order.
Why this is a problem: providerSupportsModel() checks allowedModels against the original requested model before provider selection, while ModelRedirector.apply() runs only after a provider has been selected. If an operator follows the preceding instruction and allows only MiniMax-M3/MiniMax-M2.7, a request for an application-specific alias is filtered out as model_not_allowed before its redirect to MiniMax can run.
Suggested fix:
If you route an application-specific alias through `modelRedirects`, either leave `allowedModels` empty or include both the source alias and the upstream MiniMax target model.
Example:
- allowed models: `claude-sonnet-4-5`, `MiniMax-M3`
- redirect rule: `claude-sonnet-4-5` -> `MiniMax-M3`There was a problem hiding this comment.
Code Review Summary
The diff is documentation plus test-only additions. Runtime code is unchanged, but two new guide instructions can lead operators to create MiniMax providers that either send unsupported models to the Anthropic-compatible endpoint or get filtered out before redirects are applied.
PR Size: S
- Lines changed: 87
- Files changed: 5
Issues Found
| Category | Critical | High | Medium | Low |
|---|---|---|---|---|
| Logic/Bugs | 0 | 0 | 0 | 0 |
| Security | 0 | 0 | 0 | 0 |
| Error Handling | 0 | 0 | 0 | 0 |
| Types | 0 | 0 | 0 | 0 |
| Comments/Docs | 0 | 2 | 0 | 0 |
| Tests | 0 | 0 | 0 | 0 |
| Simplification | 0 | 0 | 0 | 0 |
Critical Issues (Must Fix)
None.
High Priority Issues (Should Fix)
docs/providers/minimax.md:21— the provider-entry guidance treatsMiniMax-M3as valid for aclaudeprovider even though MiniMax's Anthropic-compatible API documents the M2.x family, so following the guide can produce upstream request failures.docs/providers/minimax.md:52— the allowlist guidance conflicts with provider selection order:allowedModelsis checked against the original request beforemodelRedirectsrun, so alias-based routes are filtered out before they can redirect to MiniMax.
Review Coverage
- Logic and correctness
- Security (OWASP Top 10)
- Error handling
- Type safety
- Documentation accuracy
- Test coverage
- Code clarity
Automated review by Codex AI
|
Updated the MiniMax-M3 pricing in the provider guide and pushed a new commit. I ran git diff --check; the targeted Vitest tests were unavailable because dependencies are not installed in the worktree. |
Reason: add target provider/model to existing provider registry.
Summary
Adds comprehensive documentation for configuring MiniMax models (MiniMax-M3 and MiniMax-M2.7) through the repository's existing provider types, including regional endpoint support for both Global and China regions.
Problem
Related Issues:
MiniMax offers dual-region, dual-protocol endpoints that need explicit configuration guidance. Users need to understand:
Solution
Created a new provider documentation structure under
docs/providers/with a comprehensive MiniMax setup guide that covers:Changes
Documentation
Test Coverage
Added regression tests for MiniMax models (MiniMax-M3, MiniMax-M2.7):
Testing
Automated Tests
bunx vitest run tests/unit/app/v1/url.test.ts src/lib/model-vendor/vendor-inference.test.ts src/lib/model-vendor-icons.test.tsbunx biome check tests/unit/app/v1/url.test.ts src/lib/model-vendor/vendor-inference.test.ts src/lib/model-vendor-icons.test.tsbun run typecheckbun run lintManual Testing
Documentation review:
Notes
docs/providers/directory for provider-specific guidesChecklist
Greptile Summary
This PR adds documentation and tests for the MiniMax provider (models
MiniMax-M3andMiniMax-M2.7), covering dual-region (Global/China) and dual-protocol (OpenAI-compatible/Anthropic-compatible) endpoint configuration. No runtime logic is changed.docs/providers/minimax.md: New guide with endpoint matrix, model catalog (pricing, context window, modalities), and provider entry instructions. Provider type names (claude,openai-compatible) correctly match the codebase.tests/unit/app/v1/url.test.ts: Four new cases confirm existingbuildProxyUrlrouting handles both the/v1(version-root) and/anthropic(non-version prefix) base URL shapes correctly.MiniMax-M3andMiniMax-M2.7resolve to the\"minimax\"vendor via the existing/minimax|\\babab/keyword rule.Confidence Score: 5/5
Safe to merge — documentation and tests only, no runtime logic is touched.
All changes are documentation and tests. The new test cases exercise existing
buildProxyUrlpaths that are already well-covered, vendor inference tests match the existing keyword rule correctly, and the documented provider type names (claude,openai-compatible) align with what the codebase actually uses.Files Needing Attention: No files require special attention; the README link placement is a minor style point.
Important Files Changed
claude,openai-compatible).buildProxyUrllogic; all expected outputs are consistent with the function's path-deduplication and version-root behaviour.MiniMax-M3andMiniMax-M2.7inference test cases; both IDs lower-case to strings matched by the existing `/minimaxMiniMax-M3andMiniMax-M2.7; consistent with vendor-inference additions and follows the existingit.eachparametrised pattern in the file.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Incoming Request] --> B{Protocol?} B -->|OpenAI-compatible| C{Region?} B -->|Anthropic-compatible| D{Region?} C -->|Global| E["Provider: openai-compatible\nBase URL: api.minimax.io/v1\nResult: /v1/chat/completions"] C -->|China| F["Provider: openai-compatible\nBase URL: api.minimaxi.com/v1\nResult: /v1/chat/completions"] D -->|Global| G["Provider: claude\nBase URL: api.minimax.io/anthropic\nResult: /anthropic/v1/messages"] D -->|China| H["Provider: claude\nBase URL: api.minimaxi.com/anthropic\nResult: /anthropic/v1/messages"] E --> I[buildProxyUrl: version-root branch] F --> I G --> J[buildProxyUrl: standard concat] H --> JReviews (2): Last reviewed commit: "docs: correct MiniMax M3 pricing" | Re-trigger Greptile