mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 10:50:20 +00:00
* 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>
74 lines
1.7 KiB
TypeScript
74 lines
1.7 KiB
TypeScript
import type {
|
|
ModelDefinitionConfig,
|
|
ModelProviderConfig,
|
|
} from "openclaw/plugin-sdk/provider-models";
|
|
import {
|
|
MINIMAX_DEFAULT_MODEL_ID,
|
|
MINIMAX_TEXT_MODEL_CATALOG,
|
|
MINIMAX_TEXT_MODEL_ORDER,
|
|
} from "openclaw/plugin-sdk/provider-models";
|
|
|
|
const MINIMAX_PORTAL_BASE_URL = "https://api.minimax.io/anthropic";
|
|
const MINIMAX_DEFAULT_CONTEXT_WINDOW = 204800;
|
|
const MINIMAX_DEFAULT_MAX_TOKENS = 131072;
|
|
const MINIMAX_API_COST = {
|
|
input: 0.3,
|
|
output: 1.2,
|
|
cacheRead: 0.06,
|
|
cacheWrite: 0.375,
|
|
};
|
|
|
|
function buildMinimaxModel(params: {
|
|
id: string;
|
|
name: string;
|
|
reasoning: boolean;
|
|
input: ModelDefinitionConfig["input"];
|
|
}): ModelDefinitionConfig {
|
|
return {
|
|
id: params.id,
|
|
name: params.name,
|
|
reasoning: params.reasoning,
|
|
input: params.input,
|
|
cost: MINIMAX_API_COST,
|
|
contextWindow: MINIMAX_DEFAULT_CONTEXT_WINDOW,
|
|
maxTokens: MINIMAX_DEFAULT_MAX_TOKENS,
|
|
};
|
|
}
|
|
|
|
function buildMinimaxTextModel(params: {
|
|
id: string;
|
|
name: string;
|
|
reasoning: boolean;
|
|
}): ModelDefinitionConfig {
|
|
return buildMinimaxModel({ ...params, input: ["text"] });
|
|
}
|
|
|
|
function buildMinimaxCatalog(): ModelDefinitionConfig[] {
|
|
return MINIMAX_TEXT_MODEL_ORDER.map((id) => {
|
|
const model = MINIMAX_TEXT_MODEL_CATALOG[id];
|
|
return buildMinimaxTextModel({
|
|
id,
|
|
name: model.name,
|
|
reasoning: model.reasoning,
|
|
});
|
|
});
|
|
}
|
|
|
|
export function buildMinimaxProvider(): ModelProviderConfig {
|
|
return {
|
|
baseUrl: MINIMAX_PORTAL_BASE_URL,
|
|
api: "anthropic-messages",
|
|
authHeader: true,
|
|
models: buildMinimaxCatalog(),
|
|
};
|
|
}
|
|
|
|
export function buildMinimaxPortalProvider(): ModelProviderConfig {
|
|
return {
|
|
baseUrl: MINIMAX_PORTAL_BASE_URL,
|
|
api: "anthropic-messages",
|
|
authHeader: true,
|
|
models: buildMinimaxCatalog(),
|
|
};
|
|
}
|