Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Backup note: use the server's pay-per-use rule (API access only)
AdityaUmale9665a5f460fa
diff --git a/src/lib/engine-rail.test.ts b/src/lib/engine-rail.test.tsindex 22bb94cbb2..c38b59ca46 100644--- a/src/lib/engine-rail.test.ts+++ b/src/lib/engine-rail.test.ts@@ -188,13 +188,14 @@ describe("backupNote", () => {expect(backupNote(main, engine("codex-sub1", "codex"))).toBe("Another sign-in to the main AI: used only while the main one is signed out, never at its usage limit (provider terms).");expect(backupNote(engine("claude", "claudeAgent"), engine("claude-2", "claudeAgent"))).toMatch(/^Another sign-in/);+ // A key the CLI stored itself is not pay-per-use to the server's limit rule, so the note still applies.+ expect(backupNote(main, engine("codex-stored-key", "codex", { snapshot: { state: "available", account: { method: "api-key" } } }))).toMatch(/^Another sign-in/);});it("keeps the same-account note and says nothing for other AIs or pay-per-use keys", () => {expect(backupNote(main, main)).toBe("Same account as the main AI: it shares the usage limit.");expect(backupNote(main, engine("claude", "claudeAgent"))).toBeUndefined();expect(backupNote(main, engine("codex-key", "codex", { access: "api" }))).toBeUndefined();- expect(backupNote(main, engine("codex-env", "codex", { snapshot: { state: "available", account: { method: "api-key" } } }))).toBeUndefined();expect(backupNote(engine("ollama", "openaiChat"), engine("ollama-2", "openaiChat"))).toBeUndefined();expect(backupNote(undefined, engine("codex-sub1", "codex"))).toBeUndefined();});diff --git a/src/lib/engine-rail.ts b/src/lib/engine-rail.tsindex 529306f607..f22381b78f 100644--- a/src/lib/engine-rail.ts+++ b/src/lib/engine-rail.ts@@ -60,7 +60,8 @@ export function splitEngineRail<T>(instances: readonly T[]): {export function backupNote(main: InstanceInfo | undefined, backup: InstanceInfo): string | undefined {if (!main) return undefined;if (backup.instanceId === main.instanceId) return t("botPanel.backups.sameAccount");- const billsEachUse = backup.access === "api" || backup.snapshot.account?.method === "api-key";- if (otherSignInOfSameSubscription(main, backup) && !billsEachUse) return t("botPanel.backups.otherSignIn");+ // Same rule as the server's billsEachUse: only an API-access engine counts as pay-per-use here. A key the CLI stored+ // itself (account method "api-key") does not, so the server still keeps it from taking over at the usage limit.+ if (otherSignInOfSameSubscription(main, backup) && backup.access !== "api") return t("botPanel.backups.otherSignIn");return undefined;}