Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions open-sse/services/modelFamilyFallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ const MODEL_FAMILIES: Record<string, string[]> = {
"claude-sonnet-4-6": ["claude-sonnet-4-5-20250929", "claude-sonnet-4-20250514"],
"claude-sonnet-4-5-20250929": ["claude-sonnet-4-6", "claude-sonnet-4-20250514"],

// NVIDIA Minimax family
"minimaxai/minimax-m2.7": ["minimaxai/minimax-m2.5", "minimax-m2.7", "minimax-m2.5"],
"minimaxai/minimax-m2.5": ["minimaxai/minimax-m2.7", "minimax-m2.5", "minimax-m2.7"],
Comment on lines +90 to +92

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a correctness issue with how the Minimax family is defined here. In this codebase, MODEL_FAMILIES keys and candidates must be bare model names (without the provider prefix like minimaxai/).

Why this is broken:

  1. Lookup Failure: When a request fails, getNextFamilyFallback calls parseModel(currentModel) which extracts the bare model name (e.g., "minimax-m2.7"). It then looks up MODEL_FAMILIES using the bare model name or its hyphenated version ("minimax-m2-7"). Since your keys are prefixed with "minimaxai/", the lookup will return undefined and the fallback will never trigger.
  2. Helper Failures: isInModelFamily and getModelFamily also perform lookups using the bare model name, meaning they will fail to recognize Minimax models as belonging to any family.
  3. Prefix Duplication: Even if the lookup succeeded, getNextFamilyFallback automatically prepends the provider prefix to the candidate. If the candidate is "minimaxai/minimax-m2.5", the resolved fallback model would incorrectly become "minimaxai/minimaxai/minimax-m2.5".

Solution:

Define the keys and candidates using only the bare model names, matching the pattern used by all other families (Gemini, Claude, GPT-5) in this file.

Suggested change
// NVIDIA Minimax family
"minimaxai/minimax-m2.7": ["minimaxai/minimax-m2.5", "minimax-m2.7", "minimax-m2.5"],
"minimaxai/minimax-m2.5": ["minimaxai/minimax-m2.7", "minimax-m2.5", "minimax-m2.7"],
// NVIDIA Minimax family
"minimax-m2.7": ["minimax-m2.5"],
"minimax-m2.5": ["minimax-m2.7"],


// GPT-5 family
"gpt-5": ["gpt-5-mini", "gpt-4o"],
"gpt-5.1": ["gpt-5.1-mini", "gpt-5", "gpt-4o"],
Expand All @@ -113,6 +117,7 @@ const MODEL_UNAVAILABLE_FRAGMENTS = [
"not enabled for",
"access to model",
"improperly formed request", // Kiro 400 (model unavailable)
"invalid argument", // Antigravity 400 (model unavailable)
];

/**
Expand Down
Loading