Skip to content

feat: document MiniMax provider setup#1338

Open
octo-patch wants to merge 1 commit into
ding113:devfrom
octo-patch:octo/20260715-add-target-provider-model-to-existing-provider-registry-recvoNoGZtmLGU
Open

feat: document MiniMax provider setup#1338
octo-patch wants to merge 1 commit into
ding113:devfrom
octo-patch:octo/20260715-add-target-provider-model-to-existing-provider-registry-recvoNoGZtmLGU

Conversation

@octo-patch

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

Copy link
Copy Markdown

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:

  • How to configure separate provider entries for each region and protocol
  • Exact endpoint URLs and model IDs
  • Pricing tiers and context window limits
  • Multimodal capabilities and thinking settings

Solution

Created a new provider documentation structure under docs/providers/ with a comprehensive MiniMax setup guide that covers:

  • Endpoint matrix for both Global and China regions
  • OpenAI-compatible and Anthropic-compatible protocol URLs
  • Complete model catalog with pricing, context limits, and capabilities
  • Provider entry configuration guidelines
  • Request routing instructions

Changes

Documentation

  • README.en.md: Added link to MiniMax provider guide
  • docs/providers/minimax.md: New comprehensive guide with endpoint matrix, model catalog, and configuration instructions

Test Coverage

Added regression tests for MiniMax models (MiniMax-M3, MiniMax-M2.7):

  • src/lib/model-vendor-icons.test.ts: Vendor icon inference tests
  • src/lib/model-vendor/vendor-inference.test.ts: Vendor inference from model name tests
  • tests/unit/app/v1/url.test.ts: Regional endpoint URL routing tests covering all four endpoint combinations (Global/China x OpenAI/Anthropic protocols)

Testing

Automated Tests

  • Focused Vitest passes: bunx vitest run tests/unit/app/v1/url.test.ts src/lib/model-vendor/vendor-inference.test.ts src/lib/model-vendor-icons.test.ts
  • Changed-file Biome check passes: bunx biome check tests/unit/app/v1/url.test.ts src/lib/model-vendor/vendor-inference.test.ts src/lib/model-vendor-icons.test.ts
  • TypeScript compilation passes: bun run typecheck
  • Full lint reports pre-existing repository diagnostics outside this change: bun run lint

Manual Testing

Documentation review:

  1. Verify endpoint URLs match official MiniMax documentation
  2. Confirm model IDs, pricing, and capabilities are accurate
  3. Check that configuration instructions are clear and complete

Notes

  • This PR creates a new documentation structure: docs/providers/ directory for provider-specific guides
  • No code changes to runtime logic - purely documentation and test coverage additions
  • Preserves existing provider implementation; documents how to use existing capabilities

Checklist

  • Code follows project conventions
  • Self-review completed
  • Tests pass locally
  • Documentation added
  • No breaking changes

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

新增 MiniMax 双区域、双协议供应商配置指南,补充快速开始入口,并为 MiniMax 模型供应商识别及区域化代理 URL 拼接增加测试覆盖。

Changes

MiniMax provider support

Layer / File(s) Summary
MiniMax provider guide
docs/providers/minimax.md, README.en.md
新增 Global 与 China 区域的 Anthropic-compatible、OpenAI-compatible 端点、供应商配置、模型目录和请求路由规则,并在 README 中加入指南链接。
MiniMax vendor mappings
src/lib/model-vendor-icons.test.ts, src/lib/model-vendor/vendor-inference.test.ts
新增 MiniMax-M3MiniMax-M2.7minimax 的映射断言。
Regional protocol URL coverage
tests/unit/app/v1/url.test.ts
新增测试,验证区域化 MiniMax 协议基础路径在代理 URL 拼接时得以保留。

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: ding113

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed 标题简洁且准确概括了本次变更的核心:为 MiniMax provider 配置添加文档。
Description check ✅ Passed 描述与改动内容一致,明确说明了 MiniMax 配置文档、测试覆盖和相关问题。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 requested a review from ding113 July 15, 2026 07:02

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.en.md
- **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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The MiniMax provider guide link was added to the English README (README.en.md), but the Chinese README (README.md) was not updated. Please ensure both README files are kept in sync by adding the corresponding link to README.md as well.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area:provider labels Jul 15, 2026

@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.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6fcb827 and 3a49b2e.

📒 Files selected for processing (5)
  • README.en.md
  • docs/providers/minimax.md
  • src/lib/model-vendor-icons.test.ts
  • src/lib/model-vendor/vendor-inference.test.ts
  • tests/unit/app/v1/url.test.ts

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread docs/providers/minimax.md

## 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@github-actions github-actions Bot added the size/S Small PR (< 200 lines) label Jul 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to minimax via 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/completions collapses via the prefix branch (line 117), while .../anthropic + /v1/messages falls 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

Comment on lines +19 to +46
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);
}
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:provider documentation Improvements or additions to documentation size/S Small PR (< 200 lines)

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant