Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

list_models: list a local model once when the Other engine already offers it (#7348)

Milind Soni4a229160cb72
diff --git a/server/host/own-threads.ts b/server/host/own-threads.ts
index aff4c91bc5..8a3bed319d 100644
--- a/server/host/own-threads.ts
+++ b/server/host/own-threads.ts
@@ -25,6 +25,8 @@ export function createOwnThreads(deps: Pick<SpawnLevelDeps, "sourceLevel" | "may
hint(instanceId: string): EngineHint;
/** Engines whose saved settings could not be read. */
broken?(): ReadonlyArray<{ name: string; hint: EngineHint }>;
+ /** The engines with a local model the Other engine offers listed there only, and the line that says where else it runs. */
+ localOnce?(engines: readonly MenuEngine[]): { engines: MenuEngine[]; also?: string };
}) {
const { store } = deps;
/** The level a new thread opened from a conversation starts at (spawn-level.ts). */
@@ -80,10 +82,12 @@ export function createOwnThreads(deps: Pick<SpawnLevelDeps, "sourceLevel" | "may
const bot = store.bot(botId);
if (!bot) return null;
const current = deps.current(botId, threadId) ?? bot.modelSelection;
- return modelMenu({ engines: deps.registry.instances(), current, pinned: [bot.modelSelection], refusal: (selection) => refusal(selection, bot),
+ const listed: { engines: readonly MenuEngine[]; also?: string } = deps.localOnce?.(deps.registry.instances()) ?? { engines: deps.registry.instances() };
+ const menu = modelMenu({ engines: listed.engines, current, pinned: [bot.modelSelection], refusal: (selection) => refusal(selection, bot),
down: (engine) => deps.givesWay({ instanceId: engine.instanceId, model: engine.models.default }, bot.modelSelection) === "unavailable" ? deps.hint(engine.instanceId) : null,
signedOut: (engine) => deps.givesWay({ instanceId: engine.instanceId, model: engine.models.default }, bot.modelSelection) === "signed-out" ? deps.hint(engine.instanceId) : null,
broken: deps.broken?.() ?? [], search });
+ return listed.also ? { ...menu, localAlso: listed.also } : menu;
},
};
}
diff --git a/server/index.ts b/server/index.ts
index c8f555fa1b..0360d574af 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -272,7 +272,7 @@ import { ENGINE_LIST_REUSE_MS, engineMemory, enginesByUse, ProviderRegistry } fr
import { ManagedDesktopProviders } from "./managed-desktop.ts";
import { mainThread, mainThreadToKeep, wasOldestThread } from "./main-thread.ts"; import { createThreadSaveLines, createThreadScope, reachThreads, scopedMemoryUpdate, threadNotesPrompt } from "./thread-notes.ts";
import { computerKindForResource, ManagedDesktopPolicy, type ComputerKind } from "./managed-policy.ts"; import { nudgeCloudTeamPolicy, remoteAccessPaths, startCloudTeamPolicy, stopCloudTeamPolicy } from "./cloud-team-policy.ts"; import { startCloudTeamRoster, stopCloudTeamRoster } from "./cloud-team-roster.ts"; import { createTeamWelcomeStore } from "./team-welcome.ts"; import { teamOnboarding, teamSignInFor } from "./host/team-join-host.ts";
-import { hostedModelPolicy, HOSTED_MODEL_POLICY_HEADER } from "./hosted-models.ts";
+import { hostedModelPolicy, HOSTED_MODEL_POLICY_HEADER } from "./hosted-models.ts"; import { directLocalModels, localModelsOnce } from "./local-models-once.ts";
import { CLOUD_HOME_SECRET_KEYS, CLOUD_IGNORED_KEYS, cloudHomeConfiguration, cloudHomeOffersPlace, cloudHomePlaceRefusal, firstCloudTurnPatch } from "./cloud-home.ts";
import { botBox, startBotBoxAtBoot } from "./bot-box/boot.ts"; import { attachmentsForBox } from "./box-attachments.ts"; import { brokerPath } from "./bot-box/broker-probe.ts";
import { createCloudSignedHost } from "./host/cloud-signed-host.ts"; import { knownThreads, startThreadLogSweep } from "./host/thread-log-sweep.ts"; import { createDeleteLeftovers, engineSessionFolders, instanceEnvironment } from "./host/delete-leftovers.ts"; import { createConversationFolderCleanup, deleteTimeCleanup, linuxProcessPaths } from "./host/conversation-folder-cleanup.ts"; import { threadsMentioning, transcriptThreads } from "./host/transcript-mentions.ts"; import { orphanSweepMode, startOrphanSweep } from "./host/orphan-sweep.ts"; import { idleReclaimMode, idleReclaimNote, startIdleReclaim } from "./host/idle-reclaim.ts"; import { createBotNameClash } from "./host/bot-name-clash.ts"; import { hiddenThreadRefusal, hideOthersSyncFolders } from "./host/team-private.ts"; import { createTeamMemberLeft, memoryLayerRecords } from "./host/team-member-left.ts"; import { createUploadOwners, uploadsFor } from "./host/member-uploads.ts"; import { createMemberOwnBot } from "./host/member-own-bot.ts"; import { createVisibilityHost } from "./host/visibility-host.ts"; import { createBotAccessHost, refusalFor, relayedSendRefusal } from "./host/bot-access-gate.ts"; import { createBotAccessRoutes, writeAccess } from "./routes/bot-access.ts"; import { createAccessRequests } from "./host/access-requests.ts";
@@ -9070,7 +9070,7 @@ const validateModelProposal = (selection: ModelSelection, current?: BotRecord):
}
return null;
};
-const engineHints = createEngineHints({ registry, access: (id) => providerConfigs()[id]?.access ?? registry.access(id), managed: (id) => managedDesktop.owns(id), policy: policyModelRefusal, ...(hostedModels ? { offered: (selection) => hostedModels!.allows(selection) } : {}) }); const ownThreads = createOwnThreads({ store, registry, node: (id) => coordinator.node(id), current: turnSelection, proposalRefusal: validateModelProposal, givesWay: modelGivesWay, modelName, hint: engineHints.hint, broken: engineHints.broken, sourceLevel: sourceApprovalMode, mayRaise: (threadId) => !outsideLineage.handsNoLevel(threadId) && (!CLOUD_HOME || cloudOwnerPerson(threadPersonKey(threadId))) && (!HOSTED_WORKSPACE || sharedWorkspaceFullAccessEnabled()) }); const burst = createBurstHost({ dataDir: DATA_DIR, cloudHome: Boolean(CLOUD_HOME), tier: () => cloudPlanTier.tier(), maxParallel: () => cfg.burst?.maxParallel, hasRoom: () => engineMemory.laneHasRoom(), store, language: (threadId) => threadLanguage(threadId), startTurn: (botId, text, opts) => startTurn(botId, text, opts), stop: (botId, threadId, cause) => { void interruptDirectThread(botId, threadId, cause).catch(() => {}); }, threadBusy, opened: (threadId, parent) => threadStarters.set(threadId, openerFrom(parent)), origin: (run) => withPerson({ kind: "user", request: quoteInNote(run.task, 400) }, threadPersonKey(run.threadId)), approval: ownThreads.approvalFor, defaultModel: (bot, threadId) => burstDefaultModel({ own: store.taskByThread(bot.id, threadId)?.modelSelection ?? bot.modelSelection, catalog: (id) => registry.get(id)?.models, refused: (id) => quickFallback.refused(id), usable: (selection) => ownThreads.refusal(selection, bot) === null }), modelName, route: (notification) => teamMessages.route(notification, { routine: true }), announce: (notification) => { broadcast({ kind: "notify", notification: logNotification(notification) }); } });
+const engineHints = createEngineHints({ registry, access: (id) => providerConfigs()[id]?.access ?? registry.access(id), managed: (id) => managedDesktop.owns(id), policy: policyModelRefusal, ...(hostedModels ? { offered: (selection) => hostedModels!.allows(selection) } : {}) }); const ownThreads = createOwnThreads({ store, registry, node: (id) => coordinator.node(id), current: turnSelection, proposalRefusal: validateModelProposal, givesWay: modelGivesWay, modelName, hint: engineHints.hint, broken: engineHints.broken, localOnce: (engines) => localModelsOnce(engines, directLocalModels(providerConfigs(), (id, saved) => { const engine = registry.get(id), live = threadEngine(id); if (!engine || !live || !readyToRun(live, selectionContext)) return null; return { name: engine.displayName || id, models: [...saved, ...engine.models.options.map((option) => option.id)].filter((model) => !hostedModels || hostedModels.allows({ instanceId: id, model })) }; })), sourceLevel: sourceApprovalMode, mayRaise: (threadId) => !outsideLineage.handsNoLevel(threadId) && (!CLOUD_HOME || cloudOwnerPerson(threadPersonKey(threadId))) && (!HOSTED_WORKSPACE || sharedWorkspaceFullAccessEnabled()) }); const burst = createBurstHost({ dataDir: DATA_DIR, cloudHome: Boolean(CLOUD_HOME), tier: () => cloudPlanTier.tier(), maxParallel: () => cfg.burst?.maxParallel, hasRoom: () => engineMemory.laneHasRoom(), store, language: (threadId) => threadLanguage(threadId), startTurn: (botId, text, opts) => startTurn(botId, text, opts), stop: (botId, threadId, cause) => { void interruptDirectThread(botId, threadId, cause).catch(() => {}); }, threadBusy, opened: (threadId, parent) => threadStarters.set(threadId, openerFrom(parent)), origin: (run) => withPerson({ kind: "user", request: quoteInNote(run.task, 400) }, threadPersonKey(run.threadId)), approval: ownThreads.approvalFor, defaultModel: (bot, threadId) => burstDefaultModel({ own: store.taskByThread(bot.id, threadId)?.modelSelection ?? bot.modelSelection, catalog: (id) => registry.get(id)?.models, refused: (id) => quickFallback.refused(id), usable: (selection) => ownThreads.refusal(selection, bot) === null }), modelName, route: (notification) => teamMessages.route(notification, { routine: true }), announce: (notification) => { broadcast({ kind: "notify", notification: logNotification(notification) }); } });
const teamMemory = new TeamMemory(join(DATA_DIR, "team-memory.json"));
const teamMemoryRequests = createTeamMemoryRequests({ teamMemory, store, sectionKey: sectionContextKey, decide: (row) => appendDecision(DATA_DIR, row) });
const outsideWrites = createOutsideWrites({ store, notify, language: (threadId) => threadLanguage(threadId), decide: (row) => appendDecision(DATA_DIR, row),
diff --git a/server/local-models-once.test.ts b/server/local-models-once.test.ts
new file mode 100644
index 0000000000..ccb52dc8dd
--- /dev/null
+++ b/server/local-models-once.test.ts
@@ -0,0 +1,113 @@
+import { rmSync } from "node:fs";
+import { beforeEach, describe, expect, it } from "vitest";
+
+import type { ModelSelection } from "../shared/wire.ts";
+import { DATA_DIR, instanceConfigs, type AppConfig } from "./config.ts";
+import { createOwnThreads } from "./host/own-threads.ts";
+import { directLocalModels, localModelsOnce, localServer, type DirectLocalEngine } from "./local-models-once.ts";
+import type { MenuEngine } from "./routes/internal-models.ts";
+import { Store } from "./store.ts";
+
+const engine = (instanceId: string, driverKind: string, displayName: string, ids: string[]) => ({
+ instanceId, driverKind, displayName, models: { default: ids[0] ?? "", options: ids.map((id) => ({ id, label: id })) }, adapter: { capabilities: {} },
+});
+const claude = engine("claude", "claudeAgent", "Claude", ["claude-sonnet-5", "ollama::gemma4:26b", "ollama::qwen3:8b", "lmstudio::gemma4:26b"]);
+const codex = engine("codex", "codex", "Codex", ["gpt-5.5", "ollama::gemma4:26b"]);
+const pi = engine("pi", "piAgent", "pi", ["ollama::gemma4:26b"]);
+const ids = (engines: ReadonlyArray<ReturnType<typeof engine>>) => Object.fromEntries(engines.map((one) => [one.instanceId, one.models.options.map((option) => option.id)]));
+const other = (config: Record<string, unknown>, extra: Partial<DirectLocalEngine> = {}): Record<string, DirectLocalEngine> =>
+ ({ openaiCompat: { driver: "openai-compat", config, ...extra } });
+/** `offered`: what the Other engine offers a bot now (ready, allowed); null when it is blocked or unavailable. */
+const direct = (configs: Record<string, DirectLocalEngine>, offered: string[] | null = []) =>
+ directLocalModels(configs, (_id, saved) => offered ? { name: "Other (OpenAI-compatible)", models: [...saved, ...offered] } : null);
+const once = (configs: Record<string, DirectLocalEngine>, offered: string[] | null = []) => ids(localModelsOnce([claude, codex, pi], direct(configs, offered)).engines);
+const ollama = { url: "http://127.0.0.1:11434/v1", model: "gemma4:26b" };
+
+describe("localModelsOnce", () => {
+ it("lists a model the Other engine offers on the same local server only there, and says once where else it runs", () => {
+ const result = localModelsOnce([claude, codex, pi], direct(other(ollama)));
+ expect(ids(result.engines)).toEqual({
+ claude: ["claude-sonnet-5", "ollama::qwen3:8b", "lmstudio::gemma4:26b"],
+ codex: ["gpt-5.5"],
+ // An engine whose local models are its whole list keeps them.
+ pi: ["ollama::gemma4:26b"],
+ });
+ expect(result.also).toBe("Other (OpenAI-compatible)'s local models also run on Claude, Codex with their own tools: model \"ollama::<model>\"");
+ });
+
+ it("counts every model the Other engine offers from that server, however the address and the name are spelled", () => {
+ // Ollama's own list, read by the Other engine: every model in it is reached there.
+ expect(once(other({ url: "http://localhost:11434" }), ["gemma4:26b", "qwen3:8b"]).claude).toEqual(["claude-sonnet-5", "lmstudio::gemma4:26b"]);
+ expect(once(other({ url: "http://[::1]:11434/v1/", model: "gemma4:26b" })).codex).toEqual(["gpt-5.5"]);
+ const latest = engine("claude", "claudeAgent", "Claude", ["ollama::llama3"]);
+ expect(ids(localModelsOnce([latest], direct(other({ url: "http://127.0.0.1:11434/v1", model: "llama3:latest" }))).engines)).toEqual({ claude: [] });
+ });
+
+ it("keeps the copies under Claude and Codex when the Other engine has another model, another server, or is off, hidden or unreadable", () => {
+ const all = ids([claude, codex, pi]);
+ expect(once(other({ ...ollama, model: "llama3:8b" }))).toEqual(all);
+ expect(once(other({ ...ollama, url: "http://127.0.0.1:8080/v1" }))).toEqual(all);
+ expect(once(other({ ...ollama, url: "http://192.168.1.20:11434/v1" }))).toEqual(all);
+ expect(once(other({ ...ollama, url: "https://openrouter.ai/api/v1" }))).toEqual(all);
+ expect(once(other(ollama, { enabled: false }))).toEqual(all);
+ expect(once(other(ollama, { hidden: true }))).toEqual(all);
+ expect(once(other({ ...ollama, url: 42 }))).toEqual(all);
+ expect(once({})).toEqual(all);
+ expect(localModelsOnce([claude], direct({})).also).toBeUndefined();
+ });
+
+ it("never lets a blocked or unavailable Other engine take a model away", () => {
+ const all = ids([claude, codex, pi]);
+ // Not ready, refused by the organization, or not offered by this server: the host says it offers nothing.
+ expect(once(other(ollama), null)).toEqual(all);
+ // Offered, but only another model there (this server allows that one only): the saved model is not hidden.
+ const onlyQwen = directLocalModels(other(ollama), () => ({ name: "Other", models: ["qwen3:8b"] }));
+ expect(ids(localModelsOnce([codex], onlyQwen).engines)).toEqual({ codex: ["gpt-5.5", "ollama::gemma4:26b"] });
+ });
+
+ it("treats LM Studio's own port as its own server", () => {
+ expect(once(other({ ...ollama, url: "http://127.0.0.1:1234/v1" })).claude).toEqual(["claude-sonnet-5", "ollama::gemma4:26b", "ollama::qwen3:8b"]);
+ });
+
+ it("reads the Other engine's address where Settings saves it, on the engine or as the shared one", () => {
+ const shared = instanceConfigs({ openaiCompat: { url: "http://127.0.0.1:11434/v1", model: "gemma4:26b" } } as AppConfig);
+ expect(shared.openaiCompat?.driver).toBe("openai-compat");
+ expect(ids(localModelsOnce([codex], directLocalModels(shared, (id, saved) => id === "openaiCompat" ? { name: "Other", models: saved } : null)).engines)).toEqual({ codex: ["gpt-5.5"] });
+ const own = instanceConfigs({ instances: { openaiCompat: { driver: "openai-compat", config: { url: "http://localhost:11434/v1", model: "gemma4:26b" } } } } as AppConfig);
+ expect(ids(localModelsOnce([codex], directLocalModels(own, (_id, saved) => ({ name: "Other", models: saved }))).engines)).toEqual({ codex: ["gpt-5.5"] });
+ });
+});
+
+describe("list_models with the Other engine on Ollama", () => {
+ beforeEach(() => {
+ rmSync(DATA_DIR, { recursive: true, force: true });
+ });
+
+ it("changes only the bot's list, and still lists the bot's own model and the current one", () => {
+ const store = new Store(() => ({ instanceId: "claude", model: "claude-sonnet-5" }));
+ const bot = store.createBot();
+ const mine: ModelSelection = { instanceId: "codex", model: "ollama::gemma4:26b" };
+ store.patchBot(bot.id, { modelSelection: mine });
+ const engines = [claude, codex] as unknown as MenuEngine[];
+ const own = createOwnThreads({ store, registry: { instances: () => engines, cliTarget: () => null }, node: () => undefined,
+ current: () => undefined, proposalRefusal: () => null, givesWay: () => null, modelName: (one) => one.model, hint: () => ({ why: "", connect: "" }),
+ sourceLevel: () => "ask", mayRaise: () => true, localOnce: (listed) => localModelsOnce(listed, direct(other(ollama))) });
+ const menu = own.menu(bot.id, bot.threadId, undefined)!;
+ expect(menu.engines.find((row) => row.instanceId === "claude")?.models).toEqual(["claude-sonnet-5", "ollama::qwen3:8b", "lmstudio::gemma4:26b"]);
+ // The bot's own model leads its engine's list whatever the rule leaves out.
+ expect(menu.engines.find((row) => row.instanceId === "codex")?.models).toEqual(["ollama::gemma4:26b", "gpt-5.5"]);
+ expect(menu.localAlso).toMatch(/also run on Claude, Codex with their own tools/u);
+ // What the picker reads is the registry's own list, untouched.
+ expect(engines[0]!.models.options.map((option) => option.id)).toContain("ollama::gemma4:26b");
+ });
+});
+
+describe("localServer", () => {
+ it("is one place for 127.0.0.1, localhost and ::1 on a port, and nothing for another computer", () => {
+ expect(localServer("http://127.0.0.1:11434/v1")).toBe(localServer("http://LOCALHOST:11434"));
+ expect(localServer("http://[::1]:11434")).toBe(localServer("http://localhost:11434/"));
+ expect(localServer("http://127.0.0.1:1234/v1")).not.toBe(localServer("http://127.0.0.1:11434/v1"));
+ expect(localServer("http://10.0.0.5:11434/v1")).toBeNull();
+ expect(localServer("not a url")).toBeNull();
+ });
+});
diff --git a/server/local-models-once.ts b/server/local-models-once.ts
new file mode 100644
index 0000000000..5d8c0d89d8
--- /dev/null
+++ b/server/local-models-once.ts
@@ -0,0 +1,106 @@
+// A local model is offered to a bot once. Claude and Codex each list the models a local server on this computer serves
+// (Ollama, LM Studio and the like, local-inject.ts), because both can route a turn to one. When the person has also set
+// up the Other (OpenAI-compatible) engine on that same server, the model is listed there too: three entries for one
+// model in list_models. So a model that engine offers is not listed again under Claude or Codex there; one short line
+// says those two can still run it with their own tools. Only the bot's list_models changes: the model picker and
+// Settings list what they always did, and an id runs whether or not a list shows it.
+import { INJECT_SEP, localHost } from "./drivers/local-inject.ts";
+import { pickedName } from "./drivers/ollama-context.ts";
+import { OpenAICompatDriver } from "./drivers/openai-compat.ts";
+
+/** The engines whose lists carry local models only as a second route to them. */
+const ROUTED_THROUGH = new Set(["claudeAgent", "codex"]);
+const LOOPBACK = new Set(["127.0.0.1", "localhost", "[::1]", "::1"]);
+
+/** A server on this computer, by port: 127.0.0.1, localhost and ::1 are one place, and /v1 or not is one server. */
+export function localServer(url: string): string | null {
+ try {
+ const parsed = new URL(url);
+ if (!LOOPBACK.has(parsed.hostname.toLowerCase())) return null;
+ return `${parsed.protocol}//loopback:${parsed.port || (parsed.protocol === "https:" ? "443" : "80")}`;
+ } catch {
+ return null;
+ }
+}
+
+/** One name for a model however it is spelled: `gemma4` and `gemma4:latest`, and the app's own names that carry a window. */
+const sameModel = (model: string) => {
+ const name = pickedName(model).toLowerCase();
+ return name.endsWith(":latest") ? name.slice(0, -":latest".length) : name;
+};
+
+const key = (server: string, model: string) => `${server} ${sameModel(model)}`;
+
+export interface DirectLocalEngine {
+ driver: string;
+ enabled?: boolean;
+ hidden?: boolean;
+ config?: unknown;
+}
+
+export interface DirectLocal {
+ /** server+model pairs the Other engine offers. */
+ models: Set<string>;
+ /** Its name, by instance id, for the line that says Claude and Codex can still run them. */
+ names: Map<string, string>;
+}
+
+/** The server+model pairs an Other (OpenAI-compatible) engine on this computer offers now: its saved model and its list,
+ * which for Ollama is everything the server holds. `offered(instanceId)` gives the models a bot could open a thread on
+ * there (ready, allowed by the organization and by this server), or null when none: a blocked or unavailable Other
+ * engine never takes a model away from Claude and Codex. */
+export function directLocalModels(
+ configs: Readonly<Record<string, DirectLocalEngine>>,
+ offered: (instanceId: string, models: readonly string[]) => { name: string; models: readonly string[] } | null,
+): DirectLocal {
+ const direct: DirectLocal = { models: new Set(), names: new Map() };
+ for (const [instanceId, entry] of Object.entries(configs)) {
+ if (entry.driver !== "openai-compat" || entry.enabled === false || entry.hidden === true) continue;
+ let config: { url: string; model?: string };
+ try {
+ // As the engine reads it: the saved address, else the one the server was started with.
+ config = OpenAICompatDriver.decodeConfig(entry.config);
+ } catch {
+ continue;
+ }
+ const server = localServer(config.url);
+ if (!server) continue;
+ const engine = offered(instanceId, config.model ? [config.model] : []);
+ if (!engine?.models.length) continue;
+ direct.names.set(instanceId, engine.name);
+ for (const model of engine.models) direct.models.add(key(server, model));
+ }
+ return direct;
+}
+
+/** The server+model a Claude or Codex local id routes to, when it is one. */
+function routedTo(id: string): string | null {
+ const sep = id.indexOf(INJECT_SEP);
+ const host = sep > 0 ? localHost(id.slice(0, sep)) : undefined;
+ const server = host && localServer(host.baseUrl);
+ return server ? key(server, id.slice(sep + INJECT_SEP.length)) : null;
+}
+
+type Listed = { instanceId: string; driverKind: string; displayName: string | undefined; models: { default: string; options: ReadonlyArray<{ id: string }> } };
+
+/** `engines` with Claude's and Codex's copies of a model the Other engine offers left out, and, when any was, the line
+ * that keeps the second route known. The current model and the bot's own are listed by the menu whatever this leaves. */
+export function localModelsOnce<E extends Listed>(engines: readonly E[], direct: DirectLocal): { engines: E[]; also?: string } {
+ if (!direct.models.size) return { engines: [...engines] };
+ const routes = new Map<string, Set<string>>();
+ const listed = engines.map((engine) => {
+ if (!ROUTED_THROUGH.has(engine.driverKind)) return engine;
+ const options = engine.models.options.filter((option) => {
+ const routed = routedTo(option.id);
+ if (!routed || !direct.models.has(routed)) return true;
+ const ids = routes.get(engine.instanceId) ?? new Set<string>();
+ routes.set(engine.instanceId, ids.add(option.id.slice(0, option.id.indexOf(INJECT_SEP))));
+ return false;
+ });
+ return options.length === engine.models.options.length ? engine : { ...engine, models: { ...engine.models, options } };
+ });
+ if (!routes.size) return { engines: listed };
+ const through = engines.filter((engine) => routes.has(engine.instanceId)).map((engine) => engine.displayName || engine.instanceId);
+ const hosts = [...new Set([...routes.values()].flatMap((ids) => [...ids]))].map((host) => `"${host}${INJECT_SEP}<model>"`).join(" or ");
+ return { engines: listed, also: `${[...direct.names.values()].join(", ")}'s local models also run on ${through.join(", ")} with their own tools: model ${hosts}` };
+}
diff --git a/server/routes/internal-models.ts b/server/routes/internal-models.ts
index 456d458367..3842994553 100644
--- a/server/routes/internal-models.ts
+++ b/server/routes/internal-models.ts
@@ -47,6 +47,8 @@ export interface ModelMenu {
engines: MenuRow[];
/** Engines that can't run anything now (not set up, turned off, unreachable), by why and how to connect. */
unavailable?: UnavailableGroup[];
+ /** Where the local models listed under the Other engine also run (Claude, Codex), once instead of a copy each. */
+ localAlso?: string;
}
const squash = (text: string) => text.toLowerCase().replace(/[^a-z0-9]/g, "");