Skip to content

Add MiniMax M3 provider metadata#276

Open
octo-patch wants to merge 1 commit into
linuxhsj:mainfrom
octo-patch:octo/20260713-minimax-m3-provider-registry-recvoNmj63a7U8-clean
Open

Add MiniMax M3 provider metadata#276
octo-patch wants to merge 1 commit into
linuxhsj:mainfrom
octo-patch:octo/20260713-minimax-m3-provider-registry-recvoNmj63a7U8-clean

Conversation

@octo-patch

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

Copy link
Copy Markdown

Summary

  • Problem: The bundled MiniMax catalog still defaults to MiniMax M2.7 and applies one metadata shape to every listed model.
  • Why it matters: MiniMax M3 has a larger context window, multimodal input, tiered pricing, and adaptive thinking semantics.
  • What changed: Add model-specific M3 and M2.7 metadata, make M3 the onboarding default, normalize M3 Anthropic thinking payloads, document all regional protocol endpoints, and synchronize bundled metadata.
  • What did NOT change: Existing configuration keys, explicit M2.7 selections, or unrelated integrations.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

MiniMax M3 becomes the recommended default for API-key and Token Plan onboarding. MiniMax M2.7 and MiniMax M2.7 Highspeed remain available. The provider guide now lists global and CN endpoints for both Anthropic-compatible and OpenAI-compatible clients.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation: None.

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node.js 25.9.0, pnpm 10.23.0
  • Model/provider: MiniMax M3 and MiniMax M2.7
  • Integration/channel (if any): Bundled MiniMax provider
  • Relevant config (redacted): API-key and Token Plan provider catalogs

Steps

  1. Resolve the API-key and Token Plan provider catalogs.
  2. Inspect the default model, model-specific metadata, endpoint selection, and Anthropic thinking payload.
  3. Compare bundled generated metadata with extensions/minimax/openclaw.plugin.json.

Expected

  • M3 is first and recommended, M2.7 remains available, M3 thinking uses adaptive, and generated metadata matches the canonical manifest.

Actual

  • The expected catalog ordering, metadata, payload normalization, endpoint paths, and manifest equality were observed.

Evidence

  • Trace/log snippets

Verification results:

  • extensions/minimax/model-definitions.test.ts and extensions/minimax/onboard.test.ts: 17 tests passed.
  • src/agents/pi-embedded-runner/minimax-stream-wrappers.test.ts: 3 tests passed.
  • Direct catalog assertions for M3 and M2.7 passed.
  • Global and CN request-path capture passed for Anthropic-compatible and OpenAI-compatible endpoints.
  • Targeted formatting and type-aware lint passed.
  • Canonical manifest and bundled generated metadata matched exactly.

Human Verification (required)

  • Verified scenarios: default catalog ordering, model-specific context and pricing, multimodal declaration, regional endpoints, adaptive thinking normalization, and generated metadata equality.
  • Edge cases checked: explicit M2.7 metadata remains text-only; non-M3 thinking payloads remain unchanged.
  • What you did not verify: Live authenticated API calls and the full repository test suite.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps: None.

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Select minimax/MiniMax-M2.7 explicitly or revert the commit.
  • Files/config to restore: MiniMax extension catalog, onboarding defaults, stream wrapper, provider documentation, and bundled metadata.
  • Known bad symptoms reviewers should watch for: Invalid M3 thinking payloads or incorrect model metadata in the resolved catalog.

Risks and Mitigations

  • Risk: Changing the recommended default may alter behavior for new MiniMax configurations.
    • Mitigation: Existing explicit M2.7 selections remain valid, and onboarding plus payload behavior has focused coverage.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

MiniMax 集成将默认模型从 M2.7 切换为 M3,扩展模型元数据和区域端点文档,更新 API/OAuth 入站配置,并新增 M3 thinking 流载荷兼容处理及测试。

Changes

MiniMax M3 支持

