Files
openclaw/extensions/minimax/model-definitions.test.ts
liyuan97 e2e9f979ca feat(minimax): add image generation provider and trim model catalog to M2.7 (#54487)
* feat(minimax): add image generation and TTS providers, trim TUI model list

Register MiniMax image-01 and speech-2.8 models as plugin providers for
the image_generate and TTS tools. Both resolve CN/global base URLs from
the configured model endpoint origin.

- Image generation: base64 response, aspect-ratio support, image-to-image
  via subject_reference, registered for minimax and minimax-portal
- TTS: speech-2.8-turbo (default) and speech-2.8-hd, hex-encoded audio,
  voice listing via get_voice API, telephony PCM support
- Add MiniMax to TTS auto-detection cascade (after ElevenLabs, before
  Microsoft) and TTS config section
- Remove MiniMax-VL-01, M2, M2.1, M2.5 and variants from TUI picker;
  keep M2.7 and M2.7-highspeed only (backend routing unchanged)

* feat(minimax): trim legacy model catalog to M2.7 only

Cherry-picked from temp/feat/minimax-trim-legacy-models (949ed28).
Removes MiniMax-VL-01, M2, M2.1, M2.5 and variants from the model
catalog, model order, modern model matchers, OAuth config, docs, and
tests. Keeps only M2.7 and M2.7-highspeed.

Conflicts resolved:
- provider-catalog.ts: removed MINIMAX_TUI_MODELS filter (no longer
  needed since source array is now M2.7-only)
- index.ts: kept image generation + speech provider registrations
  (added by this branch), moved media understanding registrations
  earlier (as intended by the cherry-picked commit)

* fix(minimax): update discovery contract test to reflect M2.7-only catalog

Cherry-picked from temp/feat/minimax-trim-legacy-models (2c750cb).

* feat(minimax): add web search provider and register in plugin entry

* fix(minimax): resolve OAuth credentials for TTS speech provider

* MiniMax: remove web search and TTS providers

* fix(minimax): throw on empty images array after generation failure

* feat(minimax): add image generation provider and trim catalog to M2.7 (#54487) (thanks @liyuan97)

---------

Co-authored-by: tars90percent <tars@minimaxi.com>
Co-authored-by: George Zhang <georgezhangtj97@gmail.com>
2026-03-25 09:29:35 -07:00

54 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
buildMinimaxApiModelDefinition,
buildMinimaxModelDefinition,
DEFAULT_MINIMAX_CONTEXT_WINDOW,
DEFAULT_MINIMAX_MAX_TOKENS,
MINIMAX_API_COST,
MINIMAX_HOSTED_MODEL_ID,
} from "./model-definitions.js";
describe("minimax model definitions", () => {
it("uses M2.7 as default hosted model", () => {
expect(MINIMAX_HOSTED_MODEL_ID).toBe("MiniMax-M2.7");
});
it("uses the higher upstream MiniMax context and token defaults", () => {
expect(DEFAULT_MINIMAX_CONTEXT_WINDOW).toBe(204800);
expect(DEFAULT_MINIMAX_MAX_TOKENS).toBe(131072);
expect(MINIMAX_API_COST).toEqual({
input: 0.3,
output: 1.2,
cacheRead: 0.06,
cacheWrite: 0.375,
});
});
it("builds catalog model with name and reasoning from catalog", () => {
const model = buildMinimaxModelDefinition({
id: "MiniMax-M2.7",
cost: MINIMAX_API_COST,
contextWindow: DEFAULT_MINIMAX_CONTEXT_WINDOW,
maxTokens: DEFAULT_MINIMAX_MAX_TOKENS,
});
expect(model).toMatchObject({
id: "MiniMax-M2.7",
name: "MiniMax M2.7",
reasoning: true,
});
});
it("builds API model definition with standard cost", () => {
const model = buildMinimaxApiModelDefinition("MiniMax-M2.7");
expect(model.cost).toEqual(MINIMAX_API_COST);
expect(model.contextWindow).toBe(DEFAULT_MINIMAX_CONTEXT_WINDOW);
expect(model.maxTokens).toBe(DEFAULT_MINIMAX_MAX_TOKENS);
});
it("falls back to generated name for unknown model id", () => {
const model = buildMinimaxApiModelDefinition("MiniMax-Future");
expect(model.name).toBe("MiniMax MiniMax-Future");
expect(model.reasoning).toBe(false);
});
});