Skip to content

Add MiniMax provider support - #349

Open
octo-patch wants to merge 1 commit into
superagent-ai:mainfrom
octo-patch:octo/20260731-provider-add-recvqfZoKRznrv
Open

Add MiniMax provider support#349
octo-patch wants to merge 1 commit into
superagent-ai:mainfrom
octo-patch:octo/20260731-provider-add-recvqfZoKRznrv

Conversation

@octo-patch

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

Copy link
Copy Markdown

Reason: Add MiniMax OpenAI-compatible provider support with regional endpoints, current model metadata, and capability-aware behavior.

This change:

  • adds a MiniMax provider adapter with Bearer authentication and official global and China endpoints
  • registers MiniMax-M3 and MiniMax-M2.7 metadata, defaults, pricing, context windows, modalities, and thinking modes
  • exposes provider selection through CLI, environment, interactive, headless, scheduled, and Telegram paths
  • prevents unsupported hosted search, media generation, batch, audio transcription, and image-input requests from reaching incompatible APIs
  • keeps model selection, sub-agents, saved credentials, titles, and recaps scoped to the active provider

Checks:

  • bun run lint (passes with existing warnings)
  • bun run typecheck
  • bunx vitest run src/providers/minimax.test.ts src/grok/models.test.ts src/grok/client.test.ts src/grok/media.test.ts src/agent/batch-mode.test.ts src/audio/stt/grok-stt.test.ts src/utils/subagents-settings.test.ts src/telegram/bridge.test.ts
  • bunx vitest run --exclude src/storage/sessions.test.ts
  • bun run build
  • bun run src/index.ts --help
  • bun run src/index.ts models

The unfiltered Vitest run still encounters the repository's existing bun:sqlite module-loading limitation in src/storage/sessions.test.ts; the remaining 48 test files and 251 tests pass.


Note

Medium Risk
Touches core agent initialization, credential resolution, and all inference paths (interactive, headless, Telegram, delegations). Capability checks reduce blast radius for unsupported APIs, but wrong provider/model pairing or env settings could still confuse users or break sessions until configured correctly.

Overview
Introduces a pluggable provider layer (ProviderAdapter with xAI and MiniMax adapters) and wires MiniMax as a second backend alongside xAI.

MiniMax is selected via --provider minimax, GROK_PROVIDER=minimax, or inferred from model IDs. It uses @ai-sdk/openai-compatible against regional endpoints (MINIMAX_REGION, MINIMAX_BASE_URL), registers MiniMax-M3 and MiniMax-M2.7 metadata, and defaults chat to MiniMax-M3 when that provider is active.

Capability gating blocks or short-circuits features MiniMax does not expose: batch API, hosted web/X search, image/video generation, Telegram STT, and image input when the model lacks image modality—while local CLI tools and chat completions remain available.

Agent, CLI, TUI, Telegram bridge, and settings now resolve API keys, base URLs, models, sub-agents, and titles/recaps per active provider; cross-provider model selection is rejected at runtime.

Reviewed by Cursor Bugbot for commit 700d574. Configure here.

@open-cla

open-cla Bot commented Jul 31, 2026

Copy link
Copy Markdown

Contributor License Agreement

The following contributors need CLA coverage:

Review and sign the CLA

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 700d574. Configure here.

Comment thread src/index.ts
if (typeof options.apiKey === "string") saveUserSettings({ apiKey: options.apiKey, provider });
else if (typeof options.provider === "string" || (typeof options.model === "string" && modelProvider)) {
saveUserSettings({ provider });
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Provider switch reuses stale API key

High Severity

Saving only provider while leaving the existing apiKey in place lets getApiKey treat the previous provider’s credential as valid for the newly selected provider. After a --provider or model-driven switch without a fresh key, later runs can authenticate MiniMax with an xAI key (or the reverse) and fail auth or hit the wrong API.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 700d574. Configure here.

Comment thread src/agent/agent.ts
this.abortController = null;
}
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rejected image stays in history

Medium Severity

The unsupported-image guard pushes the user message into this.messages and returns without discarding it. On text-only models such as MiniMax-M2.7, later turns still include that image payload and can fail even after the user retries with plain text.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 700d574. Configure here.

@superagent-security

Copy link
Copy Markdown

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

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