diff --git a/src/agents/live-model-filter.ts b/src/agents/live-model-filter.ts index 3e4ce5dd256..745d5e88bdc 100644 --- a/src/agents/live-model-filter.ts +++ b/src/agents/live-model-filter.ts @@ -20,6 +20,8 @@ const HIGH_SIGNAL_LIVE_MODEL_PRIORITY = [ "minimax/minimax-m2.7", "openai/gpt-5.2", "openai-codex/gpt-5.2", + "openrouter/openai/gpt-5.2-chat", + "openrouter/minimax/minimax-m2.7", "opencode-go/glm-5", "openrouter/ai21/jamba-large-1.7", "xai/grok-4-1-fast-non-reasoning", @@ -37,6 +39,11 @@ const DEFAULT_HIGH_SIGNAL_LIVE_EXCLUDED_PROVIDERS = new Set(["codex", "codex-cli const HIGH_SIGNAL_LIVE_MODEL_PRIORITY_INDEX = new Map( HIGH_SIGNAL_LIVE_MODEL_PRIORITY.map((key, index) => [key, index]), ); +const OPENROUTER_HIGH_SIGNAL_LIVE_MODEL_IDS = new Set( + HIGH_SIGNAL_LIVE_MODEL_PRIORITY.filter((key) => key.startsWith("openrouter/")).map((key) => + key.slice("openrouter/".length), + ), +); function isHighSignalClaudeModelId(id: string): boolean { const normalized = id.replace(/[_.]/g, "-"); @@ -126,6 +133,13 @@ function isUnsupportedFireworksLiveModelRef(provider: string, id: string): boole return !HIGH_SIGNAL_LIVE_MODEL_PRIORITY_INDEX.has(`${provider}/${id}`); } +function isUnsupportedOpenRouterLiveModelRef(provider: string, id: string): boolean { + if (provider !== "openrouter") { + return false; + } + return !OPENROUTER_HIGH_SIGNAL_LIVE_MODEL_IDS.has(id); +} + export function isModernModelRef(ref: ModelRef): boolean { const provider = normalizeProviderId(ref.provider ?? ""); const id = normalizeLowercaseStringOrEmpty(ref.id); @@ -164,6 +178,9 @@ export function isHighSignalLiveModelRef(ref: ModelRef): boolean { if (isUnsupportedFireworksLiveModelRef(provider, id)) { return false; } + if (isUnsupportedOpenRouterLiveModelRef(provider, id)) { + return false; + } if (isOldMiniMaxLiveModelRef(id)) { return false; } diff --git a/src/agents/model-compat.test.ts b/src/agents/model-compat.test.ts index 89c09a9b8c2..48dfd17f088 100644 --- a/src/agents/model-compat.test.ts +++ b/src/agents/model-compat.test.ts @@ -528,6 +528,29 @@ describe("isHighSignalLiveModelRef", () => { ); }); + it("keeps only curated OpenRouter routes in the default live matrix", () => { + providerRuntimeMocks.resolveProviderModernModelRef.mockReturnValue(true); + + expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "openai/gpt-5.2-chat" })).toBe( + true, + ); + expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "minimax/minimax-m2.7" })).toBe( + true, + ); + expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "ai21/jamba-large-1.7" })).toBe( + true, + ); + expect( + isHighSignalLiveModelRef({ provider: "openrouter", id: "allenai/olmo-3.1-32b-instruct" }), + ).toBe(false); + expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "amazon/nova-lite-v1" })).toBe( + false, + ); + expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "amazon/nova-micro-v1" })).toBe( + false, + ); + }); + it("drops GLM 4.x models from the default live matrix while keeping GLM 5", () => { providerRuntimeMocks.resolveProviderModernModelRef.mockReturnValue(true);