Files
intelligence-terminal/lib/llm/index.mjs
Octopus 6f41c2ff3d feat: add MiniMax as LLM provider
Add MiniMax (api.minimax.io) as a fifth LLM provider option alongside
Anthropic, OpenAI, Gemini, and Codex. MiniMax offers an
OpenAI-compatible Chat Completions API with the M2.5 model (204K
context window).

Changes:
- lib/llm/minimax.mjs: new provider using raw fetch (no SDK)
- lib/llm/index.mjs: register MiniMax in the factory
- .env.example, crucix.config.mjs, README.md: document the new option
- test/llm-minimax.test.mjs: 10 unit tests (node:test)
- test/llm-minimax-integration.test.mjs: live API integration test

Usage:
  LLM_PROVIDER=minimax
  LLM_API_KEY=sk-...
  LLM_MODEL=MiniMax-M2.5          # optional, this is the default
2026-03-16 08:45:35 -05:00

42 lines
1.4 KiB
JavaScript

// LLM Factory — creates the configured provider or returns null
import { AnthropicProvider } from './anthropic.mjs';
import { OpenAIProvider } from './openai.mjs';
import { GeminiProvider } from './gemini.mjs';
import { CodexProvider } from './codex.mjs';
import { MiniMaxProvider } from './minimax.mjs';
export { LLMProvider } from './provider.mjs';
export { AnthropicProvider } from './anthropic.mjs';
export { OpenAIProvider } from './openai.mjs';
export { GeminiProvider } from './gemini.mjs';
export { CodexProvider } from './codex.mjs';
export { MiniMaxProvider } from './minimax.mjs';
/**
* Create an LLM provider based on config.
* @param {{ provider: string|null, apiKey: string|null, model: string|null }} llmConfig
* @returns {LLMProvider|null}
*/
export function createLLMProvider(llmConfig) {
if (!llmConfig?.provider) return null;
const { provider, apiKey, model } = llmConfig;
switch (provider.toLowerCase()) {
case 'anthropic':
return new AnthropicProvider({ apiKey, model });
case 'openai':
return new OpenAIProvider({ apiKey, model });
case 'gemini':
return new GeminiProvider({ apiKey, model });
case 'codex':
return new CodexProvider({ model });
case 'minimax':
return new MiniMaxProvider({ apiKey, model });
default:
console.warn(`[LLM] Unknown provider "${provider}". LLM features disabled.`);
return null;
}
}