Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(models): resolve openrouter-prefixed model metadata (#2203)

Fatih özdemired1cc00edf2f
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 698bbc032..cdf8bbae9 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -288,7 +288,7 @@ function resolveReasoningRoute(
visionProviderImageWired: providerSupportsImages(vision.config.provider),
baseProviderImageWired: providerSupportsImages(agent.config.provider),
isCloudAgent: isCloudDictationAgentMode(),
- baseModelSupportsVision: !!getCloudModel(agent.model)?.supportsVision,
+ baseModelSupportsVision: !!getCloudModel(agent.model, agent.config.provider)?.supportsVision,
});
const target = useVisionOverride ? vision : agent;
logger.logReasoning("AGENT_IMAGE_TARGET", {
diff --git a/src/helpers/dictationAgentInference.js b/src/helpers/dictationAgentInference.js
index 69218b35a..ea2ba0812 100644
--- a/src/helpers/dictationAgentInference.js
+++ b/src/helpers/dictationAgentInference.js
@@ -185,7 +185,7 @@ export function resolveChatStreamingInference(
resolveModeProvider({ isCloud, mode: config.mode, provider: config.provider })
),
isCloudAgent: isCloud,
- baseModelSupportsVision: !!getCloudModel(config.model)?.supportsVision,
+ baseModelSupportsVision: !!getCloudModel(config.model, config.provider)?.supportsVision,
});
if (!useVisionOverride) return { config, attachScreenContext: attach };
return {
diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.ts
index 44f00f9f5..92eba21f9 100644
--- a/src/models/ModelRegistry.ts
+++ b/src/models/ModelRegistry.ts
@@ -475,7 +475,10 @@ export function getWhisperModelInfo(modelId: string): WhisperModelInfo | undefin
export const WHISPER_MODEL_INFO = modelData.whisperModels;
-export function getCloudModel(modelId: string): CloudModelDefinition | undefined {
+export function getCloudModel(
+ modelId: string,
+ providerId?: string
+): CloudModelDefinition | undefined {
for (const provider of modelData.cloudProviders) {
const model = provider.models.find((m) => m.id === modelId);
if (model) return model;
@@ -484,6 +487,11 @@ export function getCloudModel(modelId: string): CloudModelDefinition | undefined
const model = provider.models.find((m) => m.id === modelId);
if (model) return model;
}
+ // OpenRouter ids carry a vendor prefix (google/gemini-3.5-flash-lite) that the
+ // registry stores without, so retry on the upstream id.
+ if (providerId === "openrouter" && modelId.includes("/")) {
+ return getCloudModel(modelId.slice(modelId.lastIndexOf("/") + 1));
+ }
return undefined;
}
@@ -512,7 +520,7 @@ export function getOpenAiApiConfig(modelId: string, provider?: string): OpenAiAp
// registry knows rejects temperature (Claude Opus 4.7+, #1417) must keep it
// omitted here too — OpenRouter forwards the 400 rather than stripping it.
if (provider === "openrouter" && modelId.includes("/")) {
- const upstream = getCloudModel(modelId.slice(modelId.lastIndexOf("/") + 1));
+ const upstream = getCloudModel(modelId, provider);
return { tokenParam: "max_tokens", supportsTemperature: upstream?.supportsTemperature ?? true };
}
diff --git a/test/helpers/modelRegistryOpenRouterLookup.test.js b/test/helpers/modelRegistryOpenRouterLookup.test.js
new file mode 100644
index 000000000..1ab13acdd
--- /dev/null
+++ b/test/helpers/modelRegistryOpenRouterLookup.test.js
@@ -0,0 +1,27 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+const modelRegistryData = require("../../src/models/modelRegistryData.json");
+
+const load = () => import("../../src/models/ModelRegistry.ts");
+
+// OpenRouter ids carry a vendor prefix the registry stores without. The
+// screen-context gate reads supportsVision off the registry entry, so a miss
+// here drops every screenshot for an OpenRouter agent (#2203).
+test("openrouter vendor-prefixed ids resolve to the upstream registry model", async () => {
+ const { getCloudModel } = await load();
+
+ assert.equal(getCloudModel("google/gemini-3.5-flash-lite", "openrouter")?.supportsVision, true);
+ assert.equal(getCloudModel("google/gemini-3.5-flash-lite"), undefined);
+ assert.equal(getCloudModel("google/gemini-3.5-flash-lite", "custom"), undefined);
+});
+
+test("an exact registry id wins before the prefix is stripped", async () => {
+ const { getCloudModel } = await load();
+ // Groq lists gpt-oss under its OpenRouter-style id.
+ const groqGptOss = modelRegistryData.cloudProviders
+ .find((provider) => provider.id === "groq")
+ .models.find((model) => model.id === "openai/gpt-oss-120b");
+
+ assert.deepEqual(getCloudModel("openai/gpt-oss-120b", "openrouter"), groqGptOss);
+});