feat: document MiniMax provider setup#1338
Conversation
📝 WalkthroughWalkthrough新增 MiniMax 双区域、双协议供应商配置指南,补充快速开始入口,并为 MiniMax 模型供应商识别及区域化代理 URL 拼接增加测试覆盖。 ChangesMiniMax provider support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
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!
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