From 3229398a2301283bbd8b82997f7419d7ae31e443 Mon Sep 17 00:00:00 2001 From: octo-patch <266937838+octo-patch@users.noreply.github.com> Date: Tue, 28 Jul 2026 10:37:29 +0000 Subject: [PATCH 1/2] feat: add MiniMax CLI provider with Anthropic-compatible runtime --- app/api/chat/[project_id]/act/route.ts | 5 + app/api/settings/cli-status/route.ts | 15 + components/modals/CreateProjectModal.tsx | 16 + components/settings/GlobalSettings.tsx | 54 ++ contexts/GlobalSettingsContext.tsx | 1 + lib/constants/cliModels.ts | 9 +- lib/constants/minimaxModels.ts | 87 +++ lib/services/cli/minimax.ts | 795 +++++++++++++++++++++++ lib/services/settings.ts | 3 + lib/utils/cliOptions.ts | 2 +- types/backend/cli.ts | 2 +- types/cli.ts | 23 +- 12 files changed, 1008 insertions(+), 4 deletions(-) create mode 100644 lib/constants/minimaxModels.ts create mode 100644 lib/services/cli/minimax.ts diff --git a/app/api/chat/[project_id]/act/route.ts b/app/api/chat/[project_id]/act/route.ts index c5395c04..4f34ef76 100644 --- a/app/api/chat/[project_id]/act/route.ts +++ b/app/api/chat/[project_id]/act/route.ts @@ -15,6 +15,7 @@ import { initializeNextJsProject as initializeCodexProject, applyChanges as appl import { initializeNextJsProject as initializeCursorProject, applyChanges as applyCursorChanges } from '@/lib/services/cli/cursor'; import { initializeNextJsProject as initializeQwenProject, applyChanges as applyQwenChanges } from '@/lib/services/cli/qwen'; import { initializeNextJsProject as initializeGLMProject, applyChanges as applyGLMChanges } from '@/lib/services/cli/glm'; +import { initializeNextJsProject as initializeMiniMaxProject, applyChanges as applyMiniMaxChanges } from '@/lib/services/cli/minimax'; import { getDefaultModelForCli, normalizeModelId } from '@/lib/constants/cliModels'; import { streamManager } from '@/lib/services/stream'; import type { ChatActRequest } from '@/types/backend'; @@ -407,6 +408,8 @@ export async function POST(request: NextRequest, { params }: RouteContext) { ? initializeQwenProject : cliPreference === 'glm' ? initializeGLMProject + : cliPreference === 'minimax' + ? initializeMiniMaxProject : initializeClaudeProject; executor( @@ -428,6 +431,8 @@ export async function POST(request: NextRequest, { params }: RouteContext) { ? applyQwenChanges : cliPreference === 'glm' ? applyGLMChanges + : cliPreference === 'minimax' + ? applyMiniMaxChanges : applyClaudeChanges; const sessionId = diff --git a/app/api/settings/cli-status/route.ts b/app/api/settings/cli-status/route.ts index 35022bb8..4693414b 100644 --- a/app/api/settings/cli-status/route.ts +++ b/app/api/settings/cli-status/route.ts @@ -10,6 +10,7 @@ import type { CLIStatus } from '@/types/backend'; import { CODEX_MODEL_DEFINITIONS } from '@/lib/constants/codexModels'; import { QWEN_MODEL_DEFINITIONS } from '@/lib/constants/qwenModels'; import { GLM_MODEL_DEFINITIONS } from '@/lib/constants/glmModels'; +import { MINIMAX_MODEL_DEFINITIONS } from '@/lib/constants/minimaxModels'; import { CURSOR_MODEL_DEFINITIONS } from '@/lib/constants/cursorModels'; const execAsync = promisify(exec); @@ -132,6 +133,10 @@ export async function GET() { installed: false, checking: false, }, + minimax: { + installed: false, + checking: false, + }, }; // Check Claude Code CLI installation @@ -179,6 +184,16 @@ export async function GET() { models: GLM_MODEL_DEFINITIONS.map((model) => model.id), }; + // MiniMax reuses the Claude Code runtime (Anthropic-compatible endpoint) + const minimaxStatus = claudeStatus; + status.minimax = { + installed: minimaxStatus.installed, + version: minimaxStatus.version, + checking: false, + error: minimaxStatus.error, + models: MINIMAX_MODEL_DEFINITIONS.map((model) => model.id), + }; + return NextResponse.json(status); } catch (error) { console.error('[API] Failed to check CLI status:', error); diff --git a/components/modals/CreateProjectModal.tsx b/components/modals/CreateProjectModal.tsx index 271c46db..3764d499 100644 --- a/components/modals/CreateProjectModal.tsx +++ b/components/modals/CreateProjectModal.tsx @@ -98,6 +98,22 @@ const CLI_OPTIONS: CLIOption[] = [ })), features: ['Claude-compatible runtime', 'GLM 4.6 reasoning', 'Text-only mode'], }, + { + id: 'minimax', + name: 'MiniMax CLI', + icon: '🟣', + description: 'MiniMax agent running via Claude Code runtime', + color: 'from-purple-500 to-fuchsia-600', + downloadUrl: 'https://platform.minimax.io/docs', + installCommand: 'npm install -g @anthropic-ai/claude-code', + models: getModelDefinitionsForCli('minimax').map(({ id, name, description, supportsImages }) => ({ + id, + name, + description, + supportsImages, + })), + features: ['Claude-compatible runtime', 'MiniMax M3 reasoning', 'Multimodal input'], + }, ]; function generateUUID() { diff --git a/components/settings/GlobalSettings.tsx b/components/settings/GlobalSettings.tsx index 6ec1b69c..8f574a66 100644 --- a/components/settings/GlobalSettings.tsx +++ b/components/settings/GlobalSettings.tsx @@ -92,6 +92,18 @@ const CLI_OPTIONS: CLIOption[] = [ enabled: true, models: getModelDefinitionsForCli('glm').map(({ id, name }) => ({ id, name })), }, + { + id: 'minimax', + name: 'MiniMax CLI', + icon: '', + description: 'MiniMax agent running through Claude Code runtime', + color: 'from-purple-500 to-fuchsia-600', + brandColor: '#FF2E5F', + downloadUrl: 'https://platform.minimax.io/docs', + installCommand: 'npm install -g @anthropic-ai/claude-code', + enabled: true, + models: getModelDefinitionsForCli('minimax').map(({ id, name }) => ({ id, name })), + }, ]; // Global settings are provided by context @@ -544,6 +556,11 @@ export default function GlobalSettings({ isOpen, onClose, initialTab = 'general' {cli.id === 'glm' && ( GLM )} + {cli.id === 'minimax' && ( +
+ MM +
+ )} {cli.id === 'gemini' && ( Gemini )} @@ -641,6 +658,38 @@ export default function GlobalSettings({ isOpen, onClose, initialTab = 'general'

)} + {cli.id === 'minimax' && ( +
+ +
+ setCliApiKey(cli.id, e.target.value)} + placeholder="Enter MiniMax API key" + className="flex-1 px-3 py-1.5 rounded-lg border border-gray-200 bg-white text-sm text-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-200" + /> + +
+

+ Stored locally and injected as MINIMAX_API_KEY when running MiniMax. + Set MINIMAX_REGION to cn_zh to use the China endpoint. + Leave blank to rely on server environment variables instead. +

+
+ )} ) : (
e.stopPropagation()}> @@ -918,6 +967,7 @@ export default function GlobalSettings({ isOpen, onClose, initialTab = 'general' {selectedCLI.id === 'gemini' && 'Authenticate (OAuth or API Key)'} {selectedCLI.id === 'glm' && 'Authenticate (Z.ai DevPack login)'} + {selectedCLI.id === 'minimax' && 'Authenticate (MiniMax API key)'} {selectedCLI.id === 'qwen' && 'Authenticate (Qwen OAuth or API Key)'} {selectedCLI.id === 'codex' && 'Start Codex and sign in'} {selectedCLI.id === 'claude' && 'Start Claude and sign in'} @@ -930,6 +980,7 @@ export default function GlobalSettings({ isOpen, onClose, initialTab = 'general' selectedCLI.id === 'codex' ? 'codex' : selectedCLI.id === 'qwen' ? 'qwen' : selectedCLI.id === 'glm' ? 'zai' : + selectedCLI.id === 'minimax' ? 'claude' : selectedCLI.id === 'gemini' ? 'gemini' : ''}