Layer / File(s) Summary
模型目录与定义
extensions/minimax/provider-models.ts, extensions/minimax/model-definitions.ts, extensions/minimax/provider-catalog.ts, extensions/minimax/*test.ts, src/agents/models-config.providers.minimax.test.ts
模型目录新增 M3 的输入、成本、上下文窗口和最大 tokens 信息;默认模型切换为 M3,模型定义和 provider catalog 从目录生成,并更新相关测试。
入站配置与使用说明
extensions/minimax/onboard.ts, extensions/minimax/index.ts, extensions/minimax/openclaw.plugin.json, src/plugins/bundled-plugin-metadata.generated.ts, extensions/minimax/onboard.test.ts, docs/providers/minimax.md
API、OAuth 和 CN 配置默认使用 M3,OAuth 增加默认模型别名;认证提示、入站测试及 MiniMax 文档同步更新模型、端点、定价和排查内容。
M3 thinking 流兼容
src/agents/pi-embedded-runner/minimax-stream-wrappers.ts, src/agents/pi-embedded-runner/extra-params.ts, src/agents/pi-embedded-runner/minimax-stream-wrappers.test.ts
MiniMax M3 的 Anthropic Messages 流中,thinking.typeenabled 归一化为 adaptive,并接入运行器后置流包装流程及测试。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EmbeddedRunner
  participant M3ThinkingWrapper
  participant MiniMaxAnthropicStream
  EmbeddedRunner->>M3ThinkingWrapper: 包装 MiniMax M3 的 streamFn
  M3ThinkingWrapper->>MiniMaxAnthropicStream: 转发流请求
  MiniMaxAnthropicStream-->>M3ThinkingWrapper: 返回 thinking.type=enabled
  M3ThinkingWrapper-->>EmbeddedRunner: 返回 thinking.type=adaptive
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 标题准确概括了该 PR 的主要变更:新增 MiniMax M3 相关 provider 元数据。
Description check ✅ Passed 描述基本覆盖了模板要求的各部分,包括摘要、变更类型、范围、验证、影响和风险。
✨ 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 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.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/agents/pi-embedded-runner/extra-params.ts (1)

371-378: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

建议添加 debug 日志以保持与其他条件包装器的一致性。

同函数中大多数条件包装器(如 SiliconFlow L331-333、Bedrock L361-363、Anthropic fast mode L382-384、MiniMax fast mode L389-391)都包含 log.debug 调用。M3 thinking 包装器是条件性的且与 provider/modelId 相关,添加日志有助于排查 M3 兼容包装是否被正确应用。

♻️ 建议添加 debug 日志
   if (
     shouldApplyMinimaxM3ThinkingCompat({
       provider: ctx.provider,
       modelId: ctx.modelId,
     })
   ) {
+    log.debug(
+      `applying MiniMax M3 thinking compat wrapper for ${ctx.provider}/${ctx.modelId}`,
+    );
     ctx.agent.streamFn = createMinimaxM3ThinkingWrapper(ctx.agent.streamFn);
   }
🤖 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/agents/pi-embedded-runner/extra-params.ts` around lines 371 - 378, 在应用
createMinimaxM3ThinkingWrapper 的条件分支中添加与其他条件包装器一致的 log.debug 调用,记录
provider、modelId 及 M3 thinking 兼容包装已应用;保持现有 shouldApplyMinimaxM3ThinkingCompat
判断和包装逻辑不变。
src/agents/pi-embedded-runner/minimax-stream-wrappers.ts (1)

29-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

建议添加简要注释说明 thinking 归一化逻辑。

{ type: "enabled", budget_tokens } 被替换为 { type: "adaptive" } 时会丢弃 budget_tokens 等额外字段。虽然测试确认了该行为,但此处属于不太直观的兼容性改写,添加一行注释有助于后续维护者理解为何要丢弃 budget_tokens

As per coding guidelines: **/*.{ts,tsx}: Add brief code comments for tricky or non-obvious logic

♻️ 建议添加注释
     return streamWithPayloadPatch(underlying, model, context, options, (payloadObj) => {
       const thinking = payloadObj.thinking;
       if (
         thinking &&
         typeof thinking === "object" &&
         !Array.isArray(thinking) &&
         (thinking as Record<string, unknown>).type === "enabled"
       ) {
+        // MiniMax M3 uses "adaptive" thinking; drop budget_tokens since adaptive mode manages it automatically.
         payloadObj.thinking = { type: "adaptive" };
       }
     });
🤖 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/agents/pi-embedded-runner/minimax-stream-wrappers.ts` around lines 29 -
39, 在 streamWithPayloadPatch 的 payloadObj 处理回调中,为将 thinking 的 enabled 形式归一化为
adaptive 的赋值逻辑添加一行简短注释,明确说明该兼容性改写会丢弃 budget_tokens 等额外字段;不要修改现有转换行为。

Source: Coding guidelines

src/agents/pi-embedded-runner/minimax-stream-wrappers.test.ts (1)

25-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

建议补充关键边界测试用例。

当前测试覆盖了主要路径,但缺少以下边界场景:

  1. 非 anthropic-messages API 的 M3 模型createMinimaxM3ThinkingWrapper 在 L23 有 model.api !== "anthropic-messages" 守卫,但无测试覆盖。如果该守卫被意外移除,测试无法捕获。
  2. 非 minimax provider 的 M3 modelIdshouldApplyMinimaxM3ThinkingCompat 的 provider 守卫缺少反向测试(如 provider: "openai" + modelId: "MiniMax-M3" 应返回 false)。
  3. 已是 adaptive 的 thinking:测试 idempotency,确保 { type: "adaptive" } 不会被重复改写。
♻️ 建议补充的测试用例
  it("does not patch non-anthropic-messages API payloads", () => {
    expect(
      captureThinkingPayload({
        api: "openai",
        provider: "minimax",
        id: "MiniMax-M3",
      } as Parameters<StreamFn>[0]),
    ).toEqual({ thinking: { type: "enabled", budget_tokens: 1024 } });
  });

  it("rejects M3 modelId on non-minimax providers", () => {
    expect(
      shouldApplyMinimaxM3ThinkingCompat({ provider: "openai", modelId: "MiniMax-M3" }),
    ).toBe(false);
  });

  it("leaves already-adaptive thinking unchanged", () => {
    let captured: unknown;
    const underlying: StreamFn = (payloadModel, _context, options) => {
      const payload = { thinking: { type: "adaptive" } };
      options?.onPayload?.(payload, payloadModel);
      captured = payload;
      return {} as ReturnType<StreamFn>;
    };
    void createMinimaxM3ThinkingWrapper(underlying)(
      { api: "anthropic-messages", provider: "minimax", id: "MiniMax-M3" } as Parameters<StreamFn>[0],
      { messages: [] } as Parameters<StreamFn>[1],
      {} as Parameters<StreamFn>[2],
    );
    expect(captured).toEqual({ thinking: { type: "adaptive" } });
  });
🤖 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/agents/pi-embedded-runner/minimax-stream-wrappers.test.ts` around lines
25 - 60, Extend the minimax stream wrapper tests with boundary coverage: verify
captureThinkingPayload leaves a MiniMax-M3 payload unchanged for
non-anthropic-messages APIs, verify shouldApplyMinimaxM3ThinkingCompat returns
false for MiniMax-M3 on non-minimax providers, and verify
createMinimaxM3ThinkingWrapper preserves an already-adaptive thinking payload
without rewriting it.
🤖 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 `@extensions/minimax/model-definitions.ts`:
- Line 43: 更新 buildMinimaxModelDefinition 中 input 的回退逻辑:未传入 params.input
时,优先使用对应 catalog 项的 input,只有 catalog?.input 也不存在时才回退为 ["text"];保留显式 params.input
的现有行为。

