Skip to content

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

feat(models): updatable model manifest so a new model lands by editing one JSON file

milind-soni5f245f96de22
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 429a37ecbf..518ff28f4c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -100,6 +100,11 @@ jobs:
run: pnpm exec vitest run scripts/ci-scope.test.ts scripts/ci-linux-lanes.test.ts scripts/ci-workflow.test.ts scripts/testing/verification-docs.test.ts
- name: Validate locale catalogs
run: pnpm i18n:check
+ - name: Validate the model manifest
+ # Installs download this file from main within hours of a change, so a bad edit must not land.
+ env:
+ MANIFEST_BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
+ run: node scripts/check-model-manifest.mjs --against "$MANIFEST_BASE"
- run: pnpm check:contrast
- run: pnpm lint
- name: Source guards
diff --git a/NOTICE b/NOTICE
index de5f68a72b..28bd4af58a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -17,6 +17,10 @@ public-only SOCKS5 proxy for HTML previews and the Linux listener-ownership
scan of its preview port scanner, Copyright 2026 T3 Tools Inc., used under the
MIT License (third_party/t3-code/LICENSE).
+The updatable model manifest (server/model-manifest/) adapts the model manifest
+cache and schema of an MIT-licensed project, Copyright 2026 T3 Tools Inc., used
+under the MIT License (third_party/t3-code/LICENSE).
+
Prompt-cache keep-warm (server/cache-keepwarm.ts and
server/drivers/claude-keepwarm.ts) ports the design of Cache Tax,
https://github.com/karanb192/claude-code-mods, Copyright (c) 2026 Karan
diff --git a/docs/ci.md b/docs/ci.md
index 2aad3622b7..5787960d58 100644
--- a/docs/ci.md
+++ b/docs/ci.md
@@ -24,6 +24,9 @@ too) into areas, and runs only the jobs some area can affect:
| control plane | `cloudflare/control-plane/` | the control-plane job |
| everything | anything else: `.github/` workflows, `package.json`, the lockfile and workspace, tsconfig, vite and vitest config, `third_party/`, `scripts/` code, unknown paths | every job |
+`static` also validates `server/model-manifest/model-manifest.json` with `scripts/check-model-manifest.mjs`: installs
+download that file from main within hours of a change, so it is checked on every event and fails on any invalid edit.
+
The build is the `build` job: typecheck, Electron syntax check and UI build,
about three minutes, beside the shards rather than ahead of them. Several areas
run the union of their jobs. Why the mapping is what it is:
diff --git a/scripts/check-model-manifest.mjs b/scripts/check-model-manifest.mjs
new file mode 100644
index 0000000000..8bc88c85f1
--- /dev/null
+++ b/scripts/check-model-manifest.mjs
@@ -0,0 +1,66 @@
+// CI check for the model manifest. A bad edit on main reaches every install within hours, so the file is held to the
+// strict schema here, and `--against <rev>` refuses an edit that does not move `updatedAt` forward.
+//
+// node scripts/check-model-manifest.mjs [--against <rev>]
+import { execFileSync } from "node:child_process";
+import { readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { parseArgs } from "node:util";
+
+import { MANIFEST_ENGINES, parseModelManifest } from "../server/model-manifest/schema.ts";
+
+const root = join(dirname(fileURLToPath(import.meta.url)), "..");
+export const MANIFEST_RELATIVE_PATH = "server/model-manifest/model-manifest.json";
+export const MANIFEST_PATH = join(root, MANIFEST_RELATIVE_PATH);
+/** Well under what an install accepts (server/model-manifest/manifest.ts), so a growing file fails here first. */
+const MAX_BYTES = 128 * 1024;
+
+/** Problems with the manifest's text, or an empty list when it is sound. */
+export function manifestProblems(text, { previous = null, now = Date.now() } = {}) {
+ if (Buffer.byteLength(text) > MAX_BYTES) return [`the manifest is larger than ${MAX_BYTES} bytes`];
+ let doc;
+ try {
+ doc = JSON.parse(text);
+ } catch {
+ return ["the manifest is not valid JSON"];
+ }
+ const parsed = parseModelManifest(doc, { strict: true, nowMs: now });
+ if (!parsed.ok) return [parsed.error];
+ const problems = MANIFEST_ENGINES.filter((engine) => !doc.engines[engine]).map((engine) => `engines.${engine} is missing`);
+ if (!parsed.manifest.prices || Object.keys(parsed.manifest.prices).length === 0) problems.push("prices is empty");
+ if (previous !== null && text !== previous) {
+ let before;
+ try {
+ before = parseModelManifest(JSON.parse(previous), { nowMs: now });
+ } catch {
+ before = null;
+ }
+ if (before?.ok && Date.parse(parsed.manifest.updatedAt) <= Date.parse(before.manifest.updatedAt)) {
+ problems.push("the file changed but updatedAt did not move forward; installs compare it to pick the newest copy");
+ }
+ }
+ return problems;
+}
+
+function main() {
+ const { values } = parseArgs({ options: { against: { type: "string" } } });
+ const text = readFileSync(MANIFEST_PATH, "utf8");
+ let previous = null;
+ if (values.against) {
+ try {
+ previous = execFileSync("git", ["show", `${values.against}:${MANIFEST_RELATIVE_PATH}`], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
+ } catch {
+ console.log("model manifest: no earlier copy to compare with");
+ }
+ }
+ const problems = manifestProblems(text, { previous });
+ if (problems.length) {
+ for (const problem of problems) console.error(`model manifest: ${problem}`);
+ process.exitCode = 1;
+ return;
+ }
+ console.log("model manifest: valid");
+}
+
+if (process.argv[1] === fileURLToPath(import.meta.url)) main();
diff --git a/scripts/check-model-manifest.test.mjs b/scripts/check-model-manifest.test.mjs
new file mode 100644
index 0000000000..5e5cd900ad
--- /dev/null
+++ b/scripts/check-model-manifest.test.mjs
@@ -0,0 +1,92 @@
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+
+import { MANIFEST_PATH, manifestProblems } from "./check-model-manifest.mjs";
+
+const committed = readFileSync(MANIFEST_PATH, "utf8");
+const doc = () => JSON.parse(committed);
+const problems = (value) => manifestProblems(JSON.stringify(value, null, 2));
+
+describe("the committed model manifest", () => {
+ it("passes the strict check and keeps the required models", () => {
+ expect(manifestProblems(committed)).toEqual([]);
+ const fable = doc().engines.claude.models.find((model) => model.id === "claude-fable-5-2");
+ expect(fable).toMatchObject({ contextWindow: 1_000_000, minCliVersion: "2.1.321" });
+ expect(doc().engines.claude.default).toBe("claude-sonnet-5");
+ expect(doc().prices["claude-fable-5-2"]).toMatchObject({ inputPerMillion: 8, cachedInputPerMillion: 0.2, outputPerMillion: 40 });
+ });
+});
+
+describe("what the CI check refuses", () => {
+ const withModel = (patch) => {
+ const manifest = doc();
+ manifest.engines.claude.models.push({ id: "synthetic-model", name: "Synthetic", status: "current", ...patch });
+ return manifest;
+ };
+
+ it("malformed JSON", () => {
+ expect(manifestProblems("{ not json")).toEqual(["the manifest is not valid JSON"]);
+ });
+
+ it("a model id the engine would not accept", () => {
+ expect(problems(withModel({ id: "--dangerously-skip-permissions" }))[0]).toMatch(/models/);
+ expect(problems(withModel({ id: "model; rm -rf /" }))[0]).toMatch(/models/);
+ expect(problems(withModel({ id: "default" }))[0]).toMatch(/reserved/);
+ expect(problems(withModel({ id: "x".repeat(200) }))[0]).toMatch(/models/);
+ });
+
+ it("a missing required field, a bad status or a CLI floor that is not a version", () => {
+ const missing = doc();
+ delete missing.engines.claude.models[0].status;
+ expect(problems(missing)[0]).toMatch(/status/);
+ expect(problems(withModel({ status: "preview" }))[0]).toMatch(/status/);
+ expect(problems(withModel({ minCliVersion: "latest" }))[0]).toMatch(/minCliVersion/);
+ });
+
+ it("an unknown field, which the check treats as a typo", () => {
+ expect(problems(withModel({ contextWindw: 1 }))[0]).toMatch(/contextWindw/);
+ });
+
+ it("a default that is not a listed current model", () => {
+ const manifest = doc();
+ manifest.engines.claude.default = "not-listed-model";
+ expect(problems(manifest)[0]).toMatch(/default/);
+ });
+
+ it("a duplicate id or an alias that repeats one", () => {
+ const manifest = withModel({ id: "claude-sonnet-5" });
+ expect(problems(manifest)[0]).toMatch(/listed twice/);
+ expect(problems(withModel({ aliases: ["claude-sonnet-5"] }))[0]).toMatch(/listed twice/);
+ });
+
+ it("a missing engine", () => {
+ const manifest = doc();
+ delete manifest.engines.grok;
+ expect(problems(manifest).length).toBeGreaterThan(0);
+ });
+
+ it("a future updatedAt, which would pin every install to it", () => {
+ const manifest = doc();
+ manifest.updatedAt = "2099-01-01T00:00:00Z";
+ expect(problems(manifest)[0]).toMatch(/future/);
+ });
+
+ it("a price that is not a number, negative or absurd", () => {
+ const manifest = doc();
+ manifest.prices["claude-sonnet-5"].inputPerMillion = "2";
+ expect(problems(manifest)[0]).toMatch(/inputPerMillion/);
+ manifest.prices["claude-sonnet-5"].inputPerMillion = -1;
+ expect(problems(manifest)[0]).toMatch(/inputPerMillion/);
+ manifest.prices["claude-sonnet-5"].inputPerMillion = 2_000_000;
+ expect(problems(manifest)[0]).toMatch(/inputPerMillion/);
+ });
+
+ it("an edit whose updatedAt did not move forward", () => {
+ const edited = doc();
+ edited.engines.claude.models[1].name = "Edited name";
+ expect(manifestProblems(JSON.stringify(edited), { previous: committed })[0]).toMatch(/updatedAt/);
+ const bumped = { ...edited, updatedAt: new Date(Date.parse(doc().updatedAt) + 1000).toISOString() };
+ expect(manifestProblems(JSON.stringify(bumped), { previous: committed })).toEqual([]);
+ expect(manifestProblems(committed, { previous: committed })).toEqual([]);
+ });
+});
diff --git a/scripts/ci-workflow.test.ts b/scripts/ci-workflow.test.ts
index ac0bbf5f86..9e11e5c616 100644
--- a/scripts/ci-workflow.test.ts
+++ b/scripts/ci-workflow.test.ts
@@ -49,6 +49,12 @@ describe("CI concurrency", () => {
);
});
+ it("validates the model manifest before anything lands on main", () => {
+ const step = workflow.jobs.static.steps.find((candidate: { name?: string }) => candidate.name === "Validate the model manifest");
+ expect(step.run).toContain("scripts/check-model-manifest.mjs");
+ expect(workflow.on.pull_request).toBeDefined();
+ });
+
it("runs the full lane every night", () => {
expect(workflow.on.schedule).toEqual([{ cron: expect.stringMatching(/^\d+ \d+ \* \* \*$/) }]);
});
diff --git a/server/agent-endpoint-models.ts b/server/agent-endpoint-models.ts
index 2924b88c6a..75c3712d75 100644
--- a/server/agent-endpoint-models.ts
+++ b/server/agent-endpoint-models.ts
@@ -1,6 +1,7 @@
import type { InstanceConfig } from "./contracts.ts";
-import { CLAUDE_MODEL_ID, STATIC_CLAUDE_MODELS } from "./drivers/claude-model-extras.ts";
+import { CLAUDE_MODEL_ID } from "./drivers/claude-model-extras.ts";
import { STATIC_CODEX_MODELS } from "./drivers/codex-catalog.ts";
+import { currentEngineCatalog } from "./model-manifest/manifest.ts";
import { isLoopback, providerModelsUrl } from "./provider-key-check.ts";
const OFFICIAL_URL = { codex: "https://api.openai.com/v1", claude: "https://api.anthropic.com" } as const;
@@ -26,7 +27,7 @@ export function hasExplicitModel(entry: InstanceConfig): boolean {
}
export function officialModels(codex: boolean): string[] {
- const catalog = codex ? STATIC_CODEX_MODELS : STATIC_CLAUDE_MODELS;
+ const catalog = codex ? STATIC_CODEX_MODELS : currentEngineCatalog("claude");
return [...new Set([catalog.default, ...catalog.options.map(option => option.id)])];
}
diff --git a/server/contracts.ts b/server/contracts.ts
index 82756bd679..7180b6d36b 100644
--- a/server/contracts.ts
+++ b/server/contracts.ts
@@ -482,6 +482,8 @@ export interface ModelCatalog {
variants?: ModelVariantOption[];
/** The organization of the signed-in account turned this model off: the engine would answer with another. */
orgBlocked?: true;
+ /** The installed CLI is too old for this model: the version it needs. */
+ needsCliUpdate?: string;
}>;
}
diff --git a/server/drivers/acp/cursor.ts b/server/drivers/acp/cursor.ts
index e8e946a34f..c535901bf9 100644
--- a/server/drivers/acp/cursor.ts
+++ b/server/drivers/acp/cursor.ts
@@ -8,6 +8,9 @@ import { createAcpDriver, type AcpSupport } from "./core.ts";
import { CURSOR_STANDALONE } from "./cursor-release.ts";
import type { DeviceSignIn, DeviceSignInState } from "../device-auth.ts";
import { discoverAcpModels } from "./custom-model-catalog.ts";
+import { bundledEngineCatalog } from "../../model-manifest/bundled.ts";
+import { currentEngineCatalog } from "../../model-manifest/manifest.ts";
+import { ENGINE_MODEL_ID } from "../../model-manifest/schema.ts";
import type { AcpQuestionRequest } from "./question-requests.ts";
import {
capAnswerEcho, formatQuestionAnswers, MAX_QUESTIONS, parseChoices, parseProtocolAskQuestions, pickedOptionLabels, questionAnswersById,
@@ -91,22 +94,14 @@ export function matchCursorAcpModel(
return null;
}
-export const STATIC_CURSOR_MODELS: ModelCatalog = {
- default: "auto",
- options: [
- { id: "auto", label: "Auto" },
- { id: "composer-2.5", label: "Composer 2.5" },
- { id: "composer-2.5-fast", label: "Composer 2.5 Fast" },
- { id: "gpt-5.3-codex", label: "Codex 5.3" },
- { id: "claude-sonnet-5-thinking-high", label: "Claude Sonnet 5 1M Thinking" },
- ],
-};
+export const STATIC_CURSOR_MODELS: ModelCatalog = bundledEngineCatalog("cursor");
+const currentCursorModels = () => currentEngineCatalog("cursor");
/** Without parameterizedModelPicker Cursor (CLI 2026.10.19) offers only `composer-2.5[fast=true]`, so a
* `composer-2.5` bot bills as Fast; with it, Fast is a separate `fast` config option. */
const CURSOR_CLIENT_META = { parameterizedModelPicker: true };
-const SLUG = /^[a-z0-9][a-z0-9._:+-]*$/i;
+const SLUG = ENGINE_MODEL_ID.cursor;
const EXEC_TIMEOUT_MS = 8_000;
const nonBlank = (value: string | undefined): boolean => Boolean(value?.trim());
@@ -198,9 +193,9 @@ export function decodeCursorModelCatalog(payload: unknown): ModelCatalog | null
(typeof asRecord(payload)?.default === "string" && seen.has(asRecord(payload)!.default as string)
? (asRecord(payload)!.default as string)
: undefined) ??
- (seen.has(STATIC_CURSOR_MODELS.default) ? STATIC_CURSOR_MODELS.default : options[0]!.id);
+ (seen.has(currentCursorModels().default) ? currentCursorModels().default : options[0]!.id);
- return { default: defaultId, options: withUnseen(STATIC_CURSOR_MODELS.options, options) };
+ return { default: defaultId, options: withUnseen(currentCursorModels().options, options) };
}
function stripModelMarkers(label: string): { label: string; isDefault: boolean; isCurrent: boolean } {
@@ -242,8 +237,8 @@ export function decodeCursorModelText(text: string): ModelCatalog | null {
const defaultId =
(markedDefault && seen.has(markedDefault) ? markedDefault : undefined) ??
(markedCurrent && seen.has(markedCurrent) ? markedCurrent : undefined) ??
- (seen.has(STATIC_CURSOR_MODELS.default) ? STATIC_CURSOR_MODELS.default : options[0]!.id);
- return { default: defaultId, options: withUnseen(STATIC_CURSOR_MODELS.options, options) };
+ (seen.has(currentCursorModels().default) ? currentCursorModels().default : options[0]!.id);
+ return { default: defaultId, options: withUnseen(currentCursorModels().options, options) };
}
function truthyAuthFlag(value: unknown): boolean | null {
@@ -352,13 +347,13 @@ export function cursorCatalogFromSession(advertised: ModelCatalog["options"]): M
const bases = new Set<string>();
for (const model of advertised) {
const raw = model.id.split("[")[0]!.trim();
- const id = raw.toLowerCase() === "default" ? STATIC_CURSOR_MODELS.default : raw;
+ const id = raw.toLowerCase() === "default" ? currentCursorModels().default : raw;
pushModel(discovered, bases, id, model.label.trim().toLowerCase() === id.toLowerCase() ? titleCaseModelId(id, /[-_]+/) : model.label);
}
if (!discovered.length) return null;
- const offered = STATIC_CURSOR_MODELS.options
- .filter((option) => option.id === STATIC_CURSOR_MODELS.default || bases.has(option.id.replace(/-fast$/, "")));
- return { default: STATIC_CURSOR_MODELS.default, options: withUnseen(offered, discovered) };
+ const offered = currentCursorModels().options
+ .filter((option) => option.id === currentCursorModels().default || bases.has(option.id.replace(/-fast$/, "")));
+ return { default: currentCursorModels().default, options: withUnseen(offered, discovered) };
}
/** `cursor-agent models` (2026.10.22) lists only `auto` while session/new lists every model the account can use, so the
@@ -380,7 +375,7 @@ export async function fetchCursorModels(
const fromJson = decodeCursorModelCatalog(firstJsonValue(stdout));
if (fromJson) return fromJson;
}
- return STATIC_CURSOR_MODELS;
+ return currentCursorModels();
}
export function classifyCursorError(error: unknown): ProviderErrorCode | undefined {
@@ -475,7 +470,7 @@ const support = (run: typeof execCli): AcpSupport => ({
questionRequests: { "cursor/ask_question": CURSOR_ASK_QUESTION }, askTool: "AskQuestion",
displayName: "Cursor",
cliVersion: CURSOR_CLI_VERSION,
- models: STATIC_CURSOR_MODELS,
+ get models() { return currentCursorModels(); },
// Other coding agents can install a generic `agent` shim; `cursor-agent` is unambiguous.
defaultCli: "cursor-agent",
nativeSource: "cursor.acp",
diff --git a/server/drivers/acp/grok.ts b/server/drivers/acp/grok.ts
index e28de4ff89..1efda9b6e4 100644
--- a/server/drivers/acp/grok.ts
+++ b/server/drivers/acp/grok.ts
@@ -10,21 +10,17 @@ import { harnessHome, splitCliString } from "../../env-path.ts";
import type { DeviceSignIn, DeviceSignInState } from "../device-auth.ts";
import { decodeInjectId, hostApiKey, localHost, mergeLocalInject } from "../local-inject.ts";
import { createAcpDriver, type AcpSupport } from "./core.ts";
+import { bundledEngineCatalog } from "../../model-manifest/bundled.ts";
+import { currentEngineCatalog } from "../../model-manifest/manifest.ts";
+import { ENGINE_MODEL_ID } from "../../model-manifest/schema.ts";
import type { AcpQuestionRequest } from "./question-requests.ts";
import { allowsTool, canUseMcpServer, narrowsNativeTools, parseToolScope } from "../../../shared/tool-scope.ts";
import { OWN_APPS_SERVER } from "../../../shared/own-apps.ts";
import { MAX_QUESTIONS, parseProtocolAskQuestions, pickedOptionLabels, questionAnswersById, repeatsQuestionText } from "../../../shared/ask-question.ts";
-export const STATIC_GROK_MODELS: ModelCatalog = {
- default: "grok-4.7",
- options: [
- { id: "grok-4.7", label: "Grok 4.7", contextWindow: 500_000 },
- { id: "grok-4.6", label: "Grok 4.6" },
- { id: "grok-4.5", label: "Grok 4.5" },
- ],
-};
+export const STATIC_GROK_MODELS: ModelCatalog = bundledEngineCatalog("grok");
-const SLUG = /^[a-z0-9][a-z0-9._-]*$/i;
+const SLUG = ENGINE_MODEL_ID.grok;
/** `$GROK_HOME`, else `~/.grok`: Grok's sign-in, config and catalog. */
export function grokHome(env: Record<string, string | undefined> = process.env): string {
@@ -84,15 +80,16 @@ function unquote(raw: string): string {
/** Local slugs from ~/.grok/config.toml, which `grok -m <slug>` accepts, plus the cloud defaults. */
export function readGrokModelCatalog(env: Record<string, string | undefined> = process.env): ModelCatalog {
+ const fixed = currentEngineCatalog("grok");
const path = join(grokHome(env), "config.toml");
let text = "";
try {
text = readFileSync(path, "utf8");
} catch {
- return STATIC_GROK_MODELS;
+ return fixed;
}
- const options = STATIC_GROK_MODELS.options.map((o) => ({ ...o }));
+ const options = fixed.options.map((o) => ({ ...o }));
const seen = new Set(options.map((o) => o.id));
let configuredDefault: string | null = null;
let current: { slug: string; name?: string } | null = null;
@@ -138,7 +135,7 @@ export function readGrokModelCatalog(env: Record<string, string | undefined> = p
flush();
return {
- default: configuredDefault && seen.has(configuredDefault) ? configuredDefault : STATIC_GROK_MODELS.default,
+ default: configuredDefault && seen.has(configuredDefault) ? configuredDefault : fixed.default,
options,
};
}
@@ -177,7 +174,7 @@ export function ensureGrokInjectSlug(
text = "";
}
- const taken = new Set<string>(STATIC_GROK_MODELS.options.map((option) => option.id));
+ const taken = new Set<string>(currentEngineCatalog("grok").options.map((option) => option.id));
let current: { slug: string; model?: string; baseUrl?: string } | null = null;
const flush = () => {
if (!current) return;
@@ -388,7 +385,7 @@ const support: AcpSupport = {
displayName: "Grok",
images: true,
acceptsUnadvertisedImages: grokAcceptsUnadvertisedImages,
- models: STATIC_GROK_MODELS,
+ get models() { return currentEngineCatalog("grok"); },
resolveModels: (env) => mergeLocalInject(readGrokModelCatalog(env), env),
// Grok's levels vary by model and the CLI validates lazily (a rejected level only logs); grok-4.5 rejects xhigh.
effortLevels: ["low", "medium", "high"],
diff --git a/server/drivers/acp/kimi.ts b/server/drivers/acp/kimi.ts
index a8d06be21a..84ea06f50c 100644
--- a/server/drivers/acp/kimi.ts
+++ b/server/drivers/acp/kimi.ts
@@ -8,18 +8,10 @@ import type { ModelCatalog } from "../../contracts.ts";
import type { DeviceSignIn, DeviceSignInState } from "../device-auth.ts";
import { decodeInjectId, hostApiKey, LOCAL_HOSTS, localHost, mergeLocalInject } from "../local-inject.ts";
import { createAcpDriver, type AcpSupport } from "./core.ts";
+import { currentEngineCatalog } from "../../model-manifest/manifest.ts";
+import { ENGINE_MODEL_ID } from "../../model-manifest/schema.ts";
-const STATIC_KIMI_MODELS: ModelCatalog = {
- default: "kimi-code/k3",
- options: [
- { id: "kimi-code/k3", label: "Kimi K3" },
- { id: "kimi-code/k3-256k", label: "Kimi K3 256K" },
- { id: "kimi-code/kimi-for-coding", label: "Kimi for Coding" },
- { id: "kimi-code/kimi-for-coding-highspeed", label: "Kimi for Coding Highspeed" },
- ],
-};
-
-const SLUG = /^[a-z0-9][a-z0-9._:/-]*$/i;
+const SLUG = ENGINE_MODEL_ID.kimi;
const LOCAL_PROVIDER_PREFIXES = LOCAL_HOSTS.map((host) => `${host.id}/`);
function isLocalInjectAlias(slug: string): boolean {
@@ -500,14 +492,15 @@ function stripKimiModelEnv(env: Record<string, string | undefined>): void {
}
function readKimiModelCatalog(env: Record<string, string | undefined>): ModelCatalog {
+ const fixed = currentEngineCatalog("kimi");
const dataRoot = kimiDataRoot(env);
let text = "";
try {
text = readFileSync(join(dataRoot, "config.toml"), "utf8");
} catch {
- return STATIC_KIMI_MODELS;
+ return fixed;
}
- const options = STATIC_KIMI_MODELS.options.map((o) => ({ ...o }));
+ const options = fixed.options.map((o) => ({ ...o }));
const seen = new Set(options.map((o) => o.id));
let current: { slug: string; name?: string } | null = null;
const flush = () => {
@@ -540,14 +533,14 @@ function readKimiModelCatalog(env: Record<string, string | undefined>): ModelCat
if (current && (key === "name" || key === "label") && value) current.name = value;
}
flush();
- return { default: STATIC_KIMI_MODELS.default, options };
+ return { default: fixed.default, options };
}
const support: AcpSupport = {
driverKind: "kimiAgent",
displayName: "Kimi",
// The CLI's own catalog aliases (~/.kimi-code/config.toml; `kimi provider list` reports the same four).
- models: STATIC_KIMI_MODELS,
+ get models() { return currentEngineCatalog("kimi"); },
resolveModels: (env) => mergeLocalInject(readKimiModelCatalog(env), env),
defaultCli: "kimi",
nativeSource: "kimi.acp",
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index dbdade7d2f..5a51fde004 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -27,21 +27,10 @@ import {
import { resolveAntigravityReleaseAsset } from "./antigravity-release.ts";
import { VERIFICATION_TEMP_KEY, scheduleAntigravityTempSweep } from "./antigravity-temp.ts";
import { augmentedPath } from "../env-path.ts";
+import { bundledEngineCatalog } from "../model-manifest/bundled.ts";
+import { currentEngineCatalog } from "../model-manifest/manifest.ts";
-export const STATIC_ANTIGRAVITY_MODELS: ModelCatalog = {
- default: "gemini-3.8-flash",
- options: [
- {
- id: "gemini-3.8-flash",
- label: "Gemini 3.8 Flash",
- variants: [
- { id: "low", label: "Low" },
- { id: "medium", label: "Medium" },
- { id: "high", label: "High" },
- ],
- },
- ],
-};
+export const STATIC_ANTIGRAVITY_MODELS: ModelCatalog = bundledEngineCatalog("antigravity");
/** Bots saved before the thinking-level option hold ids like `gemini-3.8-flash-medium` or `gemini-4-argon-high`;
* the official runtime offers only the base model with that option, so run the base at the saved level. A runtime
@@ -66,7 +55,7 @@ const support: AcpSupport = {
driverKind: "antigravityAgent",
// Named for what people look for: Google moved personal Gemini subscriptions (free, AI Pro, AI Ultra) from Gemini CLI to Antigravity on 2026-06-18.
displayName: "Google Gemini (Antigravity)",
- models: STATIC_ANTIGRAVITY_MODELS,
+ get models() { return currentEngineCatalog("antigravity"); },
defaultCli: "agy", // migration alias: resolveAntigravityRuntime treats it as managed
nativeSource: "antigravity.acp",
loginNote: "Antigravity needs a Google account — choose Sign in with Google in engine setup",
@@ -107,7 +96,7 @@ const support: AcpSupport = {
return probeAntigravityModels({
runtime,
profile,
- fallbackDefault: STATIC_ANTIGRAVITY_MODELS.default,
+ fallbackDefault: currentEngineCatalog("antigravity").default,
});
},
diff --git a/server/drivers/claude-catalog.test.ts b/server/drivers/claude-catalog.test.ts
index 64f873f0e5..69fef13f95 100644
--- a/server/drivers/claude-catalog.test.ts
+++ b/server/drivers/claude-catalog.test.ts
@@ -16,10 +16,11 @@ afterEach(() => {
describe("readClaudeModelCatalog", () => {
it("returns the official models when settings are missing", () => {
expect(readClaudeModelCatalog({ HOME: join(tmpdir(), "omb-claude-missing-home") })).toEqual(STATIC_CLAUDE_MODELS);
- expect(STATIC_CLAUDE_MODELS.options.slice(0, 2)).toEqual([
+ expect(STATIC_CLAUDE_MODELS.options).toEqual(expect.arrayContaining([
+ { id: "claude-fable-5-2", label: "Claude Fable 5.2", contextWindow: 1_000_000 },
{ id: "claude-fable-5-1", label: "Claude Fable 5.1" },
{ id: "claude-fable-5", label: "Claude Fable 5" },
- ]);
+ ]));
const ids = STATIC_CLAUDE_MODELS.options.map((option) => option.id);
expect(STATIC_CLAUDE_MODELS.options[ids.indexOf("claude-opus-5-5")]).toEqual({
id: "claude-opus-5-5",
@@ -197,6 +198,31 @@ describe("ClaudeDriver catalog", () => {
}
});
+ it.skipIf(process.platform === "win32")("marks a model the installed CLI is too old for, and only then", async () => {
+ const fable = "claude-fable-5-2";
+ for (const [installed, marked] of [["2.1.320", true], ["2.1.321", false]] as const) {
+ const home = mkdtempSync(join(tmpdir(), "omb-claude-cli-"));
+ scratchDirs.push(home);
+ const cli = join(home, "fake-claude");
+ writeFileSync(cli, `#!/bin/sh\necho "${installed} (Claude Code)"\n`, { mode: 0o755 });
+ const instance = await ClaudeDriver.create({
+ instanceId: `claude-gate-${installed}`,
+ displayName: "Claude",
+ environment: { HOME: home },
+ enabled: true,
+ config: { ...ClaudeDriver.defaultConfig(), cli },
+ });
+ try {
+ await instance.snapshot();
+ const option = instance.models.options.find((candidate) => candidate.id === fable);
+ expect(option?.needsCliUpdate).toBe(marked ? "2.1.321" : undefined);
+ expect(instance.models.default).toBe("claude-sonnet-5");
+ } finally {
+ await instance.dispose();
+ }
+ }
+ });
+
it("loads extras when the instance is created", async () => {
const home = mkdtempSync(join(tmpdir(), "omb-claude-instance-"));
scratchDirs.push(home);
diff --git a/server/drivers/claude-model-access.ts b/server/drivers/claude-model-access.ts
index d75dd5d8d9..3b1a3d2bff 100644
--- a/server/drivers/claude-model-access.ts
+++ b/server/drivers/claude-model-access.ts
@@ -53,8 +53,8 @@ export function claudeAccountFiles(env: Record<string, string | undefined>): str
export function withOrgBlocks(catalog: ModelCatalog, blocked: ReadonlySet<string>): ModelCatalog {
const options: ModelCatalog["options"] = catalog.options.map(({ orgBlocked: _stale, ...option }) =>
!option.custom && blocked.has(claudeModelKey(option.id)) ? { ...option, orgBlocked: true as const } : option);
- const usable = (id: string) => options.some((option) => option.id === id && !option.orgBlocked);
- const fallback = options.find((option) => !option.orgBlocked && !option.custom)?.id;
+ const usable = (id: string) => options.some((option) => option.id === id && !option.orgBlocked && !option.needsCliUpdate);
+ const fallback = options.find((option) => !option.orgBlocked && !option.needsCliUpdate && !option.custom)?.id;
return { ...catalog, default: usable(catalog.default) ? catalog.default : fallback ?? catalog.default, options };
}
diff --git a/server/drivers/claude-model-extras.ts b/server/drivers/claude-model-extras.ts
index 90dedb48e4..7977bbf977 100644
--- a/server/drivers/claude-model-extras.ts
+++ b/server/drivers/claude-model-extras.ts
@@ -1,7 +1,9 @@
import type { ModelCatalog } from "../contracts.ts";
+import { bundledEngineCatalog } from "../model-manifest/bundled.ts";
+import { CLAUDE_MODEL_ID } from "../model-manifest/schema.ts";
-// Claude Code's `[1m]` suffix selects a model's 1M-token context.
-export const CLAUDE_MODEL_ID = /^[a-z0-9][a-z0-9._:/-]*(?:\[1m\])?$/i;
+export { CLAUDE_MODEL_ID };
+export { currentEngineCatalog, withCliVersionGate } from "../model-manifest/manifest.ts";
const OFFICIAL_CLAUDE_ID = /^claude-[a-z0-9.-]+$/;
const official = (id: string) => OFFICIAL_CLAUDE_ID.test(id.replace(/\[1m\]$/i, ""));
@@ -53,19 +55,8 @@ export function claudeModelExtras(settings: Record<string, unknown>, env: Record
return { extras, envModel };
}
-export const STATIC_CLAUDE_MODELS: ModelCatalog = {
- default: "claude-sonnet-5",
- options: [
- { id: "claude-fable-5-1", label: "Claude Fable 5.1" },
- { id: "claude-fable-5", label: "Claude Fable 5" },
- { id: "claude-opus-5-5", label: "Claude Opus 5.5", contextWindow: 1_000_000 },
- { id: "claude-opus-5", label: "Claude Opus 5" },
- { id: "claude-sonnet-5-5", label: "Claude Sonnet 5.5", contextWindow: 1_000_000 },
- { id: "claude-sonnet-5", label: "Claude Sonnet 5" },
- { id: "claude-haiku-5-5", label: "Claude Haiku 5.5", contextWindow: 1_000_000 },
- { id: "claude-haiku-4-5", label: "Claude Haiku 4.5" },
- ],
-};
+/** The bundled list, before any download: the picker reads `currentEngineCatalog("claude")`, which starts from this. */
+export const STATIC_CLAUDE_MODELS: ModelCatalog = bundledEngineCatalog("claude");
/** An endpoint serves only its own models, each flagged `custom` so a `custom` instance's picker lists it. */
export function endpointModelCatalog(models: string[] | undefined): ModelCatalog | null {
diff --git a/server/drivers/claude.ts b/server/drivers/claude.ts
index 84637b794c..880ed18546 100644
--- a/server/drivers/claude.ts
+++ b/server/drivers/claude.ts
@@ -17,7 +17,7 @@ import { projectMcpServers } from "./claude-project-mcp.ts";
import { botSettingsFor, withBotSettings } from "./claude-bot-settings.ts";
import { claudeBilling, claudeCallUsage } from "./claude-billing.ts";
import { claudeAuthFailure, claudeAuthRecovery } from "./claude-auth-recovery.ts";
-import { CLAUDE_MODEL_ID, STATIC_CLAUDE_MODELS, claudeModelExtras, endpointModelCatalog } from "./claude-model-extras.ts";
+import { CLAUDE_MODEL_ID, STATIC_CLAUDE_MODELS, claudeModelExtras, currentEngineCatalog, endpointModelCatalog, withCliVersionGate } from "./claude-model-extras.ts";
import { claudeToolSearchSetting } from "./claude-tool-search.ts"; import { unusableBuiltIns } from "./claude-unusable-tools.ts"; import { EMAIL_READ_TOOL_NAMES } from "../../shared/email.ts";
import { claudeElicitations } from "./claude-elicitation.ts";
import { readCostHistory, recordCostState } from "./claude-cost-history.ts";
@@ -285,7 +285,7 @@ async function resolveClaudeTurnModel(
endpointModels?: string[],
): Promise<string | null | undefined> {
if (endpointModels) return model && endpointModels.includes(model) ? model : endpointModels[0];
- if (!model || decodeInjectId(model) || STATIC_CLAUDE_MODELS.options.some((option) => option.id === model)) {
+ if (!model || decodeInjectId(model) || currentEngineCatalog("claude").options.some((option) => option.id === model)) {
return model;
}
return resolveInjectId(model, await probeLocalInjects(env)) ?? model;
@@ -302,7 +302,7 @@ export function readClaudeModelCatalog(env: Record<string, string | undefined> =
}
const { extras, envModel } = claudeModelExtras(settings, env);
- const options = STATIC_CLAUDE_MODELS.options.map((option) => ({ ...option }));
+ const official = currentEngineCatalog("claude"), options = official.options.map((option) => ({ ...option }));
const seen = new Set(options.map((option) => option.id));
for (const extra of extras) {
if (seen.has(extra.id)) continue;
@@ -311,7 +311,7 @@ export function readClaudeModelCatalog(env: Record<string, string | undefined> =
? { id: extra.id, label: extra.label, custom: true }
: { id: extra.id, label: extra.label });
}
- return { default: STATIC_CLAUDE_MODELS.default, options };
+ return { default: official.default, options };
}
const PERM_PROXY_PATH = SPAWNED_PROXIES.permission;
@@ -780,14 +780,16 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
if (inheritsUserConfig(catalogEnv)) {
console.error(`claude (${instanceId}): OMB_CLAUDE_INHERIT_USER_CONFIG=1 — bots inherit this machine's Claude Code MCP servers, skills, hooks and CLAUDE.md on every turn; remove it unless a bot needs a user-scope server`);
}
+ let cliVersion: ClaudeCliVersion | null = null;
+ let cliVersionChecked = false;
let models = config.managedModels ? { default: config.managedModels[0], options: config.managedModels.map(id => ({ id, label: id })) }
- : endpointModelCatalog(config.endpointModels) ?? STATIC_CLAUDE_MODELS;
+ : endpointModelCatalog(config.endpointModels) ?? currentEngineCatalog("claude");
const orgBlocks = createOrgModelBlocks(() => engineHomes.everyHome(catalogEnv), (blocked) => { models = withOrgBlocks(models, blocked); });
const refreshModels = async () => {
if (config.managed || config.endpointModels) return;
try {
const resolved = await mergeLocalInject(readClaudeModelCatalog(catalogEnv), catalogEnv);
- if (resolved.options.length) models = resolved; else unconfirmedModelCatalog(models);
+ if (resolved.options.length) models = withCliVersionGate(resolved, "claude", cliVersion); else unconfirmedModelCatalog(models);
await orgBlocks.refresh(true);
} catch { unconfirmedModelCatalog(models); }
try { writeStartupModelCache(instanceId, models); } catch {}
@@ -799,8 +801,6 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
refresh: refreshModels,
}))?.pending ?? null;
- let cliVersion: ClaudeCliVersion | null = null;
- let cliVersionChecked = false;
// Whether `claude --help` lists --autocompact (2.1.129 rejects it despite the floor); a launch refusing it keeps it off for that version (every refusing version is remembered).
let [cliHasAutocompact, cliHelpVersion]: [boolean | null, string | null] = [null, null], autocompactRefusedBy = new Set<string>();
const readCliVersion = cliVersionProbe(config.cli);
@@ -1913,8 +1913,8 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
const probe = await readCliVersion(env);
if (!("version" in probe)) return { state: "unavailable", reason: probe.reason };
const { version } = probe;
- cliVersion = parseClaudeCliVersion(version);
- cliVersionChecked = true;
+ [cliVersion, cliVersionChecked] = [parseClaudeCliVersion(version), true];
+ if (!config.managed && !config.endpointModels) models = withCliVersionGate(models, "claude", cliVersion);
if (version !== cliHelpVersion) await readCliHelp(version, env);
const update = claudeCliUpdate(version, config.cli);
const warning = claudeInheritWarning(env);
diff --git a/server/harness/registry.ts b/server/harness/registry.ts
index eb7df83a77..c3eb83b9b5 100644
--- a/server/harness/registry.ts
+++ b/server/harness/registry.ts
@@ -9,6 +9,7 @@ import { withLocalContext } from "../drivers/local-inject.ts";
import { engineStatusFile, snapshotFrom } from "./engine-status-file.ts";
import { withUnaskedStops } from "./unasked-stop.ts";
import { withWslNotice } from "./wsl-launch.ts";
+import { modelManifest, startModelManifestRefresh } from "../model-manifest/manifest.ts";
export { engineMemory } from "../engine-memory.ts";
import { clientInstall } from "../contracts.ts";
import type {
@@ -103,6 +104,9 @@ export function enginesByUse(selections: ReadonlyArray<{ instanceId: InstanceId
type SharedRead = { generation: number; settledAt?: number; read: Promise<ProviderSnapshot> };
+/** Engines that rebuild their model list from the manifest without starting a CLI, so a downloaded change applies at once. */
+const MANIFEST_REBUILT_DRIVERS = new Set(["claudeAgent", "grokAgent", "kimiAgent"]);
+
export class ProviderRegistry {
private byId = new Map<InstanceId, RegistryEntry>();
private cliByInstance = new Map<InstanceId, string>();
@@ -112,6 +116,7 @@ export class ProviderRegistry {
/** Engines the start-up read has not probed yet; null outside that read. */
private unread: Set<InstanceId> | null = null;
private snapshotGeneration = 0;
+ private manifestWatched = false;
private readonly signedInListeners = new Set<(instanceId: InstanceId) => void>();
/** Per instance object: settings that reload an engine make a new one, so its status is read afresh. */
private readsOf = new WeakMap<ProviderInstance, { snapshot: ProviderSnapshot; at: number; generation: number }>();
@@ -132,7 +137,19 @@ export class ProviderRegistry {
this.driversByKind = new Map(drivers.map((d) => [d.driverKind, d]));
}
+ private watchModelManifest(): void {
+ if (this.manifestWatched) return;
+ this.manifestWatched = true;
+ modelManifest().onChange(() => {
+ for (const instance of this.instances()) {
+ if (MANIFEST_REBUILT_DRIVERS.has(instance.driverKind)) void this.refreshModels(instance.instanceId).catch(() => {});
+ }
+ });
+ startModelManifestRefresh();
+ }
+
async load(configs: InstanceConfigMap, decorate?: (instance: ProviderInstance) => ProviderInstance) {
+ this.watchModelManifest();
const slots = [...this.byId.keys()];
const loaded = await Promise.all(
Object.entries(configs).map(async ([instanceId, entry]) => {
diff --git a/server/index.ts b/server/index.ts
index deb4b22ca0..6afcc2f422 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -9199,7 +9199,7 @@ const chiefPeerTargetRule = (noun: string) => (proposerBotId: string, targetBotI
};
const validateModelProposal = (selection: ModelSelection, current?: BotRecord): string | null => {
const checked = checkedModelSelection(selection, undefined, true);
- if (!checked.ok) return checked.error; if (registry.get(selection.instanceId)?.models.options.some((option) => option.id === selection.model && option.orgBlocked)) return "This account's organization turned that model off. Propose another one.";
+ if (!checked.ok) return checked.error; const unusable = registry.get(selection.instanceId)?.models.options.find((option) => option.id === selection.model && (option.orgBlocked || option.needsCliUpdate)); if (unusable) return unusable.orgBlocked ? "This account's organization turned that model off. Propose another one." : `That model needs version ${unusable.needsCliUpdate} of its engine's CLI. Update it, or propose another model.`;
if (current?.approvalGrant) return "Wait for the approval-level confirmation before changing this bot's model";
if (current) {
const mode = approvalModeFor(current);
diff --git a/server/model-manifest/bundled.ts b/server/model-manifest/bundled.ts
new file mode 100644
index 0000000000..49afc1ce1b
--- /dev/null
+++ b/server/model-manifest/bundled.ts
@@ -0,0 +1,28 @@
+// The bundled manifest, importable before anything else in the server: the drivers build their fixed lists from it at load.
+import type { ModelCatalog } from "../contracts.ts";
+import bundledManifestJson from "./model-manifest.json" with { type: "json" };
+import { parseModelManifest, type ManifestEngine, type ModelManifestData } from "./schema.ts";
+
+const parsedBundle = parseModelManifest(bundledManifestJson, { strict: true, nowMs: Number.MAX_SAFE_INTEGER / 2 });
+if (!parsedBundle.ok) throw new Error(`The bundled model manifest is invalid (${parsedBundle.error})`);
+export const BUNDLED_MODEL_MANIFEST: ModelManifestData = parsedBundle.manifest;
+
+/** The manifest's engine as the picker wants it; legacy models stay valid in a saved bot but are not offered for new picks. */
+export function engineCatalogFrom(manifest: ModelManifestData, engine: ManifestEngine): ModelCatalog | null {
+ const section = manifest.engines[engine];
+ if (!section) return null;
+ return {
+ default: section.default,
+ options: section.models.filter((model) => model.status === "current").map((model) => ({
+ id: model.id,
+ label: model.name,
+ ...(model.contextWindow ? { contextWindow: model.contextWindow } : {}),
+ ...(model.variants?.length ? { variants: model.variants } : {}),
+ })),
+ };
+}
+
+export function bundledEngineCatalog(engine: ManifestEngine): ModelCatalog {
+ return engineCatalogFrom(BUNDLED_MODEL_MANIFEST, engine)!;
+}
+
diff --git a/server/model-manifest/manifest.test.ts b/server/model-manifest/manifest.test.ts
new file mode 100644
index 0000000000..7d61b45a87
--- /dev/null
+++ b/server/model-manifest/manifest.test.ts
@@ -0,0 +1,283 @@
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync, readFileSync, existsSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { BUNDLED_MODEL_MANIFEST, engineCatalogFrom } from "./bundled.ts";
+import {
+ MANIFEST_DISABLE_ENV,
+ MANIFEST_ON_DEMAND_TTL_MS,
+ MANIFEST_RETRY_MS,
+ MANIFEST_TTL_MS,
+ ModelManifestStore,
+ modelManifestCachePath,
+ withCliVersionGate,
+} from "./manifest.ts";
+import { CLAUDE_MODEL_ID, parseModelManifest, type ModelManifestData } from "./schema.ts";
+
+const NOW = Date.parse("2026-11-10T12:00:00Z");
+const scratchDirs: string[] = [];
+
+afterEach(() => {
+ for (const dir of scratchDirs.splice(0)) rmSync(dir, { recursive: true, force: true });
+ vi.restoreAllMocks();
+});
+
+function dataDir(): string {
+ const dir = mkdtempSync(join(tmpdir(), "omb-model-manifest-"));
+ scratchDirs.push(dir);
+ return dir;
+}
+
+function manifest(updatedAt: string, ids = ["synthetic-current"], extra: Partial<ModelManifestData> = {}): ModelManifestData {
+ return {
+ version: 1,
+ updatedAt,
+ engines: {
+ claude: { default: ids[0]!, models: ids.map((id) => ({ id, name: id, status: "current" as const })) },
+ },
+ ...extra,
+ };
+}
+
+const bundled = manifest("2026-11-01T00:00:00Z", ["bundled-model"]);
+
+function json(body: unknown, init: ResponseInit = { status: 200 }): Response {
+ return new Response(typeof body === "string" ? body : JSON.stringify(body), init);
+}
+
+function store(options: Partial<ConstructorParameters<typeof ModelManifestStore>[0]> & { fetch?: typeof fetch; dir?: string } = {}) {
+ const { dir = dataDir(), ...rest } = options;
+ const log = vi.fn();
+ let time = NOW;
+ return {
+ dir,
+ log,
+ advance: (ms: number) => { time += ms; },
+ manifest: new ModelManifestStore({ dataDir: dir, bundled, now: () => time, log, env: {}, ...rest }),
+ };
+}
+
+function writeCache(dir: string, data: unknown, fetchedAtMs = NOW - 1000): void {
+ const path = modelManifestCachePath(dir);
+ mkdirSync(dirname(path), { recursive: true });
+ writeFileSync(path, JSON.stringify({ fetchedAtMs, manifest: data }));
+}
+
+describe("reading the current list", () => {
+ it("starts from the bundled copy and never touches the network", () => {
+ const fetchMock = vi.fn();
+ const { manifest: subject } = store({ fetch: fetchMock });
+ expect(subject.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it("loads a newer disk cache", () => {
+ const dir = dataDir();
+ writeCache(dir, manifest("2026-11-05T00:00:00Z", ["cached-model"]));
+ expect(store({ dir }).manifest.current().engines.claude!.models[0]!.id).toBe("cached-model");
+ });
+
+ it("an older or corrupt disk cache never overrides the bundled copy", () => {
+ const dir = dataDir();
+ writeCache(dir, manifest("2026-10-01T00:00:00Z", ["old-cached-model"]));
+ expect(store({ dir }).manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ writeFileSync(modelManifestCachePath(dir), "{ corrupt");
+ expect(store({ dir }).manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ });
+});
+
+describe("downloads", () => {
+ it("keeps a newer download, caches it on disk and tells listeners once", async () => {
+ const fetchMock = vi.fn(async () => json(manifest("2026-11-09T00:00:00Z", ["remote-model"])));
+ const subject = store({ fetch: fetchMock as unknown as typeof fetch });
+ const changed = vi.fn();
+ subject.manifest.onChange(changed);
+ await subject.manifest.refresh();
+ expect(subject.manifest.current().engines.claude!.models[0]!.id).toBe("remote-model");
+ expect(changed).toHaveBeenCalledTimes(1);
+ const saved = JSON.parse(readFileSync(modelManifestCachePath(subject.dir), "utf8")) as { manifest: ModelManifestData };
+ expect(saved.manifest.updatedAt).toBe("2026-11-09T00:00:00Z");
+ });
+
+ it("rejects a stale download older than the current list", async () => {
+ const fetchMock = vi.fn(async () => json(manifest("2026-10-20T00:00:00Z", ["stale-model"])));
+ const subject = store({ fetch: fetchMock as unknown as typeof fetch });
+ await subject.manifest.refresh();
+ expect(subject.manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ expect(existsSync(modelManifestCachePath(subject.dir))).toBe(false);
+ expect(subject.log).toHaveBeenCalledWith(expect.stringMatching(/older/));
+ });
+
+ it("ignores a bad download and keeps the last good list", async () => {
+ const bodies: Array<() => Response> = [
+ () => json("{ not json"),
+ () => json({ ...manifest("2026-11-09T00:00:00Z"), version: 2 }),
+ () => json({ ...manifest("2026-11-09T00:00:00Z"), engines: { claude: { default: "a", models: [{ id: "a", name: "a", status: "bogus" }] } } }),
+ () => json("", { status: 500 }),
+ () => json(manifest("2099-01-01T00:00:00Z", ["future-model"])),
+ ];
+ for (const body of bodies) {
+ const subject = store({ fetch: vi.fn(async () => body()) as unknown as typeof fetch });
+ await subject.manifest.refresh({ force: true });
+ expect(subject.manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ expect(existsSync(modelManifestCachePath(subject.dir))).toBe(false);
+ }
+ });
+
+ it("refuses an oversized download, stated or streamed, even when its JSON is valid", async () => {
+ const body = JSON.stringify(manifest("2026-11-09T00:00:00Z", ["big-model"]));
+ const maxBytes = body.length - 1;
+ const stream = () => new ReadableStream({ start(controller) { controller.enqueue(new TextEncoder().encode(body)); controller.close(); } });
+ for (const { response, maxBytes: limit } of [
+ { response: new Response(body, { status: 200, headers: { "content-length": String(body.length + 2) } }), maxBytes: body.length + 1 },
+ { response: new Response(stream(), { status: 200 }), maxBytes },
+ ]) {
+ const subject = store({ fetch: vi.fn(async () => response) as unknown as typeof fetch, maxBytes: limit });
+ await subject.manifest.refresh({ force: true });
+ expect(subject.manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ }
+ const fits = store({ fetch: vi.fn(async () => new Response(stream(), { status: 200 })) as unknown as typeof fetch, maxBytes: body.length });
+ await fits.manifest.refresh({ force: true });
+ expect(fits.manifest.current().engines.claude!.models[0]!.id).toBe("big-model");
+ });
+
+ it("drops a model id that would not reach the CLI safely", async () => {
+ for (const id of ["--skip-permissions", "bad id", "`whoami`"]) {
+ const payload = manifest("2026-11-09T00:00:00Z", ["ok-model"]);
+ payload.engines.claude!.models.push({ id, name: "x", status: "current" });
+ const subject = store({ fetch: vi.fn(async () => json(payload)) as unknown as typeof fetch });
+ await subject.manifest.refresh({ force: true });
+ expect(subject.manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ }
+ expect(CLAUDE_MODEL_ID.test("--skip-permissions")).toBe(false);
+ });
+
+ it("offline: a failed fetch keeps the current list and backs off", async () => {
+ const fetchMock = vi.fn(async () => { throw new TypeError("fetch failed"); });
+ const subject = store({ fetch: fetchMock as unknown as typeof fetch });
+ await subject.manifest.refresh();
+ expect(subject.manifest.current().engines.claude!.models[0]!.id).toBe("bundled-model");
+ await subject.manifest.refresh();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ subject.advance(MANIFEST_RETRY_MS + 1);
+ await subject.manifest.refresh();
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ });
+
+ it("does nothing when fetching is switched off", async () => {
+ const fetchMock = vi.fn();
+ const subject = store({ fetch: fetchMock as unknown as typeof fetch, env: { [MANIFEST_DISABLE_ENV]: "1" } });
+ await subject.manifest.refresh({ force: true });
+ await subject.manifest.refreshOnDemand();
+ subject.manifest.refreshInBackground();
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it("waits an hour in the background and five minutes when the list is opened", async () => {
+ const fetchMock = vi.fn(async () => json(manifest("2026-11-09T00:00:00Z", ["remote-model"])));
+ const subject = store({ fetch: fetchMock as unknown as typeof fetch });
+ await subject.manifest.refresh();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ await subject.manifest.refresh();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ subject.advance(MANIFEST_ON_DEMAND_TTL_MS + 1);
+ await subject.manifest.refresh();
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ await subject.manifest.refreshOnDemand();
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ subject.advance(MANIFEST_TTL_MS + 1);
+ await subject.manifest.refresh();
+ expect(fetchMock).toHaveBeenCalledTimes(3);
+ });
+
+ it("shares one request between concurrent refreshes", async () => {
+ let answer!: (response: Response) => void;
+ const fetchMock = vi.fn(() => new Promise<Response>((resolve) => { answer = resolve; }));
+ const subject = store({ fetch: fetchMock as unknown as typeof fetch });
+ const first = subject.manifest.refresh({ force: true });
+ const second = subject.manifest.refreshOnDemand();
+ await Promise.resolve();
+ await Promise.resolve();
+ answer(json(manifest("2026-11-09T00:00:00Z", ["remote-model"])));
+ await Promise.all([first, second]);
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ });
+
+ it("uses the bundled copy for an engine a download left out", async () => {
+ const subject = store();
+ expect(engineCatalogFrom(subject.manifest.current(), "grok")).toBeNull();
+ });
+});
+
+describe("the CLI version gate", () => {
+ const payload = (): ModelManifestData => manifest("2026-11-09T00:00:00Z", ["base-model", "new-model"]);
+ const gated = () => {
+ const data = payload();
+ data.engines.claude!.models[1]!.minCliVersion = "2.1.321";
+ return store({ bundled: data }).manifest;
+ };
+ const catalog = () => ({ default: "base-model", options: [{ id: "base-model", label: "b" }, { id: "new-model", label: "n" }, { id: "local", label: "l", custom: true as const }] });
+
+ it("marks a model the installed CLI is too old for and leaves the rest", () => {
+ const options = withCliVersionGate(catalog(), "claude", [2, 1, 320], gated()).options;
+ expect(options.find((option) => option.id === "new-model")?.needsCliUpdate).toBe("2.1.321");
+ expect(options.find((option) => option.id === "base-model")?.needsCliUpdate).toBeUndefined();
+ expect(options.find((option) => option.id === "local")?.needsCliUpdate).toBeUndefined();
+ });
+
+ it("clears the mark once the CLI is new enough, and marks nothing for an unknown version", () => {
+ const store = gated();
+ const marked = withCliVersionGate(catalog(), "claude", [2, 1, 320], store);
+ expect(withCliVersionGate(marked, "claude", [2, 1, 321], store).options.find((option) => option.id === "new-model")?.needsCliUpdate).toBeUndefined();
+ expect(withCliVersionGate(marked, "claude", null, store).options.find((option) => option.id === "new-model")?.needsCliUpdate).toBeUndefined();
+ });
+
+ it("moves a gated default to the first usable model", () => {
+ const data = payload();
+ data.engines.claude!.models[1]!.minCliVersion = "9.0.0";
+ const subject = store({ bundled: data }).manifest;
+ expect(withCliVersionGate({ ...catalog(), default: "new-model" }, "claude", [2, 1, 320], subject).default).toBe("base-model");
+ });
+});
+
+describe("the picker list", () => {
+ it("offers only current models and keeps the default", () => {
+ const data = manifest("2026-11-01T00:00:00Z", ["keep-model", "retired-model"]);
+ data.engines.claude!.models[1]!.status = "legacy";
+ const catalog = engineCatalogFrom(data, "claude")!;
+ expect(catalog.options.map((option) => option.id)).toEqual(["keep-model"]);
+ expect(catalog.default).toBe("keep-model");
+ });
+
+ it("the bundled manifest is valid for every engine and keeps Fable 5.2 behind its CLI floor", () => {
+ expect(parseModelManifest(BUNDLED_MODEL_MANIFEST, { strict: true }).ok).toBe(true);
+ const fable = BUNDLED_MODEL_MANIFEST.engines.claude.models.find((model) => model.id === "claude-fable-5-2");
+ expect(fable?.minCliVersion).toBe("2.1.321");
+ expect(fable?.contextWindow).toBe(1_000_000);
+ });
+});
+
+describe("the schema", () => {
+ const fine = (extra: object = {}) => ({ ...manifest("2026-11-09T00:00:00Z"), ...extra });
+
+ it("tolerates a field added on main later, so older installs keep updating", () => {
+ const parsed = parseModelManifest({ ...fine(), somethingNew: true });
+ expect(parsed.ok).toBe(true);
+ if (parsed.ok) expect(parsed.manifest).not.toHaveProperty("somethingNew");
+ });
+
+ it("is strict when asked, so a typo fails the CI check", () => {
+ expect(parseModelManifest({ ...fine(), somethingNew: true }, { strict: true }).ok).toBe(false);
+ });
+
+ it("rejects a schema version it does not know", () => {
+ expect(parseModelManifest({ ...fine(), version: 2 }).ok).toBe(false);
+ });
+
+ it("rejects a default that is not a current listed model", () => {
+ const data = manifest("2026-11-09T00:00:00Z", ["only-model"]);
+ data.engines.claude!.default = "other-model";
+ expect(parseModelManifest(data).ok).toBe(false);
+ });
+});
diff --git a/server/model-manifest/manifest.ts b/server/model-manifest/manifest.ts
new file mode 100644
index 0000000000..9a462858b6
--- /dev/null
+++ b/server/model-manifest/manifest.ts
@@ -0,0 +1,271 @@
+// Adapted from apps/server/src/provider/ModelManifest.ts at commit e85e0094, MIT License, Copyright (c) 2026 T3 Tools Inc.
+// (full text in third_party/t3-code/LICENSE); modified: a plain class with async fetches in place of an Effect service,
+// and the picker's ModelCatalog in place of provider snapshots.
+import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
+import { dirname, join } from "node:path";
+
+import { writeFileAtomic } from "../atomic.ts";
+import { DATA_DIR } from "../config.ts";
+import type { ModelCatalog } from "../contracts.ts";
+import { parseVersionTriple, versionAtLeast, type VersionTriple } from "../drivers/acp/version-probe.ts";
+import { BUNDLED_MODEL_MANIFEST, bundledEngineCatalog, engineCatalogFrom } from "./bundled.ts";
+import { parseModelManifest, type ManifestEngine, type ManifestPrice, type ModelManifestData } from "./schema.ts";
+
+export const MODEL_MANIFEST_URL = "https://raw.githubusercontent.com/milind-soni/OpenMausBot/main/server/model-manifest/model-manifest.json";
+export const MANIFEST_DISABLE_ENV = "OMB_DISABLE_MODEL_MANIFEST_FETCH";
+export const MANIFEST_TTL_MS = 60 * 60 * 1000;
+/** GitHub's raw CDN caches about this long, so a shorter window buys nothing. */
+export const MANIFEST_ON_DEMAND_TTL_MS = 5 * 60 * 1000;
+/** Back off failed fetches so a computer that is offline does not try on every model-list open. */
+export const MANIFEST_RETRY_MS = 5 * 60 * 1000;
+export const MANIFEST_FETCH_TIMEOUT_MS = 10_000;
+export const MANIFEST_MAX_BYTES = 512 * 1024;
+
+/** Under providers/, so backups and Move to Cloud leave it out. */
+export function modelManifestCachePath(dataDir: string): string {
+ return join(dataDir, "providers", "model-manifest", "model-manifest.json");
+}
+
+export interface ModelManifestOptions {
+ dataDir: string;
+ env?: NodeJS.ProcessEnv;
+ fetch?: typeof fetch;
+ now?: () => number;
+ bundled?: ModelManifestData;
+ timeoutMs?: number;
+ maxBytes?: number;
+ log?: (message: string) => void;
+}
+
+function updatedAtMs(manifest: ModelManifestData): number {
+ return Date.parse(manifest.updatedAt);
+}
+
+export class ModelManifestStore {
+ private readonly options: ModelManifestOptions;
+ private readonly bundled: ModelManifestData;
+ private readonly cachePath: string;
+ private manifest: ModelManifestData;
+ private fetchedAtMs: number | null = null;
+ private lastAttemptMs: number | null = null;
+ private diskChecked = false;
+ private inflight: Promise<ModelManifestData> | undefined;
+ private readonly listeners = new Set<() => void>();
+
+ constructor(options: ModelManifestOptions) {
+ this.options = options;
+ this.bundled = options.bundled ?? BUNDLED_MODEL_MANIFEST;
+ this.manifest = this.bundled;
+ this.cachePath = modelManifestCachePath(options.dataDir);
+ }
+
+ private get now(): number {
+ return (this.options.now ?? Date.now)();
+ }
+
+ private log(text: string): void {
+ (this.options.log ?? ((line: string) => console.warn(line)))(`[model-manifest] ${text}`);
+ }
+
+ get fetchDisabled(): boolean {
+ return (this.options.env ?? process.env)[MANIFEST_DISABLE_ENV] === "1";
+ }
+
+ /** The newest usable manifest. Reads the disk cache once and never waits on the network. */
+ current(): ModelManifestData {
+ if (!this.diskChecked) this.loadDiskCache();
+ return this.manifest;
+ }
+
+ /** Called after a download replaces the current list with a different one. Returns its unsubscriber. */
+ onChange(listener: () => void): () => void {
+ this.listeners.add(listener);
+ return () => this.listeners.delete(listener);
+ }
+
+ /** Skipped inside `ttlMs` of the last good fetch and for a while after a failed one, unless `force`. Concurrent calls share one request. Never throws. */
+ refresh(options: { force?: boolean; ttlMs?: number } = {}): Promise<ModelManifestData> {
+ if (this.fetchDisabled) return Promise.resolve(this.current());
+ this.inflight ??= this.fetchAndStore(Boolean(options.force), options.ttlMs ?? MANIFEST_TTL_MS).finally(() => {
+ this.inflight = undefined;
+ });
+ return this.inflight;
+ }
+
+ /** For someone opening the model list: tolerates far less staleness than the background refresh. */
+ refreshOnDemand(): Promise<ModelManifestData> {
+ return this.refresh({ ttlMs: MANIFEST_ON_DEMAND_TTL_MS });
+ }
+
+ refreshInBackground(): void {
+ void this.refresh().catch((error: unknown) => this.log(`refresh failed: ${message(error)}`));
+ }
+
+ private loadDiskCache(): void {
+ this.diskChecked = true;
+ try {
+ if (!existsSync(this.cachePath) || statSync(this.cachePath).size > this.maxBytes * 2) return;
+ const raw = JSON.parse(readFileSync(this.cachePath, "utf8")) as { fetchedAtMs?: unknown; manifest?: unknown };
+ const parsed = parseModelManifest(raw.manifest, { nowMs: this.now });
+ if (!parsed.ok) {
+ this.log(`ignoring the cached manifest (${parsed.error})`);
+ return;
+ }
+ // A release can correct a model before the next successful fetch, so an older cache must not hide its copy.
+ if (updatedAtMs(this.bundled) > updatedAtMs(parsed.manifest)) return;
+ this.manifest = parsed.manifest;
+ this.fetchedAtMs = typeof raw.fetchedAtMs === "number" && Number.isFinite(raw.fetchedAtMs) ? raw.fetchedAtMs : null;
+ } catch (error) {
+ this.log(`could not read the cached manifest (${message(error)})`);
+ }
+ }
+
+ private get maxBytes(): number {
+ return this.options.maxBytes ?? MANIFEST_MAX_BYTES;
+ }
+
+ private async fetchAndStore(force: boolean, ttlMs: number): Promise<ModelManifestData> {
+ this.current();
+ const now = this.now;
+ // Expire timestamps from the future after a clock rollback; disk caches cross restarts, so a monotonic clock cannot be used.
+ const within = (sinceMs: number | null, windowMs: number) => sinceMs !== null && now >= sinceMs && now - sinceMs < windowMs;
+ if (!force && within(this.fetchedAtMs, ttlMs)) return this.manifest;
+ if (!force && within(this.lastAttemptMs, MANIFEST_RETRY_MS)) return this.manifest;
+ this.lastAttemptMs = now;
+
+ let fetched: ModelManifestData;
+ try {
+ fetched = await this.download();
+ } catch (error) {
+ this.log(`could not refresh the model list (${message(error)}); keeping the current one`);
+ return this.manifest;
+ }
+ // A stale CDN copy loses to what we already have, so it cannot bring back a model a newer copy removed.
+ if (updatedAtMs(fetched) < updatedAtMs(this.manifest)) {
+ this.log(`ignoring a downloaded list older than the current one (${fetched.updatedAt})`);
+ return this.manifest;
+ }
+ const changed = JSON.stringify(fetched) !== JSON.stringify(this.manifest);
+ this.manifest = fetched;
+ this.fetchedAtMs = now;
+ this.lastAttemptMs = null;
+ try {
+ mkdirSync(dirname(this.cachePath), { recursive: true });
+ writeFileAtomic(this.cachePath, JSON.stringify({ fetchedAtMs: now, manifest: fetched }));
+ } catch (error) {
+ this.log(`could not save the downloaded model list (${message(error)})`);
+ }
+ if (changed) {
+ for (const listener of this.listeners) {
+ try { listener(); } catch (error) { this.log(`a listener failed (${message(error)})`); }
+ }
+ }
+ return this.manifest;
+ }
+
+ private async download(): Promise<ModelManifestData> {
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), this.options.timeoutMs ?? MANIFEST_FETCH_TIMEOUT_MS);
+ try {
+ const response = await (this.options.fetch ?? fetch)(MODEL_MANIFEST_URL, {
+ headers: { accept: "application/json", "user-agent": "OpenMausBot" },
+ // raw.githubusercontent.com answers directly; anywhere else is not the file we meant to read.
+ redirect: "error",
+ signal: controller.signal,
+ });
+ if (response.status !== 200) {
+ void response.body?.cancel().catch(() => {});
+ throw new Error(`HTTP ${response.status}`);
+ }
+ const declared = Number(response.headers.get("content-length"));
+ if (Number.isFinite(declared) && declared > this.maxBytes) {
+ void response.body?.cancel().catch(() => {});
+ throw new Error(`larger than ${this.maxBytes} bytes`);
+ }
+ const text = await readCapped(response, this.maxBytes);
+ let json: unknown;
+ try { json = JSON.parse(text); } catch { throw new Error("not valid JSON"); }
+ const parsed = parseModelManifest(json, { nowMs: this.now });
+ if (!parsed.ok) throw new Error(parsed.error);
+ return parsed.manifest;
+ } catch (error) {
+ if (controller.signal.aborted) throw new Error("it did not answer in time");
+ throw error;
+ } finally {
+ clearTimeout(timer);
+ }
+ }
+}
+
+async function readCapped(response: Response, maxBytes: number): Promise<string> {
+ if (!response.body) return "";
+ const reader = response.body.getReader();
+ const decoder = new TextDecoder();
+ let total = 0;
+ let text = "";
+ for (;;) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ total += value.byteLength;
+ if (total > maxBytes) {
+ await reader.cancel().catch(() => {});
+ throw new Error(`larger than ${maxBytes} bytes`);
+ }
+ text += decoder.decode(value, { stream: true });
+ }
+ return text + decoder.decode();
+}
+
+function message(error: unknown): string {
+ return error instanceof Error ? error.message : String(error);
+}
+
+let store: ModelManifestStore | undefined;
+
+export function modelManifest(): ModelManifestStore {
+ return store ??= new ModelManifestStore({ dataDir: DATA_DIR });
+}
+
+let backgroundTimer: ReturnType<typeof setInterval> | undefined;
+
+/** A sleeping machine's timers pause; the on-demand refresh covers the picker when it wakes. */
+export function startModelManifestRefresh(): void {
+ if (backgroundTimer) return;
+ modelManifest().refreshInBackground();
+ backgroundTimer = setInterval(() => modelManifest().refreshInBackground(), MANIFEST_TTL_MS);
+ backgroundTimer.unref();
+}
+
+/** The current list for an engine, or the bundled one for an engine a download left out. */
+export function currentEngineCatalog(engine: ManifestEngine, source: ModelManifestStore = modelManifest()): ModelCatalog {
+ return engineCatalogFrom(source.current(), engine) ?? bundledEngineCatalog(engine);
+}
+
+export function minCliVersionFor(engine: ManifestEngine, modelId: string, manifest: ModelManifestData): string | null {
+ return manifest.engines[engine]?.models.find((model) => model.id === modelId)?.minCliVersion ?? null;
+}
+
+/** Marks models the installed CLI is too old for, so the picker offers the update instead of a turn that fails. An
+ * unknown version marks nothing: the CLI's own "does not support this model" reply still reaches the update card. */
+export function withCliVersionGate(catalog: ModelCatalog, engine: ManifestEngine, version: VersionTriple | null, source: ModelManifestStore = modelManifest()): ModelCatalog {
+ const manifest = source.current();
+ const options: ModelCatalog["options"] = catalog.options.map(({ needsCliUpdate: _stale, ...option }) => {
+ if (option.custom || version === null) return option;
+ const floor = minCliVersionFor(engine, option.id, manifest);
+ const needed = floor ? parseVersionTriple(floor) : null;
+ return needed && floor && !versionAtLeast(version, needed) ? { ...option, needsCliUpdate: floor } : option;
+ });
+ const usable = (id: string) => options.some((option) => option.id === id && !option.needsCliUpdate);
+ const fallback = options.find((option) => !option.needsCliUpdate && !option.custom)?.id;
+ return { ...catalog, default: usable(catalog.default) ? catalog.default : fallback ?? catalog.default, options };
+}
+
+/** The manifest's list prices and the model each alias names (Antigravity's thinking-level ids). */
+export function currentPrices(): { prices: Readonly<Record<string, ManifestPrice>>; aliases: ReadonlyMap<string, string> } {
+ const manifest = modelManifest().current();
+ const aliases = new Map<string, string>();
+ for (const engine of Object.values(manifest.engines)) {
+ for (const model of engine?.models ?? []) for (const alias of model.aliases ?? []) aliases.set(alias.toLowerCase(), model.id);
+ }
+ return { prices: manifest.prices ?? BUNDLED_MODEL_MANIFEST.prices!, aliases };
+}
diff --git a/server/model-manifest/model-manifest.json b/server/model-manifest/model-manifest.json
new file mode 100644
index 0000000000..0d6a8534a2
--- /dev/null
+++ b/server/model-manifest/model-manifest.json
@@ -0,0 +1,519 @@
+{
+ "version": 1,
+ "updatedAt": "2026-11-09T21:02:58Z",
+ "engines": {
+ "claude": {
+ "default": "claude-sonnet-5",
+ "models": [
+ {
+ "id": "claude-fable-5-2",
+ "name": "Claude Fable 5.2",
+ "status": "current",
+ "contextWindow": 1000000,
+ "minCliVersion": "2.1.321"
+ },
+ {
+ "id": "claude-fable-5-1",
+ "name": "Claude Fable 5.1",
+ "status": "current"
+ },
+ {
+ "id": "claude-fable-5",
+ "name": "Claude Fable 5",
+ "status": "current"
+ },
+ {
+ "id": "claude-opus-5-5",
+ "name": "Claude Opus 5.5",
+ "status": "current",
+ "contextWindow": 1000000
+ },
+ {
+ "id": "claude-opus-5",
+ "name": "Claude Opus 5",
+ "status": "current"
+ },
+ {
+ "id": "claude-sonnet-5-5",
+ "name": "Claude Sonnet 5.5",
+ "status": "current",
+ "contextWindow": 1000000
+ },
+ {
+ "id": "claude-sonnet-5",
+ "name": "Claude Sonnet 5",
+ "status": "current"
+ },
+ {
+ "id": "claude-haiku-5-5",
+ "name": "Claude Haiku 5.5",
+ "status": "current",
+ "contextWindow": 1000000
+ },
+ {
+ "id": "claude-haiku-4-5",
+ "name": "Claude Haiku 4.5",
+ "status": "current"
+ }
+ ]
+ },
+ "cursor": {
+ "default": "auto",
+ "models": [
+ {
+ "id": "auto",
+ "name": "Auto",
+ "status": "current"
+ },
+ {
+ "id": "composer-2.5",
+ "name": "Composer 2.5",
+ "status": "current"
+ },
+ {
+ "id": "composer-2.5-fast",
+ "name": "Composer 2.5 Fast",
+ "status": "current"
+ },
+ {
+ "id": "gpt-5.3-codex",
+ "name": "Codex 5.3",
+ "status": "current"
+ },
+ {
+ "id": "claude-sonnet-5-thinking-high",
+ "name": "Claude Sonnet 5 1M Thinking",
+ "status": "current"
+ }
+ ]
+ },
+ "grok": {
+ "default": "grok-4.7",
+ "models": [
+ {
+ "id": "grok-4.7",
+ "name": "Grok 4.7",
+ "status": "current",
+ "contextWindow": 500000
+ },
+ {
+ "id": "grok-4.6",
+ "name": "Grok 4.6",
+ "status": "current"
+ },
+ {
+ "id": "grok-4.5",
+ "name": "Grok 4.5",
+ "status": "current"
+ }
+ ]
+ },
+ "kimi": {
+ "default": "kimi-code/k3",
+ "models": [
+ {
+ "id": "kimi-code/k3",
+ "name": "Kimi K3",
+ "status": "current"
+ },
+ {
+ "id": "kimi-code/k3-256k",
+ "name": "Kimi K3 256K",
+ "status": "current"
+ },
+ {
+ "id": "kimi-code/kimi-for-coding",
+ "name": "Kimi for Coding",
+ "status": "current"
+ },
+ {
+ "id": "kimi-code/kimi-for-coding-highspeed",
+ "name": "Kimi for Coding Highspeed",
+ "status": "current"
+ }
+ ]
+ },
+ "antigravity": {
+ "default": "gemini-3.8-flash",
+ "models": [
+ {
+ "id": "gemini-3.8-flash",
+ "name": "Gemini 3.8 Flash",
+ "status": "current",
+ "aliases": [
+ "gemini-3.8-flash-high",
+ "gemini-3.8-flash-medium",
+ "gemini-3.8-flash-low"
+ ],
+ "variants": [
+ {
+ "id": "low",
+ "label": "Low"
+ },
+ {
+ "id": "medium",
+ "label": "Medium"
+ },
+ {
+ "id": "high",
+ "label": "High"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "prices": {
+ "gpt-6-astra": {
+ "inputPerMillion": 10,
+ "cachedInputPerMillion": 1,
+ "outputPerMillion": 50,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.6-sol": {
+ "inputPerMillion": 4,
+ "cachedInputPerMillion": 0.4,
+ "outputPerMillion": 20,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.6-terra": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 12,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.6-luna": {
+ "inputPerMillion": 0.2,
+ "cachedInputPerMillion": 0.02,
+ "outputPerMillion": 1.2,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.5": {
+ "inputPerMillion": 5,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 30,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.4": {
+ "inputPerMillion": 2.5,
+ "cachedInputPerMillion": 0.25,
+ "outputPerMillion": 15,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.4-mini": {
+ "inputPerMillion": 0.75,
+ "cachedInputPerMillion": 0.075,
+ "outputPerMillion": 4.5,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "gpt-5.3-codex": {
+ "inputPerMillion": 1.75,
+ "cachedInputPerMillion": 0.175,
+ "outputPerMillion": 14,
+ "asOf": "2026-09-23",
+ "source": "https://developers.openai.com/api/docs/pricing"
+ },
+ "claude-fable-5-2": {
+ "inputPerMillion": 8,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 40,
+ "asOf": "2026-11-10",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-fable-5-1": {
+ "inputPerMillion": 10,
+ "cachedInputPerMillion": 0.25,
+ "outputPerMillion": 50,
+ "asOf": "2026-09-23",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-fable-5": {
+ "inputPerMillion": 10,
+ "cachedInputPerMillion": 1,
+ "outputPerMillion": 50,
+ "asOf": "2026-09-23",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-opus-5": {
+ "inputPerMillion": 5,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 25,
+ "asOf": "2026-09-23",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-sonnet-5": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 10,
+ "asOf": "2026-09-23",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-haiku-5-5": {
+ "inputPerMillion": 0.1,
+ "cachedInputPerMillion": 0.01,
+ "outputPerMillion": 0.5,
+ "asOf": "2026-10-27",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-haiku-4-5": {
+ "inputPerMillion": 1,
+ "cachedInputPerMillion": 0.1,
+ "outputPerMillion": 5,
+ "asOf": "2026-09-23",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "claude-haiku-4-5-20251001": {
+ "inputPerMillion": 1,
+ "cachedInputPerMillion": 0.1,
+ "outputPerMillion": 5,
+ "asOf": "2026-09-23",
+ "source": "https://platform.claude.com/docs/en/about-claude/pricing"
+ },
+ "grok-4.7": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 6,
+ "asOf": "2026-09-23",
+ "source": "https://docs.x.ai/developers/models"
+ },
+ "grok-4.6": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 6,
+ "asOf": "2026-09-23",
+ "source": "https://docs.x.ai/developers/models"
+ },
+ "grok-4.5": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.3,
+ "outputPerMillion": 6,
+ "asOf": "2026-09-23",
+ "source": "https://docs.x.ai/developers/models"
+ },
+ "gemini-2.5-pro": {
+ "inputPerMillion": 1.25,
+ "cachedInputPerMillion": 0.125,
+ "outputPerMillion": 10,
+ "asOf": "2026-09-23",
+ "source": "https://ai.google.dev/gemini-api/docs/pricing"
+ },
+ "gemini-2.5-flash": {
+ "inputPerMillion": 0.3,
+ "cachedInputPerMillion": 0.03,
+ "outputPerMillion": 2.5,
+ "asOf": "2026-09-23",
+ "source": "https://ai.google.dev/gemini-api/docs/pricing"
+ },
+ "gemini-3.1-pro-preview": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 12,
+ "asOf": "2026-09-23",
+ "source": "https://ai.google.dev/gemini-api/docs/pricing"
+ },
+ "gemini-3.8-flash": {
+ "inputPerMillion": 0.75,
+ "cachedInputPerMillion": 0.075,
+ "outputPerMillion": 3.75,
+ "asOf": "2026-09-23",
+ "source": "https://ai.google.dev/gemini-api/docs/pricing",
+ "changes": [
+ {
+ "from": "2027-01-01",
+ "inputPerMillion": 1.5,
+ "cachedInputPerMillion": 0.15,
+ "outputPerMillion": 7.5
+ }
+ ]
+ },
+ "minimax-m3": {
+ "inputPerMillion": 0.3,
+ "cachedInputPerMillion": 0.06,
+ "outputPerMillion": 1.2,
+ "asOf": "2026-09-23",
+ "source": "https://platform.minimax.io/docs/guides/pricing-paygo"
+ },
+ "minimax-m2.7": {
+ "inputPerMillion": 0.3,
+ "cachedInputPerMillion": 0.06,
+ "outputPerMillion": 1.2,
+ "asOf": "2026-09-23",
+ "source": "https://platform.minimax.io/docs/guides/pricing-paygo"
+ },
+ "minimax-m2.7-highspeed": {
+ "inputPerMillion": 0.6,
+ "cachedInputPerMillion": 0.06,
+ "outputPerMillion": 2.4,
+ "asOf": "2026-09-23",
+ "source": "https://platform.minimax.io/docs/guides/pricing-paygo"
+ },
+ "openai/gpt-6-astra": {
+ "inputPerMillion": 10,
+ "cachedInputPerMillion": 1,
+ "outputPerMillion": 50,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.6-sol": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 10,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.6-terra": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 12,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.6-luna": {
+ "inputPerMillion": 0.2,
+ "cachedInputPerMillion": 0.02,
+ "outputPerMillion": 1.2,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.5": {
+ "inputPerMillion": 5,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 30,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.4": {
+ "inputPerMillion": 2.5,
+ "cachedInputPerMillion": 0.25,
+ "outputPerMillion": 15,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.4-mini": {
+ "inputPerMillion": 0.75,
+ "cachedInputPerMillion": 0.075,
+ "outputPerMillion": 4.5,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "openai/gpt-5.3-codex": {
+ "inputPerMillion": 1.75,
+ "cachedInputPerMillion": 0.175,
+ "outputPerMillion": 14,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "anthropic/claude-fable-5.2": {
+ "inputPerMillion": 8,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 40,
+ "asOf": "2026-11-10",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "anthropic/claude-fable-5.1": {
+ "inputPerMillion": 10,
+ "cachedInputPerMillion": 0.25,
+ "outputPerMillion": 50,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "anthropic/claude-fable-5": {
+ "inputPerMillion": 10,
+ "cachedInputPerMillion": 1,
+ "outputPerMillion": 50,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "anthropic/claude-opus-5": {
+ "inputPerMillion": 5,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 25,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "anthropic/claude-sonnet-5": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 10,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "anthropic/claude-haiku-4.5": {
+ "inputPerMillion": 1,
+ "cachedInputPerMillion": 0.1,
+ "outputPerMillion": 5,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "x-ai/grok-4.7": {
+ "inputPerMillion": 1.6,
+ "cachedInputPerMillion": 0.4,
+ "outputPerMillion": 4.8,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "x-ai/grok-4.6": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.5,
+ "outputPerMillion": 6,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "x-ai/grok-4.5": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.3,
+ "outputPerMillion": 6,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "google/gemini-2.5-pro": {
+ "inputPerMillion": 1.25,
+ "cachedInputPerMillion": 0.125,
+ "outputPerMillion": 10,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "google/gemini-2.5-flash": {
+ "inputPerMillion": 0.3,
+ "cachedInputPerMillion": 0.03,
+ "outputPerMillion": 2.5,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "google/gemini-3.1-pro-preview": {
+ "inputPerMillion": 2,
+ "cachedInputPerMillion": 0.2,
+ "outputPerMillion": 12,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "google/gemini-3.8-flash": {
+ "inputPerMillion": 0.75,
+ "cachedInputPerMillion": 0.075,
+ "outputPerMillion": 3.75,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "minimax/minimax-m3": {
+ "inputPerMillion": 0.3,
+ "cachedInputPerMillion": 0.06,
+ "outputPerMillion": 1.2,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ },
+ "minimax/minimax-m2.7": {
+ "inputPerMillion": 0.3,
+ "cachedInputPerMillion": 0.06,
+ "outputPerMillion": 1.2,
+ "asOf": "2026-09-23",
+ "source": "https://openrouter.ai/api/v1/models"
+ }
+ }
+}
diff --git a/server/model-manifest/schema.ts b/server/model-manifest/schema.ts
new file mode 100644
index 0000000000..82fcb904f4
--- /dev/null
+++ b/server/model-manifest/schema.ts
@@ -0,0 +1,118 @@
+// Adapted from apps/server/src/provider/ModelManifest.ts and ClaudeModelManifest.ts at commit e85e0094, MIT License,
+// Copyright (c) 2026 T3 Tools Inc. (full text in third_party/t3-code/LICENSE); modified: zod in place of Effect Schema,
+// a flat model list with CLI floors and prices in place of capability profiles and adapter schemas.
+//
+// To add a model: edit model-manifest.json, bump `updatedAt`, open a PR. `scripts/check-model-manifest.mjs` runs in CI.
+import { z } from "zod";
+
+// Claude Code's `[1m]` suffix selects a model's 1M-token context.
+export const CLAUDE_MODEL_ID = /^[a-z0-9][a-z0-9._:/-]*(?:\[1m\])?$/i;
+
+export const MANIFEST_ENGINES = ["claude", "cursor", "grok", "kimi", "antigravity"] as const;
+export type ManifestEngine = (typeof MANIFEST_ENGINES)[number];
+
+/** A model id reaches the engine's command line, so each engine keeps its own rule; a download passes the same one. */
+export const ENGINE_MODEL_ID: Readonly<Record<ManifestEngine, RegExp>> = {
+ claude: CLAUDE_MODEL_ID,
+ cursor: /^[a-z0-9][a-z0-9._:+-]*$/i,
+ grok: /^[a-z0-9][a-z0-9._-]*$/i,
+ kimi: /^[a-z0-9][a-z0-9._:/-]*$/i,
+ antigravity: /^[a-z0-9][a-z0-9._-]*$/i,
+};
+
+const MODEL_ID_MAX = 160;
+const CLI_VERSION = /^\d{1,6}\.\d{1,6}\.\d{1,6}$/;
+const PRICE_KEY = /^[a-z0-9][a-z0-9._:/+-]*$/;
+const DAY = /^\d{4}-\d{2}-\d{2}$/;
+const VARIANT_ID = /^[a-z0-9][a-z0-9._-]*$/i;
+// eslint-disable-next-line no-control-regex
+const CONTROL = /[\u0000-\u001f\u007f]/u;
+
+/** Allows for a slow local clock; a date past it would pin every install to that copy until the date passed. */
+const FUTURE_TOLERANCE_MS = 24 * 60 * 60 * 1000;
+
+type ObjectOf = typeof z.object;
+
+const label = (max: number) => z.string().min(1).max(max).refine((value) => !CONTROL.test(value), "control characters");
+
+const pricePeriod = {
+ inputPerMillion: z.number().min(0).max(100_000),
+ cachedInputPerMillion: z.number().min(0).max(100_000).optional(),
+ outputPerMillion: z.number().min(0).max(100_000),
+};
+
+function modelId(engine: ManifestEngine) {
+ return z.string().max(MODEL_ID_MAX).regex(ENGINE_MODEL_ID[engine]).refine((id) => id !== "default", "reserved id");
+}
+
+function engineSchema(engine: ManifestEngine, objectOf: ObjectOf) {
+ const model = objectOf({
+ id: modelId(engine),
+ name: label(120),
+ aliases: z.array(modelId(engine)).max(20).optional(),
+ status: z.enum(["current", "legacy"]),
+ contextWindow: z.number().int().positive().max(100_000_000).optional(),
+ minCliVersion: z.string().regex(CLI_VERSION).optional(),
+ variants: z.array(objectOf({ id: z.string().min(1).max(40).regex(VARIANT_ID), label: label(40) })).max(20).optional(),
+ });
+ return objectOf({
+ default: modelId(engine),
+ models: z.array(model).min(1).max(200),
+ }).superRefine((catalog, context) => {
+ const names = new Set<string>();
+ for (const entry of catalog.models) {
+ for (const name of [entry.id, ...(entry.aliases ?? [])]) {
+ if (names.has(name)) context.addIssue({ code: "custom", message: `${engine}: ${name} is listed twice` });
+ names.add(name);
+ }
+ }
+ const chosen = catalog.models.find((entry) => entry.id === catalog.default);
+ if (chosen?.status !== "current") context.addIssue({ code: "custom", message: `${engine}: the default must be a current model` });
+ });
+}
+
+const priceEntry = (objectOf: ObjectOf) => objectOf({
+ ...pricePeriod,
+ asOf: z.string().regex(DAY),
+ source: z.string().max(300).regex(/^https:\/\//),
+ changes: z.array(objectOf({ from: z.string().regex(DAY), ...pricePeriod })).max(40).optional(),
+}).refine((entry) => entry.changes === undefined || entry.changes.every((change, index, all) => index === 0 || all[index - 1]!.from < change.from),
+ "price changes must be in date order");
+
+const hasNoFutureDate = (now: number) => (updatedAt: string) => Date.parse(updatedAt) <= now + FUTURE_TOLERANCE_MS;
+
+function manifestSchema(objectOf: ObjectOf, nowMs: number) {
+ return objectOf({
+ version: z.literal(1),
+ updatedAt: z.iso.datetime({ offset: true }).refine(hasNoFutureDate(nowMs), "updatedAt is in the future"),
+ engines: objectOf({
+ claude: engineSchema("claude", objectOf),
+ cursor: engineSchema("cursor", objectOf).optional(),
+ grok: engineSchema("grok", objectOf).optional(),
+ kimi: engineSchema("kimi", objectOf).optional(),
+ antigravity: engineSchema("antigravity", objectOf).optional(),
+ }),
+ prices: z.record(z.string().max(MODEL_ID_MAX).regex(PRICE_KEY), priceEntry(objectOf)).optional(),
+ });
+}
+
+export type ModelManifestData = z.infer<ReturnType<typeof manifestSchema>>;
+export type ManifestModel = NonNullable<ModelManifestData["engines"][ManifestEngine]>["models"][number];
+export type ManifestPrice = NonNullable<ModelManifestData["prices"]>[string];
+
+export type ManifestResult = { ok: true; manifest: ModelManifestData } | { ok: false; error: string };
+
+function firstIssue(error: z.ZodError): string {
+ const issue = error.issues[0]!;
+ return `${issue.path.join(".") || "manifest"}: ${issue.message}`;
+}
+
+/** Runtime reads leave unknown fields out, so a new field on main never freezes older installs; a real problem still
+ * rejects the whole copy. `strict` is for the bundled file and CI, where an unknown field is a typo. Every engine and
+ * the price table are required by the CI check, not here: a download that leaves one out only falls back to the bundled
+ * copy. */
+export function parseModelManifest(value: unknown, options: { strict?: boolean; nowMs?: number } = {}): ManifestResult {
+ const objectOf = options.strict ? (z.strictObject as unknown as ObjectOf) : z.object;
+ const parsed = manifestSchema(objectOf, options.nowMs ?? Date.now()).safeParse(value);
+ return parsed.success ? { ok: true, manifest: parsed.data } : { ok: false, error: firstIssue(parsed.error) };
+}
diff --git a/server/model-manifest/wiring.test.ts b/server/model-manifest/wiring.test.ts
new file mode 100644
index 0000000000..8f30bdb10a
--- /dev/null
+++ b/server/model-manifest/wiring.test.ts
@@ -0,0 +1,66 @@
+import { mkdirSync, writeFileSync } from "node:fs";
+import { dirname } from "node:path";
+import { expect, it } from "vitest";
+
+import { DATA_DIR } from "../config.ts";
+import { BUNDLED_MODEL_MANIFEST } from "./bundled.ts";
+import { modelManifestCachePath } from "./manifest.ts";
+
+// The store is one per process and the drivers read it as they load, so its cache is seeded before they are imported,
+// as a later start of the app would find it.
+const newer = new Date(Date.now() + 60_000).toISOString();
+const path = modelManifestCachePath(DATA_DIR);
+mkdirSync(dirname(path), { recursive: true });
+writeFileSync(path, JSON.stringify({
+ fetchedAtMs: Date.now(),
+ manifest: {
+ version: 1,
+ updatedAt: newer,
+ engines: {
+ claude: {
+ default: "claude-sonnet-5",
+ models: [
+ { id: "claude-synthetic-9", name: "Claude Synthetic 9", status: "current", contextWindow: 1_000_000, minCliVersion: "9.9.9" },
+ { id: "claude-sonnet-5", name: "Claude Sonnet 5", status: "current" },
+ ],
+ },
+ },
+ prices: { "claude-synthetic-9": { inputPerMillion: 7, outputPerMillion: 9, asOf: "2026-11-10", source: "https://platform.claude.com/x" } },
+ },
+}));
+
+const [{ officialModels }, { readClaudeModelCatalog, STATIC_CLAUDE_MODELS }, { readGrokModelCatalog }, { withOrgBlocks }, { listPriceFor }, { readStartupModelCache, writeStartupModelCache }] = await Promise.all([
+ import("../agent-endpoint-models.ts"),
+ import("../drivers/claude.ts"),
+ import("../drivers/acp/grok.ts"),
+ import("../drivers/claude-model-access.ts"),
+ import("../model-prices.ts"),
+ import("../startup-model-catalog.ts"),
+]);
+
+it("a list on disk reaches the picker, the official-endpoint list and the price table", () => {
+ const catalog = readClaudeModelCatalog({ HOME: "/nonexistent-home" });
+ expect(catalog.options.map((option) => option.id)).toEqual(["claude-synthetic-9", "claude-sonnet-5"]);
+ expect(catalog.options[0]).toMatchObject({ contextWindow: 1_000_000 });
+ expect(catalog.default).toBe("claude-sonnet-5");
+ expect(officialModels(false)).toContain("claude-synthetic-9");
+ expect(listPriceFor("claude-synthetic-9")).toMatchObject({ inputPerMillion: 7, outputPerMillion: 9 });
+});
+
+it("leaves the bundled list and the org blocks working", () => {
+ expect(STATIC_CLAUDE_MODELS.options.some((option) => option.id === "claude-synthetic-9")).toBe(false);
+ const catalog = readClaudeModelCatalog({ HOME: "/nonexistent-home" });
+ const blocked = withOrgBlocks(catalog, new Set(["claude-sonnet-5"]));
+ expect(blocked.options.find((option) => option.id === "claude-sonnet-5")?.orgBlocked).toBe(true);
+});
+
+it("an engine the download left out keeps its bundled list", () => {
+ const bundled = BUNDLED_MODEL_MANIFEST.engines.grok!.models.map((model) => model.id);
+ expect(readGrokModelCatalog({ HOME: "/nonexistent-home" }).options.map((option) => option.id)).toEqual(bundled);
+});
+
+it("the startup list keeps a model's update mark", () => {
+ const id = "manifest-wiring";
+ writeStartupModelCache(id, { default: "a", options: [{ id: "a", label: "A", needsCliUpdate: "2.1.321" }] });
+ expect(readStartupModelCache(id)?.options[0]?.needsCliUpdate).toBe("2.1.321");
+});
diff --git a/server/model-prices.test.ts b/server/model-prices.test.ts
index b4260c67b6..7b51bc01cf 100644
--- a/server/model-prices.test.ts
+++ b/server/model-prices.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { estimatePriceFor, LIST_PRICES, ledgerCost, listPriceFor } from "./model-prices.ts";
+import { estimatePriceFor, ledgerCost, listPriceFor, listPrices } from "./model-prices.ts";
import type { PriceList } from "./prices.ts";
const OFFICIAL = [
@@ -13,8 +13,8 @@ const OFFICIAL = [
describe("built-in list prices", () => {
it("names an official source and the day it was read for every entry, with sane numbers", () => {
- expect(Object.keys(LIST_PRICES).length).toBeGreaterThan(20);
- for (const [model, entry] of Object.entries(LIST_PRICES)) {
+ expect(Object.keys(listPrices()).length).toBeGreaterThan(20);
+ for (const [model, entry] of Object.entries(listPrices())) {
expect(model, "keys are lower-case").toBe(model.toLowerCase());
expect(entry.asOf).toMatch(/^\d{4}-\d{2}-\d{2}$/);
expect(OFFICIAL.some((prefix) => entry.source.startsWith(prefix)), `${model}: ${entry.source}`).toBe(true);
diff --git a/server/model-prices.ts b/server/model-prices.ts
index 257722720f..cd81a2334b 100644
--- a/server/model-prices.ts
+++ b/server/model-prices.ts
@@ -1,4 +1,5 @@
import type { ModelPrice, PriceList, PricedTurn } from "./prices.ts";
+import { currentPrices } from "./model-manifest/manifest.ts";
import { billableFor } from "./prices.ts";
export interface ListPrice extends ModelPrice {
@@ -7,99 +8,14 @@ export interface ListPrice extends ModelPrice {
changes?: ReadonlyArray<ModelPrice & { from: string }>;
}
-const AS_OF = "2026-09-23";
-const OPENAI = "https://developers.openai.com/api/docs/pricing";
-const ANTHROPIC = "https://platform.claude.com/docs/en/about-claude/pricing";
-const XAI = "https://docs.x.ai/developers/models";
-const GOOGLE = "https://ai.google.dev/gemini-api/docs/pricing";
-const MINIMAX = "https://platform.minimax.io/docs/guides/pricing-paygo";
-// OpenRouter's live list discounts some models despite its FAQ, so these are read from that list, not copied from vendors.
-const OPENROUTER = "https://openrouter.ai/api/v1/models";
-
-const price = (source: string, input: number, cached: number, output: number, extra: Partial<ListPrice> = {}): ListPrice => ({
- inputPerMillion: input,
- cachedInputPerMillion: cached,
- outputPerMillion: output,
- asOf: AS_OF,
- source,
- ...extra,
-});
-
-export const LIST_PRICES: Readonly<Record<string, ListPrice>> = {
- // OpenAI, Standard tier, short context (<272K input tokens).
- "gpt-6-astra": price(OPENAI, 10, 1, 50),
- // Labelled promotional pricing on the source page, with no end date given.
- "gpt-5.6-sol": price(OPENAI, 4, 0.4, 20),
- "gpt-5.6-terra": price(OPENAI, 2, 0.2, 12),
- "gpt-5.6-luna": price(OPENAI, 0.2, 0.02, 1.2),
- "gpt-5.5": price(OPENAI, 5, 0.5, 30),
- "gpt-5.4": price(OPENAI, 2.5, 0.25, 15),
- "gpt-5.4-mini": price(OPENAI, 0.75, 0.075, 4.5),
- "gpt-5.3-codex": price(OPENAI, 1.75, 0.175, 14),
- // gpt-5.3-codex-spark has no published API price: unpriced.
-
- // Anthropic: base input, cache hit, output. No long-context tier, except that a Haiku 5.5 prompt over 100,000 tokens costs 5x.
- "claude-fable-5-1": price(ANTHROPIC, 10, 0.25, 50),
- "claude-fable-5": price(ANTHROPIC, 10, 1, 50),
- "claude-opus-5": price(ANTHROPIC, 5, 0.5, 25),
- "claude-sonnet-5": price(ANTHROPIC, 2, 0.2, 10),
- "claude-haiku-5-5": price(ANTHROPIC, 0.1, 0.01, 0.5, { asOf: "2026-10-27" }),
- "claude-haiku-4-5": price(ANTHROPIC, 1, 0.1, 5),
- "claude-haiku-4-5-20251001": price(ANTHROPIC, 1, 0.1, 5),
-
- // xAI, under 200k prompt tokens. grok-4, grok-4-fast and grok-3-mini are retired or unlisted: unpriced.
- "grok-4.7": price(XAI, 2, 0.5, 6),
- "grok-4.6": price(XAI, 2, 0.5, 6),
- "grok-4.5": price(XAI, 2, 0.3, 6),
-
- // Google Gemini API, paid tier, prompts up to 200k tokens.
- "gemini-2.5-pro": price(GOOGLE, 1.25, 0.125, 10),
- "gemini-2.5-flash": price(GOOGLE, 0.3, 0.03, 2.5),
- "gemini-3.1-pro-preview": price(GOOGLE, 2, 0.2, 12),
- "gemini-3.8-flash": price(GOOGLE, 0.75, 0.075, 3.75, {
- changes: [{ from: "2027-01-01", inputPerMillion: 1.5, cachedInputPerMillion: 0.15, outputPerMillion: 7.5 }],
- }),
-
- // MiniMax, international pay-as-you-go, Standard, M3 up to 512k input tokens, at the price charged (shown as 50% off).
- "minimax-m3": price(MINIMAX, 0.3, 0.06, 1.2),
- "minimax-m2.7": price(MINIMAX, 0.3, 0.06, 1.2),
- "minimax-m2.7-highspeed": price(MINIMAX, 0.6, 0.06, 2.4),
-
- // OpenRouter ids, as its live model list prices them.
- "openai/gpt-6-astra": price(OPENROUTER, 10, 1, 50),
- "openai/gpt-5.6-sol": price(OPENROUTER, 2, 0.2, 10),
- "openai/gpt-5.6-terra": price(OPENROUTER, 2, 0.2, 12),
- "openai/gpt-5.6-luna": price(OPENROUTER, 0.2, 0.02, 1.2),
- "openai/gpt-5.5": price(OPENROUTER, 5, 0.5, 30),
- "openai/gpt-5.4": price(OPENROUTER, 2.5, 0.25, 15),
- "openai/gpt-5.4-mini": price(OPENROUTER, 0.75, 0.075, 4.5),
- "openai/gpt-5.3-codex": price(OPENROUTER, 1.75, 0.175, 14),
- "anthropic/claude-fable-5.1": price(OPENROUTER, 10, 0.25, 50),
- "anthropic/claude-fable-5": price(OPENROUTER, 10, 1, 50),
- "anthropic/claude-opus-5": price(OPENROUTER, 5, 0.5, 25),
- "anthropic/claude-sonnet-5": price(OPENROUTER, 2, 0.2, 10),
- "anthropic/claude-haiku-4.5": price(OPENROUTER, 1, 0.1, 5),
- "x-ai/grok-4.7": price(OPENROUTER, 1.6, 0.4, 4.8),
- "x-ai/grok-4.6": price(OPENROUTER, 2, 0.5, 6),
- "x-ai/grok-4.5": price(OPENROUTER, 2, 0.3, 6),
- "google/gemini-2.5-pro": price(OPENROUTER, 1.25, 0.125, 10),
- "google/gemini-2.5-flash": price(OPENROUTER, 0.3, 0.03, 2.5),
- "google/gemini-3.1-pro-preview": price(OPENROUTER, 2, 0.2, 12),
- "google/gemini-3.8-flash": price(OPENROUTER, 0.75, 0.075, 3.75),
- "minimax/minimax-m3": price(OPENROUTER, 0.3, 0.06, 1.2),
- "minimax/minimax-m2.7": price(OPENROUTER, 0.3, 0.06, 1.2),
-};
-
-/** The Antigravity picker offers Gemini 3.8 Flash at three thinking levels. */
-const ALIASES: Readonly<Record<string, string>> = {
- "gemini-3.8-flash-high": "gemini-3.8-flash",
- "gemini-3.8-flash-medium": "gemini-3.8-flash",
- "gemini-3.8-flash-low": "gemini-3.8-flash",
-};
+export function listPrices(): Readonly<Record<string, ListPrice>> {
+ return currentPrices().prices;
+}
export function listPriceFor(model: string, at: Date = new Date()): ModelPrice | null {
+ const { prices, aliases } = currentPrices();
const key = model.trim().toLowerCase();
- const entry = LIST_PRICES[ALIASES[key] ?? key];
+ const entry = prices[aliases.get(key) ?? key];
if (!entry) return null;
const day = at.toISOString().slice(0, 10);
const change = entry.changes?.filter((candidate) => candidate.from <= day).at(-1);
diff --git a/server/routes/instances.ts b/server/routes/instances.ts
index f9fca7514e..5b48764e62 100644
--- a/server/routes/instances.ts
+++ b/server/routes/instances.ts
@@ -1,6 +1,7 @@
import { agentEndpointAddress, discoverAgentEndpointModels, hasExplicitModel, isGatewayEndpoint } from "../agent-endpoint-models.ts";
import { codexEndpointSchema, codexEndpointUpdateSchema, newCodexEndpoint, updateCodexEndpoint, withCodexEndpointInfo, isCodexEndpoint } from "../codex-endpoints.ts";
import { userError, userErrorFields } from "../user-errors.ts";
+import { modelManifest } from "../model-manifest/manifest.ts";
import { randomUUID } from "node:crypto";
import { providerIconError } from "../../shared/provider-icon.ts";
import {
@@ -107,6 +108,8 @@ export function createInstanceRoutes(deps: InstanceRouteDeps): RouteHandler {
// Rescan PATH: Windows never pushes PATH changes into a live process, so a CLI installed since launch stays invisible.
resetPathCache();
if (url.searchParams.get("fresh") === "1") registry.forgetSnapshots();
+ // Whatever this download brings shows on the next open; the answer does not wait for it.
+ void modelManifest().refreshOnDemand().catch(() => {});
return json(res, 200, { instances: await describeInstances() });
}
const companyMutation = /^\/api\/instances\/(company\.[\w.-]+)(?:\/|$)/.exec(path);
diff --git a/server/routes/internal-models.ts b/server/routes/internal-models.ts
index 81a70def0f..a0ca92e2e7 100644
--- a/server/routes/internal-models.ts
+++ b/server/routes/internal-models.ts
@@ -16,7 +16,7 @@ export interface MenuEngine {
instanceId: string;
driverKind: string;
displayName: string | undefined;
- models: { default: string; options: ReadonlyArray<{ id: string; label: string; orgBlocked?: true }> };
+ models: { default: string; options: ReadonlyArray<{ id: string; label: string; orgBlocked?: true; needsCliUpdate?: string }> };
adapter: { capabilities: { effortLevels?: readonly string[] } };
}
@@ -59,7 +59,7 @@ export function modelMenu(input: {
for (const engine of input.engines) {
const { instanceId } = engine;
const name = engine.displayName || engine.driverKind;
- const labels = new Map(engine.models.options.filter((option) => !option.orgBlocked).map((option) => [option.id, option.label]));
+ const labels = new Map(engine.models.options.filter((option) => !option.orgBlocked && !option.needsCliUpdate).map((option) => [option.id, option.label]));
const ids = [...new Set([...[input.current, ...input.pinned].filter((pin) => pin.instanceId === instanceId).map((pin) => pin.model), engine.models.default, ...labels.keys()])]
.filter(Boolean);
const matching = terms.length ? ids.filter((id) => terms.every((term) => `${name} ${id} ${labels.get(id) ?? ""}`.toLowerCase().includes(term))) : ids;
diff --git a/server/startup-model-catalog.ts b/server/startup-model-catalog.ts
index 5eac53e83c..34c35036d3 100644
--- a/server/startup-model-catalog.ts
+++ b/server/startup-model-catalog.ts
@@ -56,6 +56,7 @@ function catalogFrom(value: unknown): ModelCatalog | null {
contextWindow?: unknown;
variants?: unknown;
orgBlocked?: unknown;
+ needsCliUpdate?: unknown;
};
if (typeof option.id !== "string" || typeof option.label !== "string") return null;
const variants = variantList(option.variants);
@@ -70,6 +71,7 @@ function catalogFrom(value: unknown): ModelCatalog | null {
: {}),
...(variants ? { variants } : {}),
...(option.orgBlocked === true ? { orgBlocked: true as const } : {}),
+ ...(typeof option.needsCliUpdate === "string" ? { needsCliUpdate: option.needsCliUpdate } : {}),
});
}
return { default: raw.default, options };
diff --git a/server/testing/setup.ts b/server/testing/setup.ts
index de6141e27b..870c632a59 100644
--- a/server/testing/setup.ts
+++ b/server/testing/setup.ts
@@ -12,6 +12,8 @@ process.env.HOME = home;
process.env.USERPROFILE = home;
// OMB_DATA_DIR must never escape the throwaway home the suite deletes.
delete process.env.OMB_DATA_DIR;
+// The model manifest comes from the bundled copy in tests; refreshing it would be a network call in every server boot.
+process.env.OMB_DISABLE_MODEL_MANIFEST_FETCH = "1";
// Do not let a developer's Hermes global config path leak into per-test homes.
delete process.env.HERMES_HOME;
// A ChatGPT-plan turn links the person's Codex home ($CODEX_HOME or ~/.codex) into its own: keep it in the throwaway home.
diff --git a/src/components/AutomaticRecoverySettings.tsx b/src/components/AutomaticRecoverySettings.tsx
index 845baecbee..2070cff29a 100644
--- a/src/components/AutomaticRecoverySettings.tsx
+++ b/src/components/AutomaticRecoverySettings.tsx
@@ -15,7 +15,7 @@ export function AutomaticRecoverySettings() {
const value = draft ?? state.config?.automaticRecovery ?? { enabled: false };
const engines = state.instances.filter((instance) => instance.snapshot.state === "available" && !instance.policy);
const engine = engines.find((instance) => instance.instanceId === value.backup?.instanceId);
- const models = engine?.models.options.filter((model) => !model.orgBlocked && (engine.snapshot.authenticated !== false || model.custom)) ?? [];
+ const models = engine?.models.options.filter((model) => !model.orgBlocked && !model.needsCliUpdate && (engine.snapshot.authenticated !== false || model.custom)) ?? [];
const ready = models.some((model) => model.id === value.backup?.model);
const change = (next: Recovery) => { setDraft(next); setError(""); };
const save = async () => {
diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsx
index 98fa5b24d8..4180b3edee 100644
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@ -569,7 +569,7 @@ export function ModelPicker({
const attention = !active ? undefined
: active.policy ? t("policy.managedBy", { organization: active.policy.organizationName })
: needsCli(active) ? t("model.setupRequired")
- : needsSignIn(active) && !isCustomOnly(active) && !currentOption?.custom ? t("model.signInRequired") : currentOption?.orgBlocked ? t("model.orgBlocked") : undefined;
+ : needsSignIn(active) && !isCustomOnly(active) && !currentOption?.custom ? t("model.signInRequired") : currentOption?.orgBlocked ? t("model.orgBlocked") : currentOption?.needsCliUpdate ? t("engines.updateClaude") : undefined;
const summary = active
? `${engineDisplayName(active)} · ${modelLabel(active, selection.model)}${
modelProvider(active, selection.model) ? ` · ${modelProvider(active, selection.model)}` : ""
diff --git a/src/components/ModelPickerFull.tsx b/src/components/ModelPickerFull.tsx
index 9a7765d855..25c50395e7 100644
--- a/src/components/ModelPickerFull.tsx
+++ b/src/components/ModelPickerFull.tsx
@@ -28,8 +28,10 @@ export function ModelRow({ option, current, defaultId, botModel = false, onPick
botModel?: boolean;
onPick: () => void;
}) {
- const blocked = option.orgBlocked === true;
- const meta = blocked ? t("model.orgBlocked") : [option.provider, option.id === defaultId ? t("model.effort.default") : undefined].filter(Boolean).join(" · ");
+ const needsUpdate = option.needsCliUpdate !== undefined;
+ const blocked = option.orgBlocked === true || needsUpdate;
+ const reason = needsUpdate ? t("chat.claudeUpdate.offer") : t("model.orgBlocked");
+ const meta = needsUpdate ? t("engines.updateClaude") : blocked ? reason : [option.provider, option.id === defaultId ? t("model.effort.default") : undefined].filter(Boolean).join(" · ");
return (
<button
type="button"
@@ -38,8 +40,8 @@ export function ModelRow({ option, current, defaultId, botModel = false, onPick
data-org-blocked={blocked || undefined}
disabled={blocked}
aria-pressed={current}
- aria-label={blocked ? `${option.label} · ${t("model.orgBlocked")}` : undefined}
- title={blocked ? t("model.orgBlocked") : option.provider ? t("model.provider", { name: option.provider }) : undefined}
+ aria-label={blocked ? `${option.label} · ${reason}` : undefined}
+ title={blocked ? reason : option.provider ? t("model.provider", { name: option.provider }) : undefined}
onClick={onPick}
className={MENU_ROW}
>
diff --git a/src/components/SimpleModelMenu.tsx b/src/components/SimpleModelMenu.tsx
index 24d97f6de9..8c3fa0c6d2 100644
--- a/src/components/SimpleModelMenu.tsx
+++ b/src/components/SimpleModelMenu.tsx
@@ -52,7 +52,7 @@ function RowLines({ label, children }: { label: ReactNode; children?: ReactNode
function MenuModel({ instance, row, onPick }: { instance: InstanceInfo; row: MenuModelRow; onPick: SimpleMenuActions["onPick"] }) {
const { option } = row;
- const reason = row.blocked ? t("model.orgBlocked") : undefined;
+ const reason = row.blocked ? t(option.needsCliUpdate ? "chat.claudeUpdate.offer" : "model.orgBlocked") : undefined;
return (
<button
type="button"
diff --git a/src/components/bot-settings/ModelSection.tsx b/src/components/bot-settings/ModelSection.tsx
index 13c65984e9..28e1b8dcb8 100644
--- a/src/components/bot-settings/ModelSection.tsx
+++ b/src/components/bot-settings/ModelSection.tsx
@@ -79,7 +79,7 @@ export function FallbackChain({ bot, onChange }: { bot: Bot; onChange: (fallback
(bot.modelSelection.instanceId === instanceId && bot.modelSelection.model === model)
|| chain.some((entry, at) => at !== except && entry.instanceId === instanceId && entry.model === model);
const offeredBy = (instance: InstanceInfo | undefined) =>
- instance?.models.options.filter((model) => !model.orgBlocked && (instance.snapshot.authenticated !== false || model.custom)) ?? [];
+ instance?.models.options.filter((model) => !model.orgBlocked && !model.needsCliUpdate && (instance.snapshot.authenticated !== false || model.custom)) ?? [];
// The default too must be one the account offers now: not blocked, and signed in unless it is a custom model.
const defaultOffered = (instance: InstanceInfo) => {
const listed = instance.models.options.find((model) => model.id === instance.models.default);
diff --git a/src/lib/simple-model-menu.test.ts b/src/lib/simple-model-menu.test.ts
index ea446dc353..309a6dfbc9 100644
--- a/src/lib/simple-model-menu.test.ts
+++ b/src/lib/simple-model-menu.test.ts
@@ -241,6 +241,25 @@ describe("the Simple model menu", () => {
});
});
+describe("a model that needs a newer CLI", () => {
+ const gated = claudeModels.map((option) => option.id === "opus-5-5" ? { ...option, needsCliUpdate: "2.1.321" } : option);
+ const pick = (model: string) => ({ instanceId: "claude", model });
+ const menuOn = (model: string) => simpleModelMenu({
+ instances: [claude({}, gated)], listed: [claude({}, gated)], selection: pick(model),
+ bot: { name: "Scout", selection: pick(model) }, query: "", expanded: new Set(["claude"]), probing: new Set(), loading: false,
+ });
+
+ it("stays listed but cannot be picked", () => {
+ const body = menuOn("sonnet-5").groups[0]!.body;
+ if (body.kind !== "models") throw new Error("expected the models");
+ expect(body.rows.filter((row) => row.blocked).map((row) => row.option.id)).toEqual(["opus-5-5"]);
+ });
+
+ it("offers the update on the current row instead of failing the turn", () => {
+ expect(menuOn("opus-5-5").current).toMatchObject({ warning: true, blocked: true, meta: "Update Claude" });
+ });
+});
+
describe("a model the organization turned off", () => {
const blockedModels = claudeModels.map((option) => option.id === "opus-5-5" ? { ...option, orgBlocked: true as const } : option);
const pick = (model: string) => ({ instanceId: "claude", model });
diff --git a/src/lib/simple-model-menu.ts b/src/lib/simple-model-menu.ts
index fa3433b0d7..eae3ca1f88 100644
--- a/src/lib/simple-model-menu.ts
+++ b/src/lib/simple-model-menu.ts
@@ -143,6 +143,7 @@ function currentRow(input: SimpleMenuInput): MenuCurrent {
if (!active) return loading ? { ...row, pending: true } : { ...row, meta: t("model.simple.unavailable"), warning: true };
if (!option && input.refreshing === active.instanceId) return { ...row, pending: true };
if (option?.orgBlocked) return { ...row, meta: t("model.orgBlocked"), warning: true, blocked: true };
+ if (option?.needsCliUpdate) return { ...row, meta: t("engines.updateClaude"), warning: true, blocked: true };
if (active.policy) return { ...row, meta: t("policy.managedBy", { organization: active.policy.organizationName }), warning: true };
if (needsCli(active)) return { ...row, meta: t("model.setupRequired"), warning: true };
if (needsSignIn(active) && !isCustomOnly(active) && !option?.custom) return { ...row, meta: t("model.signInRequired"), warning: true };
@@ -179,7 +180,7 @@ export function simpleModelMenu(input: SimpleMenuInput): SimpleMenu {
label: shortModelLabel(modelOptionLabel(option), provider),
...(repeated.has(option.label) && option.provider ? { route: option.provider } : {}),
current: currentSelection ? choiceIsSelected(option, currentSelection) : false,
- blocked: option.orgBlocked === true,
+ blocked: option.orgBlocked === true || option.needsCliUpdate !== undefined,
});
const mixed = own.length > 0 && own.length < all.length;
if (query) {
diff --git a/src/lib/team-bulk-settings.ts b/src/lib/team-bulk-settings.ts
index 5e3c703fff..0fd72d84a9 100644
--- a/src/lib/team-bulk-settings.ts
+++ b/src/lib/team-bulk-settings.ts
@@ -48,7 +48,7 @@ export function teamModelChoices(bots: readonly Bot[], instances: readonly Insta
const engine = engineOf(bot, instances);
if (!engine || seen.has(engine.instanceId)) continue;
seen.add(engine.instanceId);
- const ids = [engine.models.default, ...engine.models.options.filter((option) => !option.orgBlocked).map((option) => option.id)].filter((id) => id.trim());
+ const ids = [engine.models.default, ...engine.models.options.filter((option) => !option.orgBlocked && !option.needsCliUpdate).map((option) => option.id)].filter((id) => id.trim());
for (const id of new Set(ids)) {
const label = engine.models.options.find((option) => option.id === id)?.label ?? id;
const entry = choices.get(id) ?? { id, label, engines: [] };
@@ -98,7 +98,7 @@ export function planTeamChange(bots: readonly Bot[], instances: readonly Instanc
const current = bot.modelSelection;
if (!engine) return { bot, status: "skip", reason: t("teamSettings.skip.engineMissing") };
const model = change.model ?? current.model;
- const offered = model === engine.models.default || engine.models.options.some((option) => option.id === model && !option.orgBlocked);
+ const offered = model === engine.models.default || engine.models.options.some((option) => option.id === model && !option.orgBlocked && !option.needsCliUpdate);
if (!offered) return { bot, status: "skip", reason: t("teamSettings.skip.modelUnsupported", { engine: engineName, model }) };
const next: ModelSelection = { instanceId: current.instanceId, model };
if (current.variant && model === current.model) next.variant = current.variant;
diff --git a/src/state/store.tsx b/src/state/store.tsx
index cf6b3b7e00..b22b018f38 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -481,7 +481,7 @@ export interface InstanceInfo extends InstanceEndpointInfo {
aiTest?: import("../../shared/ai-ranking").AiTestState;
/** Why it didn't answer, in plain words, when it said (signed out, a used-up limit…). */
aiTestError?: string;
- models: { default: string; options: Array<{ id: string; label: string; custom?: boolean; loaded?: boolean; provider?: string; variants?: ModelVariantOption[]; orgBlocked?: true }> };
+ models: { default: string; options: Array<{ id: string; label: string; custom?: boolean; loaded?: boolean; provider?: string; variants?: ModelVariantOption[]; orgBlocked?: true; needsCliUpdate?: string }> };
capabilities?: {
computerMcp?: boolean;
agentsMcp?: boolean;