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
31 lines
1.3 KiB
JavaScript
31 lines
1.3 KiB
JavaScript
// MiniMax provider — integration test (calls real API)
|
|
// Requires MINIMAX_API_KEY environment variable
|
|
// Run: MINIMAX_API_KEY=sk-... node --test test/llm-minimax-integration.test.mjs
|
|
|
|
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { MiniMaxProvider } from '../lib/llm/minimax.mjs';
|
|
|
|
const API_KEY = process.env.MINIMAX_API_KEY;
|
|
|
|
describe('MiniMax integration', { skip: !API_KEY && 'MINIMAX_API_KEY not set' }, () => {
|
|
it('should complete a prompt with MiniMax-M2.5', async () => {
|
|
const provider = new MiniMaxProvider({ apiKey: API_KEY, model: 'MiniMax-M2.5' });
|
|
assert.equal(provider.isConfigured, true);
|
|
|
|
const result = await provider.complete(
|
|
'You are a helpful assistant. Respond in exactly one sentence.',
|
|
'What is 2+2?',
|
|
{ maxTokens: 128, timeout: 30000 }
|
|
);
|
|
|
|
assert.ok(result.text.length > 0, 'Response text should not be empty');
|
|
assert.ok(result.usage.inputTokens > 0, 'Should report input tokens');
|
|
assert.ok(result.usage.outputTokens > 0, 'Should report output tokens');
|
|
assert.ok(result.model, 'Should report model name');
|
|
console.log(` Response: ${result.text}`);
|
|
console.log(` Tokens: ${result.usage.inputTokens} in / ${result.usage.outputTokens} out`);
|
|
console.log(` Model: ${result.model}`);
|
|
});
|
|
});
|