Skip to content

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

Keep endpoint turns off local model injection

fanxing113db2ac5a1627
diff --git a/server/drivers/claude.ts b/server/drivers/claude.ts
index 005258991c..a5b25302ab 100644
--- a/server/drivers/claude.ts
+++ b/server/drivers/claude.ts
@@ -1192,7 +1192,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
args.push("--allowedTools", allowed.join(","));
}
- const env = environment(turnModel);
+ const env = environment(config.endpointModels ? undefined : turnModel);
const authSettings = isolated && !injected.injected
? readClaudeAuthSettings(env, input.environment) : {};
// The hook helper reads its bearer from a per-thread file refreshed every turn, so a
@@ -1979,7 +1979,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
return;
}
const model = named ?? config.managedModels?.[0] ?? config.endpointModels?.[0] ?? "claude-haiku-5-5";
- const env = environment(model);
+ const env = environment(config.endpointModels ? undefined : model);
const args = backgroundCallArgs({ model, outputFormat: onUsage ? "json" : "text", supports: (flag) => cliVersion !== null && claudeCliSupports(cliVersion, flag), isolated: !inheritsUserConfig(env) });
const { child, removeCwd } = spawnBackgroundCall(config.cli, args, env);
let stdout = "";
diff --git a/src/components/ClaudeEndpoints.test.ts b/src/components/ClaudeEndpoints.test.ts
index 88fff2ed7b..04a6ed52e1 100644
--- a/src/components/ClaudeEndpoints.test.ts
+++ b/src/components/ClaudeEndpoints.test.ts
@@ -67,6 +67,18 @@ describe("Claude custom endpoints settings", () => {
expect(html).toContain("1 bot(s) use this account");
});
+ it("counts a task that still points at the endpoint", () => {
+ const bot = { id: "bot-3", modelSelection: { instanceId: "claude", model: "claude-sonnet-5" },
+ tasks: [{ modelSelection: { instanceId: "claude-endpoint-fixture", model: "deepseek-chat" } }] };
+ vi.stubGlobal("window", {});
+ vi.spyOn(store, "useStore").mockReturnValue({
+ state: { ...store.initialState, instances: [endpoint()], bots: [bot] },
+ dispatch: vi.fn(), flushBotPatches: vi.fn(), refreshInstances: vi.fn(), refreshModels: vi.fn(),
+ } as unknown as ReturnType<typeof store.useStore>);
+ const html = renderToStaticMarkup(createElement(ClaudeEndpoints));
+ expect(html).toContain("1 bot(s) use this account");
+ });
+
it("waits for bots to move off an endpoint before offering its removal", () => {
const bot = { id: "bot-1", modelSelection: { instanceId: "claude-endpoint-fixture", model: "deepseek-chat" } };
vi.stubGlobal("window", {});
diff --git a/src/components/ClaudeEndpoints.tsx b/src/components/ClaudeEndpoints.tsx
index 4aa27c556b..d6db841a9e 100644
--- a/src/components/ClaudeEndpoints.tsx
+++ b/src/components/ClaudeEndpoints.tsx
@@ -122,7 +122,8 @@ function EndpointRow({ instance, onEdit }: { instance: InstanceInfo; onEdit: ()
const [removing, setRemoving] = useState(false);
const [error, setError] = useState<string | null>(null);
const usedBy = state.bots.filter((bot) => bot.modelSelection.instanceId === instance.instanceId
- || bot.fallback?.some((candidate) => candidate.instanceId === instance.instanceId)).length;
+ || bot.fallback?.some((candidate) => candidate.instanceId === instance.instanceId)
+ || bot.tasks?.some((task) => task.modelSelection?.instanceId === instance.instanceId)).length;
const endpoint = instance.claudeEndpoint;
const remove = async () => {
setConfirming(false);
diff --git a/src/components/EnginesSettings.tsx b/src/components/EnginesSettings.tsx
index 4ff4375003..df554eb75c 100644
--- a/src/components/EnginesSettings.tsx
+++ b/src/components/EnginesSettings.tsx
@@ -521,7 +521,7 @@ export function EnginesSettings({ simple = false, more }: { simple?: boolean; mo
};
const rows = listed.filter((instance) => !accountGroupOf(instance) || groupOf(instance));
// A hidden ordinary Claude instance takes its card, and the endpoint section inside it, away.
- const orphanEndpoints = !groups.has("claude") && rows.some((instance) => instance.claudeEndpoint !== undefined);
+ const orphanEndpoints = !groups.has("claude");
const isReady = (instance: InstanceInfo) => { const group = groupOf(instance); return group ? accountsReady(groups.get(group)!) : engineReady(instance); };
const renderEngine = (instance: InstanceInfo, bare = false) => {
const group = groupOf(instance);