-
Notifications
You must be signed in to change notification settings - Fork 92
OpenRouter Integration: 'models' array exceeds maximum limit of 3 #3119
Description
Description
Mux is incorrectly sending more than 3 model identifiers in the models array parameter when calling the OpenRouter API. According to OpenRouter's API specification, the models array must contain 3 items or fewer. This causes the API request to fail with the error:
"'models' array must have 3 items or fewer."
Steps to Reproduce
-
Disable all sub-agents in Mux settings:
- Auto
- Orchestrator
- Plan
- Explore
- Name Workspace
- System1 Bash
-
Configure specific models (not "Inherit") for all remaining active agents:
- Exec agent
- Chat With Mux
- Compact agent
-
Initiate any request that triggers the Exec agent via OpenRouter provider
-
Observe the error in the logs - Mux sends an array with 4+ models despite most agents being disabled
Expected Behavior
Mux should limit the models array to a maximum of 3 items when calling OpenRouter API, or provide an option to use the singular model parameter instead of the models array when no fallback models are needed.
Actual Behavior
Mux continues to include models for disabled agents in the API request, resulting in an array with 4+ elements:
{
"providerName": "openrouter",
"mode": "exec",
"agentId": "exec",
"model": "openrouter:xiaomi/mimo-v2-pro"
}Technical Evidence
Error Message:
'models' array must have 3 items or fewer.
API Request Payload (inferred):
{
"models": [
"openrouter:xiaomi/mimo-v2-pro",
"openrouter:minimax/minimax-m2.7",
"another-model",
"yet-another-model"
]
}Root Cause Analysis
Mux appears to internally construct the models array for OpenRouter's routing/fallback feature by including:
- ✅ Exec agent model
⚠️ Plan agent model (even when Plan agent is disabled)⚠️ Explore agent model (even when Explore agent is disabled)⚠️ Additional fallback models (possibly auto-added)
The core issue: The UI-level agent disablement is not being respected when building the API request payload. The internal routing logic continues to include all potential agent models regardless of their active/disabled status.
Environment
- Provider: OpenRouter
- Active Agents: Exec, Chat With Mux, Compact
- Disabled Agents: Auto, Orchestrator, Plan, Explore, Name Workspace, System1 Bash
- Model Configuration: Specific models selected (not "Inherit")
Suggested Solution
Implement one of the following fixes:
Option 1: Respect Disabled Agents (Recommended)
Only include models in the models array for agents that are currently enabled in the workspace settings.
Option 2: Hard Limit
Enforce a maximum of 3 models in the array, prioritizing by:
- Primary agent (Exec)
- Secondary agents (Chat With Mux, Compact)
- Discarding any additional models with a warning log
Option 3: Use Singular model Parameter
When only one model is configured (or fallbacks are disabled), use the singular model parameter instead of the models array to avoid the limit entirely.
Priority: High - This prevents users from using OpenRouter when they have more than 3 agent types configured, even if most are disabled.