Skip to content

feat: add MiniMax provider support - #596

Open
octo-patch wants to merge 2 commits into
GetBindu:mainfrom
octo-patch:octo/20260715-provider-add-recvoNoAoiUYL6
Open

feat: add MiniMax provider support#596
octo-patch wants to merge 2 commits into
GetBindu:mainfrom
octo-patch:octo/20260715-provider-add-recvoNoAoiUYL6

Conversation

@octo-patch

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

Copy link
Copy Markdown
Contributor

Reason: add target provider/model to existing provider registry.

Summary

  • Register MiniMax-M3 and MiniMax-M2.7 with context, pricing, cache, modality, thinking, aliases, and overflow metadata.
  • Add regional OpenAI-compatible and Anthropic-compatible endpoint selection for global_en and cn_zh.
  • Add environment overrides, operator documentation, dependency wiring, and focused registry tests.

Change Type

  • Feature
  • Documentation
  • Tests

User-Visible Behavior

Configure the planner with minimax/MiniMax-M3 or minimax/MiniMax-M2.7, select a region, and select the OpenAI-compatible or Anthropic-compatible protocol. Existing configuration remains supported.

Security Impact

  • New permissions/capabilities: No
  • Secrets/credentials handling changed: No; the API key is read from configuration or MINIMAX_API_KEY.
  • New/changed network calls: Yes; direct MiniMax requests are supported through the configured adapter.
  • Database schema/migration changes: No
  • Authentication/authorization changes: No

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 existing src/planner/index.ts:328 assistant metadata typing)
  • npm test (29 test files passed; unrelated timing-sensitive tests/api/plan-route-filter.test.ts failure)

Compatibility

  • Backward compatible: Yes
  • Config/env changes: Adds optional MiniMax provider settings.
  • Database migration needed: No

Failure Recovery

Remove the MiniMax provider configuration and restore the gateway files in this PR.

Summary by CodeRabbit

  • New Features

    • Added support for MiniMax as a planner provider.
    • Supports global and China regions with OpenAI- and Anthropic-compatible endpoints.
    • Added MiniMax M3 and M2.7 models, aliases, defaults, and model-specific context limits.
    • Added flexible environment configuration for API keys, regions, protocols, and custom endpoints.
  • Documentation

    • Updated setup guidance, environment variable reference, model details, pricing, and direct MiniMax configuration instructions.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dd6f53c-071c-432c-b12b-035880547aa4

📥 Commits

Reviewing files that changed from the base of the PR and between 5e8d9e7 and 95fd990.

📒 Files selected for processing (5)
  • gateway/.env.example
  • gateway/README.md
  • gateway/src/provider/catalog.ts
  • gateway/src/provider/index.ts
  • gateway/tests/provider/minimax.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • gateway/tests/provider/minimax.test.ts
  • gateway/src/provider/index.ts
  • gateway/src/provider/catalog.ts
  • gateway/README.md

📝 Walkthrough

Walkthrough

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

Changes

MiniMax provider support

Layer / File(s) Summary
MiniMax model catalog and contracts
gateway/src/provider/catalog.ts, gateway/src/config/schema.ts, gateway/tests/provider/minimax.test.ts
Defines MiniMax regions, protocols, endpoints, model metadata, aliases, normalization, and provider configuration fields. Tests cover catalog data and model parsing.
Configuration and AI client construction
gateway/package.json, gateway/src/config/loader.ts, gateway/src/provider/index.ts
Loads MiniMax environment overrides and builds OpenAI-compatible or Anthropic-compatible MiniMax clients with model and endpoint validation.
Context-window integration and tests
gateway/src/session/overflow.ts, gateway/tests/session/overflow-threshold.test.ts
Adds MiniMax model context windows to overflow threshold resolution and verifies both registered models.
Configuration documentation
gateway/.env.example, gateway/README.md
Documents provider/model configuration, MiniMax credentials, supported models, endpoints, pricing, and protocol behavior.

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
Loading

Possibly related PRs

  • GetBindu/Bindu#478: Adds the model-aware overflow and context-window resolution used by the MiniMax mappings.
  • GetBindu/Bindu#571: Shares MiniMax model support and MiniMax-M3 references with this provider integration.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the feature, behavior, security impact, verification, compatibility, and recovery, but omits many required template sections. Add the required Scope, Linked Issue/PR, Environment, test steps, expected and actual behavior, Evidence, Human Verification, Risks, and Checklist sections.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding MiniMax provider support.
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.
✨ 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.

@octo-patch
octo-patch force-pushed the octo/20260715-provider-add-recvoNoAoiUYL6 branch 2 times, most recently from 867d1fc to 1d2bbce Compare July 15, 2026 07:13
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>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@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: 2

🧹 Nitpick comments (1)
gateway/src/session/overflow.ts (1)

61-64: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid relying on hardcoded array indices for model lookups.

Relying on specific array indices ([0] and [1]) makes the mapping brittle if the order of MINIMAX_MODELS in catalog.ts changes 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7b1ff75 and 4788908.

⛔ Files ignored due to path filters (1)
  • gateway/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • gateway/.env.example
  • gateway/README.md
  • gateway/package.json
  • gateway/src/config/loader.ts
  • gateway/src/config/schema.ts
  • gateway/src/provider/catalog.ts
  • gateway/src/provider/index.ts
  • gateway/src/session/overflow.ts
  • gateway/tests/provider/minimax.test.ts
  • gateway/tests/session/overflow-threshold.test.ts

Comment thread gateway/.env.example Outdated
Comment thread gateway/src/provider/index.ts
@octo-patch
octo-patch force-pushed the octo/20260715-provider-add-recvoNoAoiUYL6 branch from 1d2bbce to 5e8d9e7 Compare July 15, 2026 07:15
@octo-patch

Copy link
Copy Markdown
Contributor Author

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 npm test -- tests/provider/minimax.test.ts tests/session/overflow-threshold.test.ts successfully; npm run typecheck still fails on an existing src/planner/index.ts:328 assistant message typing issue outside this change.

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