Prevent injecting other models into the LiteLLM model list (#11771)

This commit is contained in:
Tomás Barreiro
2026-06-24 02:41:49 +02:00
committed by GitHub
parent 3aa950d0e4
commit ebee61a5b7
2 changed files with 21 additions and 0 deletions
@@ -296,6 +296,17 @@ describe("resolveProviderConfig", () => {
capabilities: expect.arrayContaining(["images", "reasoning"]),
}),
);
expect(resolved?.knownModels?.["private-proxy-model"]).toEqual(
expect.objectContaining({
name: "private-proxy-model",
capabilities: expect.arrayContaining(["images", "reasoning"]),
}),
);
expect(Object.keys(resolved?.knownModels ?? {}).sort()).toEqual([
"openai/gpt-4o-mini",
"private-proxy-model",
]);
expect(resolved?.knownModels?.["gpt-5.4"]).toBeUndefined();
});
it("reports attempted path, auth header, status, and body for LiteLLM model fetch failures", async () => {
@@ -171,6 +171,16 @@ async function mergeKnownModels(
...userKnownModels,
});
}
// LiteLLM model access is configured by the user's proxy. When the proxy
// returns a private model list, treat it as the authoritative allowlist so
// the picker does not show bundled OpenAI-compatible catalog entries that the
// proxy may not actually expose.
if (providerId === "litellm" && Object.keys(privateModels).length > 0) {
return Llms.sortModelsByReleaseDate({
...privateModels,
...userKnownModels,
});
}
if (providerId === "openai-codex") {
return Llms.sortModelsByReleaseDate({
...defaultKnownModels,