Files
9router/open-sse/providers/registry/minimax.js
galiehneh 998bb3d975 fix(tools): scope Claude tool type defaulting to gateways that need it (#3905)
defaultClaudeToolType() stamped tools[].type = "custom" onto every
Claude-format request carrying tools since e08ac6da. That satisfied
MiniMax (error 2013) but broke Anthropic-compatible endpoints that only
accept the legacy typeless tool shape. DeepSeek's endpoint
(api.deepseek.com/anthropic/v1/messages) whitelists its tool `type` enum
to the web_search_* variants and answers HTTP 400 "unknown variant
`custom`", so every Claude Code request routed to a DeepSeek connection
failed and surfaced as a persistent 503.

Run the defaulting only when the target provider declares the new
requireClaudeToolType quirk (MiniMax, MiniMax-CN). Add
shouldDefaultClaudeToolType(provider, finalFormat, tools, PROVIDERS) in
translator/concerns/toolCall.js so the gate is unit-testable, and cover
MiniMax keeping the explicit type, DeepSeek/Anthropic staying typeless,
non-Claude formats and tool-less requests never defaulting.

Effectively a no-op for MiniMax and a restore of the pre-e08ac6da
behaviour everywhere else. Another strict gateway now only needs the same
one-line quirk instead of a global behavioural change.
2026-09-10 23:03:53 +07:00

85 lines
2.8 KiB
JavaScript

import { CLAUDE_API_HEADERS } from "../shared.js";
export default {
id: "minimax",
priority: 90,
alias: "minimax",
display: {
name: "Minimax Coding",
icon: "memory",
color: "#7C3AED",
textIcon: "MM",
website: "https://www.minimaxi.com",
notice: {
apiKeyUrl: "https://platform.minimaxi.com/user-center/basic-information/interface-key",
},
},
category: "apikey",
transport: {
baseUrl: "https://api.minimax.io/anthropic/v1/messages",
format: "claude",
urlSuffix: "?beta=true",
headers: { ...CLAUDE_API_HEADERS },
quirks: {
dropOutputConfig: true,
requireClaudeToolType: true,
},
reasoningInject: {
scope: "all",
},
auth: {
combined: true,
header: "x-api-key",
scheme: "raw",
},
usage: {
urls: [
"https://www.minimax.io/v1/token_plan/remains",
"https://api.minimax.io/v1/api/openplatform/coding_plan/remains",
],
},
},
// Multi-endpoint: pick the transport matching client sourceFormat to skip translation.
transports: [
{
format: "openai",
baseUrl: "https://api.minimax.io/v1/chat/completions",
auth: { combined: true, header: "Authorization", scheme: "bearer" },
},
{
format: "claude",
baseUrl: "https://api.minimax.io/anthropic/v1/messages",
urlSuffix: "?beta=true",
headers: { ...CLAUDE_API_HEADERS },
auth: { combined: true, header: "x-api-key", scheme: "raw" },
},
],
models: [
{ id: "MiniMax-M3", name: "MiniMax M3", targetFormat: "claude" },
{ id: "MiniMax-M2.7", name: "MiniMax M2.7" },
{ id: "MiniMax-M2.5", name: "MiniMax M2.5" },
{ id: "MiniMax-M2.1", name: "MiniMax M2.1" },
{ id: "minimax-image-01", name: "MiniMax Image 01", params: ["n","size","response_format"], kind: "image" },
{ id: "speech-2.8-hd", name: "Speech 2.8 HD", kind: "tts" },
{ id: "speech-2.8-turbo", name: "Speech 2.8 Turbo", kind: "tts" },
{ id: "speech-2.6-hd", name: "Speech 2.6 HD", kind: "tts" },
{ id: "speech-2.6-turbo", name: "Speech 2.6 Turbo", kind: "tts" },
{ id: "speech-02-hd", name: "Speech 02 HD", kind: "tts" },
{ id: "speech-02-turbo", name: "Speech 02 Turbo", kind: "tts" },
{ id: "speech-01-hd", name: "Speech 01 HD", kind: "tts" },
{ id: "speech-01-turbo", name: "Speech 01 Turbo", kind: "tts" },
],
serviceKinds: ["llm","image","imageToText","webSearch","tts"],
ttsConfig: { baseUrl: "https://api.minimax.io/v1/t2a_v2", authType: "apikey", authHeader: "bearer", format: "minimax-tts" },
imageConfig: { baseUrl: "https://api.minimaxi.com/v1/images/generations" },
searchViaChat: {
defaultModel: "MiniMax-M2.7",
endpoint: "https://api.minimaxi.com/v1/text/chatcompletion_v2",
pricingUrl: "https://www.minimaxi.com/document/price",
},
features: {
usage: true,
usageApikey: true,
},
};