Open source CapCut alternative.
TypeScript
feat(site): serve the Cut model catalog from the page
David Le81d0c3dd1cad
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsxindex 3238efd1..a0152282 100644--- a/site/src/cut/components/AiPanel.tsx+++ b/site/src/cut/components/AiPanel.tsx@@ -50,6 +50,7 @@ import {} from "@/cut/lib/assetRef";import { signInUrl, useSignedIn } from "@/cut/lib/generate";import { streamGeminiChat } from "@/cut/lib/geminiChat";+import { AI_MODELS } from "@/cut/lib/aiModels";import { saveAssetToLibrary } from "@/cut/lib/library";import { revealRef } from "@/cut/lib/refReveal";import { useEditor } from "@/cut/lib/store";@@ -60,15 +61,7 @@ import { MentionTextarea, RefChips, RefThumb, RefTokenChip } from "./AssetRefs";// the stock catalog. They arrive by drag (media cards, library clips, stock// tiles, timeline clips, the preview) or as @name mentions in the message.-interface AiModel {- id: string;- label: string;- provider: "claude" | "codex" | "gemini" | "test";- hidden?: boolean;-}-interface ModelsInfo {- models: AiModel[];providers: Record<string, { available: boolean; note: string }>;}@@ -768,7 +761,7 @@ function ModelSelector({}});const showTest = typeof window !== "undefined" && localStorage.getItem("cut-ai-test") === "1";- const models = (info?.models ?? []).filter((m) => !m.hidden || showTest);+ const models = AI_MODELS.filter((m) => !m.hidden || showTest);const groups = ["claude", "codex", "gemini", ...(showTest ? ["test"] : [])].map((p) => ({provider: p,models: models.filter((m) => m.provider === p),diff --git a/site/src/cut/server/ai/models.ts b/site/src/cut/lib/aiModels.tssimilarity index 61%rename from site/src/cut/server/ai/models.tsrename to site/src/cut/lib/aiModels.tsindex 8b692158..6bf2498e 100644--- a/site/src/cut/server/ai/models.ts+++ b/site/src/cut/lib/aiModels.ts@@ -7,15 +7,21 @@ export interface AiModel {hidden?: boolean;}-/** Claude ids verified against the local CLI; GPT ids are Codex's naming.+/** The assistant's model catalog. It lives in the page so a site deploy+ * updates every user's picker immediately; the engine never sees this list —+ * chat passes the chosen id straight to the provider CLI or hosted route, so+ * new models work against older installed engines too.+ * Claude ids verified against the local CLI; GPT ids are Codex's naming.* Gemini runs through Donkey's hosted inference (sign-in + credits), not a local CLI. */export const AI_MODELS: AiModel[] = [{ id: "claude-fable-5", label: "Fable 5", provider: "claude" },{ id: "claude-opus-4-8", label: "Opus 4.8", provider: "claude" },{ id: "claude-sonnet-5", label: "Sonnet 5", provider: "claude" },{ id: "claude-haiku-4-5-20251001", label: "Haiku 4.5", provider: "claude" },+ { id: "gpt-5.6-terra", label: "GPT-5.6 Terra", provider: "codex" },+ { id: "gpt-5.6-luna", label: "GPT-5.6 Luna", provider: "codex" },{ id: "gpt-5.5", label: "GPT-5.5", provider: "codex" },- { id: "gpt-5.4", label: "GPT-5.4", provider: "codex" },+ { id: "gpt-5.4-mini", label: "GPT-5.4 Mini", provider: "codex" },{ id: geminiModels.flash, label: "Gemini Flash", provider: "gemini" },// Hermetic test provider for e2e runs — hidden unless enabled in the UI.{ id: "cut-test", label: "Test model", provider: "test", hidden: true },diff --git a/site/src/cut/server/http/ai.ts b/site/src/cut/server/http/ai.tsindex ac425fff..4fc1af43 100644--- a/site/src/cut/server/http/ai.ts+++ b/site/src/cut/server/http/ai.ts@@ -14,7 +14,6 @@ import {import { rewriteCaptions } from "../ai/captions";import { writeVisualCues, type VisualFrame } from "../ai/visualSubtitles";import { AI_SKILL_INDEX, AI_SKILLS, AI_TOOLS, systemPrompt } from "../ai/catalog";-import { AI_MODELS } from "../ai/models";interface ChatBody {messages: UIMessage[];@@ -382,8 +381,9 @@ export const aiApi = {value = { claude, codex };aiProbe = { at: Date.now(), value };}+ // The model catalog lives in the page (src/cut/lib/aiModels.ts); the+ // engine only reports which provider CLIs are usable on this Mac.return Response.json({- models: AI_MODELS,providers: {claude: { available: value.claude.ok, note: value.claude.note },codex: { available: value.codex.ok, note: value.codex.note },