Fix custom provider models missing from model dropdowns

The /models endpoint restricted results to providers configured in
Fusion's auth.json/models.json stores, but custom providers live in
global settings and register under customProviderRegistryKey(). Their
keys were never added to the allowlist, so their models were filtered
out before reaching the dropdowns. Add the custom provider registry
keys to the configured-providers set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-06-12 00:05:10 -07:00
parent b9ec794f47
commit a83c2d89fe
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix custom provider models not appearing in model dropdowns. The `/models` endpoint filtered results to providers configured in Fusion's auth stores, which excluded custom providers (stored in global settings). Their registry keys are now added to the allowlist so their models surface in pickers.

View File

@@ -1,7 +1,8 @@
import { access, readFile } from "node:fs/promises";
import { homedir } from "node:os";
import { join } from "node:path";
import { resolvePlanningSettingsModel } from "@fusion/core";
import { customProviderRegistryKey, resolvePlanningSettingsModel } from "@fusion/core";
import type { CustomProvider } from "@fusion/core";
import { ApiError } from "../api-error.js";
import type { ApiRouteRegistrar } from "./types.js";
@@ -77,6 +78,7 @@ export const registerModelRoutes: ApiRouteRegistrar = (ctx) => {
let useCursorCli = false;
let resolvedPlanningProvider: string | undefined;
let resolvedPlanningModelId: string | undefined;
let customProviders: CustomProvider[] = [];
if (store) {
try {
const globalStore = store.getGlobalSettingsStore();
@@ -89,6 +91,7 @@ export const registerModelRoutes: ApiRouteRegistrar = (ctx) => {
useDroidCli = globalSettings.useDroidCli === true;
useLlamaCpp = globalSettings.useLlamaCpp === true;
useCursorCli = (globalSettings as Record<string, unknown>).useCursorCli === true;
customProviders = globalSettings.customProviders ?? [];
const mergedSettings = await store.getSettingsFast();
const resolvedPlanningModel = resolvePlanningSettingsModel(mergedSettings);
@@ -163,6 +166,11 @@ export const registerModelRoutes: ApiRouteRegistrar = (ctx) => {
if (useClaudeCli) configuredProviders.add("pi-claude-cli");
if (useDroidCli) configuredProviders.add("droid-cli");
if (useLlamaCpp) configuredProviders.add("llama-server");
// Custom providers are configured in Fusion's global settings rather than
// the auth.json/models.json stores, so add their registry keys explicitly.
for (const provider of customProviders) {
configuredProviders.add(customProviderRegistryKey(provider, customProviders));
}
models = models.filter((m) => configuredProviders.has(m.provider));
res.json({