feat(ai): add support for MiniMax China (minimax-cn) provider (#725)

Co-authored-by: Jian Zhang <jzhang@yanhuangdata.com>
This commit is contained in:
Jian Zhang 2026-01-14 22:41:47 +08:00 committed by GitHub
parent 951e9c88b8
commit 558a77b45f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 70 additions and 23 deletions

View file

@ -567,29 +567,36 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
}
// Process MiniMax models
if (data.minimax?.models) {
for (const [modelId, model] of Object.entries(data.minimax.models)) {
const m = model as ModelsDevModel;
if (m.tool_call !== true) continue;
const minimaxVariants = [
{ key: "minimax", provider: "minimax", baseUrl: "https://api.minimax.io/anthropic" },
{ key: "minimax-cn", provider: "minimax-cn", baseUrl: "https://api.minimaxi.com/anthropic" },
] as const;
models.push({
id: modelId,
name: m.name || modelId,
api: "anthropic-messages",
provider: "minimax",
// MiniMax's Anthropic-compatible API - SDK appends /v1/messages
baseUrl: "https://api.minimax.io/anthropic",
reasoning: m.reasoning === true,
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
cost: {
input: m.cost?.input || 0,
output: m.cost?.output || 0,
cacheRead: m.cost?.cache_read || 0,
cacheWrite: m.cost?.cache_write || 0,
},
contextWindow: m.limit?.context || 4096,
maxTokens: m.limit?.output || 4096,
});
for (const { key, provider, baseUrl } of minimaxVariants) {
if (data[key]?.models) {
for (const [modelId, model] of Object.entries(data[key].models)) {
const m = model as ModelsDevModel;
if (m.tool_call !== true) continue;
models.push({
id: modelId,
name: m.name || modelId,
api: "anthropic-messages",
provider,
// MiniMax's Anthropic-compatible API - SDK appends /v1/messages
baseUrl,
reasoning: m.reasoning === true,
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
cost: {
input: m.cost?.input || 0,
output: m.cost?.output || 0,
cacheRead: m.cost?.cache_read || 0,
cacheWrite: m.cost?.cache_write || 0,
},
contextWindow: m.limit?.context || 4096,
maxTokens: m.limit?.output || 4096,
});
}
}
}