---

Nitpick comments:
In `@src/agents/pi-embedded-runner/extra-params.ts`:
- Around line 371-378: 在应用 createMinimaxM3ThinkingWrapper 的条件分支中添加与其他条件包装器一致的
log.debug 调用,记录 provider、modelId 及 M3 thinking 兼容包装已应用;保持现有
shouldApplyMinimaxM3ThinkingCompat 判断和包装逻辑不变。

In `@src/agents/pi-embedded-runner/minimax-stream-wrappers.test.ts`:
- Around line 25-60: Extend the minimax stream wrapper tests with boundary
coverage: verify captureThinkingPayload leaves a MiniMax-M3 payload unchanged
for non-anthropic-messages APIs, verify shouldApplyMinimaxM3ThinkingCompat
returns false for MiniMax-M3 on non-minimax providers, and verify
createMinimaxM3ThinkingWrapper preserves an already-adaptive thinking payload
without rewriting it.

In `@src/agents/pi-embedded-runner/minimax-stream-wrappers.ts`:
- Around line 29-39: 在 streamWithPayloadPatch 的 payloadObj 处理回调中,为将 thinking 的
enabled 形式归一化为 adaptive 的赋值逻辑添加一行简短注释,明确说明该兼容性改写会丢弃 budget_tokens
等额外字段;不要修改现有转换行为。
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d40cdd2d-0082-4336-b392-1b0da346f079

📥 Commits

Reviewing files that changed from the base of the PR and between a654bcf and df64c93.

📒 Files selected for processing (14)
  • docs/providers/minimax.md
  • extensions/minimax/index.ts
  • extensions/minimax/model-definitions.test.ts
  • extensions/minimax/model-definitions.ts
  • extensions/minimax/onboard.test.ts
  • extensions/minimax/onboard.ts
  • extensions/minimax/openclaw.plugin.json
  • extensions/minimax/provider-catalog.ts
  • extensions/minimax/provider-models.ts
  • src/agents/models-config.providers.minimax.test.ts
  • src/agents/pi-embedded-runner/extra-params.ts
  • src/agents/pi-embedded-runner/minimax-stream-wrappers.test.ts
  • src/agents/pi-embedded-runner/minimax-stream-wrappers.ts
  • src/plugins/bundled-plugin-metadata.generated.ts

reasoning: params.reasoning ?? catalog?.reasoning ?? false,
input: ["text"],
cost: params.cost,
input: params.input ? [...params.input] : ["text"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

input 回退逻辑与 name/reasoning 不一致。

buildMinimaxModelDefinition 中,namereasoning 在未传入时会回退到 catalog 值,但 input 直接默认为 ["text"],未检查 catalog?.input。若直接调用此函数并传入 catalog 中已有的模型 ID(如 "MiniMax-M3")但未传 input,将得到 ["text"] 而非 ["text", "image"]

🔧 建议修复:使 `input` 回退到 catalog
-    input: params.input ? [...params.input] : ["text"],
+    input: [...(params.input ?? catalog?.input ?? ["text"])],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
input: params.input ? [...params.input] : ["text"],
input: [...(params.input ?? catalog?.input ?? ["text"])],
🤖 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 `@extensions/minimax/model-definitions.ts` at line 43, 更新
buildMinimaxModelDefinition 中 input 的回退逻辑:未传入 params.input 时,优先使用对应 catalog 项的
input,只有 catalog?.input 也不存在时才回退为 ["text"];保留显式 params.input 的现有行为。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant